diff --git a/src/cmd/initialize.go b/src/cmd/initialize.go index f64691b3c4..142cf4da0a 100644 --- a/src/cmd/initialize.go +++ b/src/cmd/initialize.go @@ -77,7 +77,7 @@ func findInitPackage(initPackageName string) (string, error) { // Create the cache directory if it doesn't exist if utils.InvalidPath(config.GetAbsCachePath()) { if err := os.MkdirAll(config.GetAbsCachePath(), 0755); err != nil { - message.Fatalf(err, "Unable to create cache directory: %s", config.GetAbsCachePath()) + message.Fatalf(err, lang.CmdInitErrUnableCreateCache, config.GetAbsCachePath()) } } @@ -175,11 +175,11 @@ func init() { v.SetDefault(V_INIT_REGISTRY_PULL_PASS, "") // Init package set variable flags - initCmd.Flags().StringToStringVar(&pkgConfig.DeployOpts.SetVariables, "set", v.GetStringMapString(V_PKG_DEPLOY_SET), "Specify deployment variables to set on the command line (KEY=value)") + initCmd.Flags().StringToStringVar(&pkgConfig.DeployOpts.SetVariables, "set", v.GetStringMapString(V_PKG_DEPLOY_SET), lang.CmdInitFlagSet) // Continue to require --confirm flag for init command to avoid accidental deployments initCmd.Flags().BoolVar(&config.CommonOptions.Confirm, "confirm", false, lang.CmdInitFlagConfirm) - initCmd.Flags().StringVar(&pkgConfig.InitOpts.Components, "components", v.GetString(V_INIT_COMPONENTS), lang.CmdInitFlagComponents) + initCmd.Flags().StringVar(&pkgConfig.DeployOpts.Components, "components", v.GetString(V_INIT_COMPONENTS), lang.CmdInitFlagComponents) initCmd.Flags().StringVar(&pkgConfig.InitOpts.StorageClass, "storage-class", v.GetString(V_INIT_STORAGE_CLASS), lang.CmdInitFlagStorageClass) // Flags for using an external Git server diff --git a/src/config/lang/english.go b/src/config/lang/english.go index df5e7e0f23..66b0e23861 100644 --- a/src/config/lang/english.go +++ b/src/config/lang/english.go @@ -107,10 +107,11 @@ const ( "# Initializing w/ an external registry:\nzarf init --registry-push-password={PASSWORD} --registry-push-username={USERNAME} --registry-url={URL}\n\n" + "# Initializing w/ an external git server:\nzarf init --git-push-password={PASSWORD} --git-push-username={USERNAME} --git-url={URL}\n\n" - CmdInitErrFlags = "Invalid command flags were provided." - CmdInitErrDownload = "failed to download the init package: %s" - CmdInitErrValidateGit = "the 'git-push-username' and 'git-push-password' flags must be provided if the 'git-url' flag is provided" - CmdInitErrValidateRegistry = "the 'registry-push-username' and 'registry-push-password' flags must be provided if the 'registry-url' flag is provided " + CmdInitErrFlags = "Invalid command flags were provided." + CmdInitErrDownload = "failed to download the init package: %s" + CmdInitErrValidateGit = "the 'git-push-username' and 'git-push-password' flags must be provided if the 'git-url' flag is provided" + CmdInitErrValidateRegistry = "the 'registry-push-username' and 'registry-push-password' flags must be provided if the 'registry-url' flag is provided " + CmdInitErrUnableCreateCache = "Unable to create the cache directory: %s" CmdInitDownloadAsk = "It seems the init package could not be found locally, but can be downloaded from %s" CmdInitDownloadNote = "Note: This will require an internet connection." @@ -118,6 +119,8 @@ const ( CmdInitDownloadCancel = "Confirm selection canceled: %s" CmdInitDownloadErrManual = "download the init package manually and place it in the current working directory" + CmdInitFlagSet = "Specify deployment variables to set on the command line (KEY=value)" + CmdInitFlagConfirm = "Confirm the install without prompting" CmdInitFlagComponents = "Specify which optional components to install. E.g. --components=git-server,logging" CmdInitFlagStorageClass = "Specify the storage class to use for the registry. E.g. --storage-class=standard" diff --git a/src/pkg/packager/components.go b/src/pkg/packager/components.go index b08d539091..a6950473e9 100644 --- a/src/pkg/packager/components.go +++ b/src/pkg/packager/components.go @@ -32,11 +32,6 @@ func (p *Packager) getValidComponents() []types.ZarfComponent { // The component list is comma-delimited list requestedNames := getRequestedComponentList(p.cfg.DeployOpts.Components) - // Init packages use a different component list - if p.cfg.IsInitConfig { - requestedNames = getRequestedComponentList(p.cfg.InitOpts.Components) - } - // Break up components into choice groups for _, component := range p.cfg.Pkg.Components { key := component.Group diff --git a/src/types/runtime.go b/src/types/runtime.go index 279a74bc31..6e6d18e891 100644 --- a/src/types/runtime.go +++ b/src/types/runtime.go @@ -31,8 +31,6 @@ type ZarfInitOptions struct { RegistryInfo RegistryInfo `json:"registryInfo" jsonschema:"description=Information about the registry Zarf is going to be using"` - Components string `json:"components" jsonschema:"description=Comma separated list of optional components to deploy"` - StorageClass string `json:"storageClass" jsonschema:"description=StorageClass of the k8s cluster Zarf is initializing"` } diff --git a/src/ui/lib/api-types.ts b/src/ui/lib/api-types.ts index 44b643339c..3882422516 100644 --- a/src/ui/lib/api-types.ts +++ b/src/ui/lib/api-types.ts @@ -759,10 +759,6 @@ export interface ZarfInitOptions { * Indicates if Zarf was initialized while deploying its own k8s cluster */ applianceMode: boolean; - /** - * Comma separated list of optional components to deploy - */ - components: string; /** * Information about the repository Zarf is going to be using */ @@ -1178,7 +1174,6 @@ const typeMap: any = { ], false), "ZarfInitOptions": o([ { json: "applianceMode", js: "applianceMode", typ: true }, - { json: "components", js: "components", typ: "" }, { json: "gitServer", js: "gitServer", typ: r("GitServerInfo") }, { json: "registryInfo", js: "registryInfo", typ: r("RegistryInfo") }, { json: "storageClass", js: "storageClass", typ: "" },