Skip to content

Commit

Permalink
fix(cmd/driver): fixed segfault in driver config command.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Dec 6, 2023
1 parent 609a8a2 commit e3a28e6
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions cmd/driver/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func NewDriverConfigCmd(ctx context.Context, opt *options.Common, driver *option
Short: "[Preview] Configure a driver",
Long: longConfig,
RunE: func(cmd *cobra.Command, args []string) error {
return o.RunDriverConfig(ctx, cmd)
return o.RunDriverConfig(ctx)
},
}

Expand All @@ -80,12 +80,7 @@ func NewDriverConfigCmd(ctx context.Context, opt *options.Common, driver *option
}

// RunDriverConfig implements the driver configuration command.
func (o *driverConfigOptions) RunDriverConfig(ctx context.Context, cmd *cobra.Command) error {
var (
dType drivertype.DriverType
err error
)

func (o *driverConfigOptions) RunDriverConfig(ctx context.Context) error {
o.Printer.Logger.Info("Running falcoctl driver config", o.Printer.Logger.Args(
"name", o.Driver.Name,
"version", o.Driver.Version,
Expand All @@ -94,8 +89,7 @@ func (o *driverConfigOptions) RunDriverConfig(ctx context.Context, cmd *cobra.Co
"repos", strings.Join(o.Driver.Repos, ",")))

if o.Update {
err = o.commit(ctx, dType)
if err != nil {
if err := o.commit(ctx, o.Driver.Type); err != nil {
return err
}
}
Expand All @@ -114,7 +108,7 @@ func checkFalcoRunsWithDrivers(engineKind string) error {
}

func (o *driverConfigOptions) replaceDriverTypeInFalcoConfig(driverType drivertype.DriverType) error {
falcoCfgFile := filepath.Clean(filepath.Join(string(os.PathSeparator), "etc", "falco", "falco.yaml"))
falcoCfgFile := filepath.Clean(filepath.Join(string(os.PathSeparator), "home", "federico", "Work", "falco", "falco.yaml"))
type engineCfg struct {
Kind string `yaml:"kind"`
}
Expand Down

0 comments on commit e3a28e6

Please sign in to comment.