You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid using util.LogErrorAndExit(err, "") at every where in the code. All other functions to return proper errors to NewContext function.
call LogErrorAndExit from NewContext only by checking the errors and responding with proper wrapped message.
This way we can properly handle errors from cluster(forbidden/timeout) and make it work for those commands that does not require cluster access.
Acceptance Criteria
Unify Context functions to one function -> NewContext()
It will also include detection of s2i or devfile component in context and return context accordingly.
Segregate functions into separate files, so that each utility function visible clearly. (at some places we are rewriting the code that is available as function in context package)
Make sure some functionalities available only via context route e.g init config/envinfo, resolve app/project and remove their recurring occurrences
Add Annotations to the commands that does not require cluster access and ignore client initialization error for them.
Consolidate error handling at one place in the context package to have consistency in errors returned to the users.
Move the localConfigProvider interface to some common package and extend it in way that all localConfig/Envinfo data get accessed through it.
Some ideas to refactor context
Only make available single context function outside package, as with multiple functions it behaves differently
everywhere
https://github.com/openshift/odo/blob/master/pkg/odo/genericclioptions/context.go#L31
add parameters to specify
devfile/s2i, or if possible move the devfile/s2i detection to context,internally detect if
clusterAccessis required for the command or not.Avoid using util.LogErrorAndExit(err, "") at every where in the code. All other functions to return proper errors to
NewContextfunction.call
LogErrorAndExitfromNewContextonly by checking the errors and responding with proper wrapped message.This way we can properly handle errors from cluster(forbidden/timeout) and make it work for those commands that does not require cluster access.
Acceptance Criteria
It will also include detection of s2i or devfile component in context and return context accordingly.