Skip to content

Commit

Permalink
config: Return exit code 0 when getting default value
Browse files Browse the repository at this point in the history
`crc config get xxx` prints:
```
Configuration property 'xxx' is not set. Default value is 'yyy'
```
when its value is not set, but the command exit code is 1.

Since '1' is returned for errors (`crc config get invalid-prop`), this
is not the correct exit code. This commit changes it to 0, which is the
same as successful `crc config get` calls when the value is not the
default one.

This fixes crc-org#3678
  • Loading branch information
cfergeau committed Jun 1, 2023
1 parent f3a947b commit f8ae2dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/crc/cmd/config/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ func configGetCmd(config config.Storage) *cobra.Command {
telemetry.SetConfigurationKey(cmd.Context(), args[0])

if v.IsDefault {
return fmt.Errorf("Configuration property '%s' is not set. Default value is '%s'", key, v.AsString())

fmt.Printf("Configuration property '%s' is not set. Default value is '%s'\n", key, v.AsString())
} else {
fmt.Println(key, ":", v.AsString())
}
fmt.Println(key, ":", v.AsString())
return nil
},
}
Expand Down

0 comments on commit f8ae2dc

Please sign in to comment.