Skip to content

Commit

Permalink
Expose ELEMENTAL_CLOUD_INIT_PATHS option (#2163)
Browse files Browse the repository at this point in the history
* Expose ELEMENTAL_CLOUD_INIT_PATHS option

Signed-off-by: Andrea Mazzotti <[email protected]>
  • Loading branch information
anmazzotti authored Aug 20, 2024
1 parent b1cc863 commit b1bac09
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func NewInstallCmd(root *cobra.Command, addCheckRoot bool) *cobra.Command {
c.Flags().Bool("eject-cd", false, "Try to eject the cd on reboot, only valid if booting from iso")
c.Flags().Bool("disable-boot-entry", false, "Dont create an EFI entry for the system install.")
c.Flags().Var(snapshotterType, "snapshotter.type", "Sets the snapshotter type to install")
c.Flags().StringSlice("cloud-init-paths", []string{}, "Cloud-init config files to run during install")
addSharedInstallUpgradeFlags(c)
addLocalImageFlag(c)
addPlatformFlags(c)
Expand Down
2 changes: 1 addition & 1 deletion cmd/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func NewResetCmd(root *cobra.Command, addCheckRoot bool) *cobra.Command {
c.Flags().BoolP("reset-persistent", "", false, "Clear persistent partitions")
c.Flags().BoolP("reset-oem", "", false, "Clear OEM partitions")
c.Flags().Bool("disable-boot-entry", false, "Dont create an EFI entry for the system install.")

c.Flags().StringSlice("cloud-init-paths", []string{}, "Cloud-init config files to run during reset")
addResetFlags(c)
return c
}
Expand Down
1 change: 1 addition & 0 deletions cmd/run-stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func NewRunStage(root *cobra.Command) *cobra.Command {
}
root.AddCommand(c)
c.Flags().Bool("strict", false, "Set strict checking for errors, i.e. fail if errors were found")
c.Flags().StringSlice("cloud-init-paths", []string{}, "Cloud-init config files to run")
return c
}

Expand Down
1 change: 1 addition & 0 deletions cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func NewUpgradeCmd(root *cobra.Command, addCheckRoot bool) *cobra.Command {
root.AddCommand(c)
c.Flags().Bool("recovery", false, "Upgrade recovery image too")
c.Flags().Bool("bootloader", false, "Reinstall bootloader during the upgrade")
c.Flags().StringSlice("cloud-init-paths", []string{}, "Cloud-init config files to run during upgrade")
addSharedInstallUpgradeFlags(c)
addLocalImageFlag(c)
return c
Expand Down
1 change: 1 addition & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ func GetRunKeyEnvMap() map[string]string {
"strict": "STRICT",
"eject-cd": "EJECT_CD",
"snapshotter.type": "SNAPSHOTTER_TYPE",
"cloud-init-paths": "CLOUD_INIT_PATHS",
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/snapshotter/btrfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func newBtrfsSnapshotter(cfg types.Config, snapCfg types.SnapshotterConfig, boot
if !ok {
msg := "failed casting BtrfsConfig type"
cfg.Logger.Errorf(msg)
return nil, fmt.Errorf(msg)
return nil, fmt.Errorf("%s", msg)
}
}
return &Btrfs{
Expand Down Expand Up @@ -458,7 +458,7 @@ func (b *Btrfs) SnapshotToImageSource(snap *types.Snapshot) (*types.ImageSource,
msg := fmt.Sprintf("snapshot path does not exist: %s.", snap.Path)
b.cfg.Logger.Errorf(msg)
if err == nil {
err = fmt.Errorf(msg)
err = fmt.Errorf("%s", msg)
}
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/snapshotter/loopdevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func newLoopDeviceSnapshotter(cfg types.Config, snapCfg types.SnapshotterConfig,
if !ok {
msg := "failed casting LoopDeviceConfig type"
cfg.Logger.Errorf(msg)
return nil, fmt.Errorf(msg)
return nil, fmt.Errorf("%s", msg)
}
}
return &LoopDevice{cfg: cfg, snapshotterCfg: snapCfg, loopDevCfg: *loopDevCfg, bootloader: bootloader}, nil
Expand Down Expand Up @@ -363,7 +363,7 @@ func (l *LoopDevice) SnapshotToImageSource(snap *types.Snapshot) (*types.ImageSo
msg := fmt.Sprintf("snapshot path does not exist: %s.", snap.Path)
l.cfg.Logger.Errorf(msg)
if err == nil {
err = fmt.Errorf(msg)
err = fmt.Errorf("%s", msg)
}
return nil, err
}
Expand Down

0 comments on commit b1bac09

Please sign in to comment.