Skip to content

Commit

Permalink
Make distro mandatory with warning
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesfrey committed Apr 11, 2024
1 parent 2056fbb commit 5e50e20
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/vclusterctl/cmd/migrate/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cat /my/k8s/values.yaml | vcluster migrate values --distro k8s
}}

cobraCmd.Flags().StringVarP(&c.filePath, "file", "f", "", "Path to the input file")
cobraCmd.Flags().StringVar(&c.distro, "distro", "k8s", fmt.Sprintf("Kubernetes distro of the values. Allowed distros: %s", strings.Join([]string{"k8s", "k3s", "k0s", "eks"}, ", ")))
cobraCmd.Flags().StringVar(&c.distro, "distro", "", fmt.Sprintf("Kubernetes distro of the values. Allowed distros: %s", strings.Join([]string{"k8s", "k3s", "k0s", "eks"}, ", ")))
cobraCmd.Flags().StringVarP(&c.format, "output", "o", "yaml", "Prints the output in the specified format. Allowed values: yaml, json")

return cobraCmd
Expand All @@ -61,6 +61,10 @@ func (cmd *valuesCmd) Run() error {
err error
)

if cmd.distro == "" {
return fmt.Errorf("no distro given: please set \"--distro\" (IMPORTANT: distro must match the given values)")
}

if cmd.filePath != "" {
file, err := os.Open(cmd.filePath)
if err != nil {
Expand Down

0 comments on commit 5e50e20

Please sign in to comment.