Skip to content

Commit ed6e891

Browse files
authored
fix(cloud): default list for var utility commands (#7849)
This fixes an omission in the original PR that added logic for handling default variable lists for imported enterprise customers - we forgot to apply this logic to the `get variables` and `get-remote-variables` commands.
1 parent b5f52f4 commit ed6e891

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

core/src/commands/get/get-remote-variables.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { joi, joiArray } from "../../config/common.js"
1515
import { ConfigurationError } from "../../exceptions.js"
1616
import { getCloudListCommandBaseDescription, noApiMsg, throwIfLegacyCloud } from "../helpers.js"
1717
import { makeDocsLinkPlain } from "../../docs/common.js"
18-
import { getVarlistIdsFromRemoteVarsConfig } from "../../config/project.js"
1918
import type { RouterOutput } from "../../cloud/api/trpc.js"
2019
import type { EmptyObject } from "type-fest"
2120

@@ -92,7 +91,7 @@ export class GetRemoteVariablesCommand extends Command<EmptyObject, Opts> {
9291
throw new ConfigurationError({ message: noApiMsg("get", "cloud variables") })
9392
}
9493

95-
const variableListIds = getVarlistIdsFromRemoteVarsConfig(garden.importVariables)
94+
const variableListIds = await garden.cloudApi.getVariableListIds(garden.importVariables, garden.projectId, log)
9695

9796
if (variableListIds.length === 0) {
9897
log.info(dedent`

core/src/commands/get/get-variables.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { dedent, renderTable } from "../../util/string.js"
1414
import { styles } from "../../logger/styles.js"
1515
import { flatten, omit, uniqBy } from "lodash-es"
1616
import type { GardenCloudApi } from "../../cloud/api/api.js"
17-
import { defaultProjectVarfilePath, getVarlistIdsFromRemoteVarsConfig } from "../../config/project.js"
17+
import { defaultProjectVarfilePath } from "../../config/project.js"
1818
import type { DeepPrimitiveMap, PrimitiveMap } from "../../config/common.js"
1919
import type { ResolvedTemplate } from "../../template/types.js"
2020
import type { RouterOutput } from "../../cloud/api/trpc.js"
@@ -27,6 +27,7 @@ import type { Log } from "../../logger/log-entry.js"
2727
import { BooleanParameter, ChoicesParameter, StringsParameter } from "../../cli/params.js"
2828
import { filterDisableFromConfigDump } from "./helpers.js"
2929
import type { EmptyObject } from "type-fest"
30+
import { noApiMsg } from "../helpers.js"
3031

3132
const variablesListOpts = {
3233
"resolve": new ChoicesParameter({
@@ -143,7 +144,11 @@ export class GetVariablesCommand extends Command<EmptyObject, Opts> {
143144
}
144145
})
145146

146-
const variableListIds = getVarlistIdsFromRemoteVarsConfig(config.importVariables)
147+
if (!garden.cloudApi) {
148+
throw new ConfigurationError({ message: noApiMsg("get", "variables") })
149+
}
150+
151+
const variableListIds = await garden.cloudApi.getVariableListIds(garden.importVariables, garden.projectId, log)
147152
const importVariables =
148153
garden.cloudApi && variableListIds.length > 0
149154
? await getCloudVariables({ api: garden.cloudApi, variableListIds, log })

0 commit comments

Comments
 (0)