Skip to content

Commit

Permalink
Optimize a bit code.
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
  • Loading branch information
AndrienkoAleksandr committed Dec 7, 2021
1 parent 6041c17 commit 055e665
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/tasks/installers/operator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,14 @@ export class OperatorTasks {
{
title: 'Check workspace engine compatibility...',
task: async (_ctx: any, _task: any) => {
const yamlFilePath = path.join(ctx.resourcesPath, 'crds', 'org_v1_che_cr.yaml')
ctx.defaultCR = safeLoadFromYamlFile(yamlFilePath)
const cheCluster = await kube.getCheCluster(flags.chenamespace)

if (cheCluster) {
const yamlFilePath = path.join(ctx.resourcesPath, 'crds', 'org_v1_che_cr.yaml')
const defaultCR = safeLoadFromYamlFile(yamlFilePath)

const isDevWorkspaceEngineEnabledBeforeUpdate = cheCluster.spec.devWorkspace && cheCluster.spec.devWorkspace.enable
const isDevWorkspaceEngineEnabledAfterUpdate = isDevWorkspaceEnabled(ctx, flags) || (ctx.defaultCR.spec.devWorkspace && ctx.defaultCR.spec.devWorkspace.enable)
const isDevWorkspaceEngineEnabledAfterUpdate = isDevWorkspaceEnabled(ctx, flags) || (defaultCR.spec.devWorkspace && defaultCR.spec.devWorkspace.enable)

if (!isDevWorkspaceEngineEnabledBeforeUpdate && isDevWorkspaceEngineEnabledAfterUpdate) {
command.error('Unsupported operation: it is not possible to update current Che installation to new version with enabled \'devWorkspace\' engine.')
Expand Down

0 comments on commit 055e665

Please sign in to comment.