Description
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 specifydevfile/s2i
, or if possible move the devfile/s2i detection to context,
internally detect ifclusterAccess
is 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
NewContext
function.
callLogErrorAndExit
fromNewContext
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.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status