-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new(cmd/driver,pkg/options,internal/config): added driver config
cmd tests
#362
Conversation
@@ -158,7 +158,10 @@ func (o *driverConfigOptions) RunDriverConfig(ctx context.Context, cmd *cobra.Co | |||
|
|||
d, err := driverdistro.Discover(info, driverCfg.HostRoot) | |||
if err != nil { | |||
return err | |||
if !errors.Is(err, driverdistro.ErrUnsupported) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When error is ErrUnsupported, just print that we detected an unsupported OS (we failed to determine it), and go on using the fallback generic logic.
@@ -67,7 +68,9 @@ func (o *driverPrintenvOptions) RunDriverPrintenv(_ context.Context) error { | |||
|
|||
d, err := driverdistro.Discover(kr, driver.HostRoot) | |||
if err != nil { | |||
return err | |||
if !errors.Is(err, driverdistro.ErrUnsupported) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When error is ErrUnsupported go on with undetermined
distro target.
@@ -231,7 +231,11 @@ func Load(path string) error { | |||
// Set default registry auth config path | |||
viper.SetDefault(RegistryCredentialConfigKey, DefaultRegistryCredentialConfPath) | |||
// Set default driver | |||
viper.SetDefault(DriverKey, DefaultDriver) | |||
viper.SetDefault(DriverTypeKey, DefaultDriver.Type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the retrieving of DriverFooKey
when falcoctl.yaml is an empty file (as used in tests).
Otherwise Driverer
would find an empty DriverTypeKey
value and fail during the conversion to a drivertype.Type
.
@@ -642,7 +646,7 @@ func UpdateConfigFile(key string, value interface{}, path string) error { | |||
v.Set(key, value) | |||
|
|||
if err := v.WriteConfig(); err != nil { | |||
return fmt.Errorf("unable to set key %q to config file: %w", IndexesKey, err) | |||
return fmt.Errorf("unable to set key %q to config file: %w", key, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just a wrong log.
return &DriverTypes{ | ||
Enum: NewEnum(drivertype.GetTypes(), drivertype.TypeKmod), | ||
Enum: NewEnum(types, drivertype.TypeKmod), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get a stable CLI help message, we need to sort the strings so that they always appear with same sorting.
64f44b6
to
032d96a
Compare
…mmand tests. Signed-off-by: Federico Di Pierro <[email protected]>
032d96a
to
1b5ce09
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alacuku, FedeDP, leogr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/milestone v0.7.0 |
What type of PR is this?
/kind cleanup
Any specific area of the project related to this PR?
/area cli
/area tests
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: