mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
cli: add version validation and force flag
Version validation checks that the configured versions are not more than one minor version below the CLI's version. The validation can be disabled using --force. This is necessary for now during development as the CLI does not have a prerelease version, as our images do.
This commit is contained in:
parent
3a7b829107
commit
f204c24174
29 changed files with 590 additions and 61 deletions
|
@ -93,9 +93,9 @@ func (i *initCmd) initialize(cmd *cobra.Command, newDialer func(validator *cloud
|
|||
}
|
||||
i.log.Debugf("Using flags: %+v", flags)
|
||||
i.log.Debugf("Loading configuration file from %q", flags.configPath)
|
||||
conf, err := config.New(fileHandler, flags.configPath)
|
||||
conf, err := config.New(fileHandler, flags.configPath, flags.force)
|
||||
if err != nil {
|
||||
return displayConfigValidationErrors(cmd.ErrOrStderr(), err)
|
||||
return config.DisplayValidationErrors(cmd.ErrOrStderr(), err)
|
||||
}
|
||||
|
||||
i.log.Debugf("Checking cluster ID file")
|
||||
|
@ -282,10 +282,17 @@ func (i *initCmd) evalFlagArgs(cmd *cobra.Command) (initFlags, error) {
|
|||
}
|
||||
i.log.Debugf("Configuration path flag is %q", configPath)
|
||||
|
||||
force, err := cmd.Flags().GetBool("force")
|
||||
if err != nil {
|
||||
return initFlags{}, fmt.Errorf("parsing force argument: %w", err)
|
||||
}
|
||||
i.log.Debugf("force flag is %t", configPath)
|
||||
|
||||
return initFlags{
|
||||
configPath: configPath,
|
||||
conformance: conformance,
|
||||
masterSecretPath: masterSecretPath,
|
||||
force: force,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -294,6 +301,7 @@ type initFlags struct {
|
|||
configPath string
|
||||
masterSecretPath string
|
||||
conformance bool
|
||||
force bool
|
||||
}
|
||||
|
||||
// readOrGenerateMasterSecret reads a base64 encoded master secret from file or generates a new 32 byte secret.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue