Skip to content

Commit

Permalink
fix: check if setup chart installed or not
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Tang <[email protected]>
  • Loading branch information
JeffreyDallas committed Nov 4, 2024
1 parent 3db1441 commit 8c5c859
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/commands/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,15 @@ export class NetworkCommand extends BaseCommand {
return lease.buildAcquireTask(task)
}
},
{
title: 'Check if cluster setup chart is installed',
task: async (ctx, task) => {
const isChartInstalled = await this.chartManager.isChartInstalled('', constants.SOLO_CLUSTER_SETUP_CHART)
if (!isChartInstalled) {
throw new SoloError(`Chart ${constants.SOLO_CLUSTER_SETUP_CHART} is not installed. Run 'solo cluster setup'`)
}

Check warning on line 239 in src/commands/network.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/network.ts#L238-L239

Added lines #L238 - L239 were not covered by tests
}
},
{
title: 'Prepare staging directory',
task: (_, parentTask) => {
Expand Down Expand Up @@ -547,7 +556,7 @@ export class NetworkCommand extends BaseCommand {
return yargs
.command({
command: 'deploy',
desc: 'Deploy solo network',
desc: "Deploy solo network. Requires the chart `solo-cluster-setup` to have been installed in the cluster. If it hasn't the following command can be ran: `solo cluster setup`",

Check warning on line 559 in src/commands/network.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/network.ts#L559

Added line #L559 was not covered by tests
builder: (y: any) => flags.setCommandFlags(y, ...NetworkCommand.DEPLOY_FLAGS_LIST),
handler: (argv: any) => {
networkCmd.logger.debug('==== Running \'network deploy\' ===')
Expand Down
3 changes: 3 additions & 0 deletions src/core/chart_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export class ChartManager {
/** List available clusters */
async getInstalledCharts (namespaceName: string) {
try {
if (!namespaceName) {
return await this.helm.list('--all-namespaces --no-headers | awk \'{print $1 " [" $9"]"}\'')
}
return await this.helm.list(`-n ${namespaceName}`, '--no-headers | awk \'{print $1 " [" $9"]"}\'')
} catch (e: Error | any) {
this.logger.showUserError(e)
Expand Down

0 comments on commit 8c5c859

Please sign in to comment.