Allow installing additional packages in lxd
This commit is contained in:
parent
d56858a599
commit
e3065d6951
4 changed files with 8 additions and 2 deletions
|
|
@ -222,7 +222,8 @@ type BootstrapInstance struct {
|
|||
}
|
||||
|
||||
type UserDataOptions struct {
|
||||
DisableUpdatesOnBoot bool `json:"disable_updates_on_boot"`
|
||||
DisableUpdatesOnBoot bool `json:"disable_updates_on_boot"`
|
||||
ExtraPackages []string `json:"extra_packages"`
|
||||
}
|
||||
|
||||
type Tag struct {
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ func (l *LXD) getCreateInstanceArgs(bootstrapParams params.BootstrapInstance, sp
|
|||
}
|
||||
|
||||
bootstrapParams.UserDataOptions.DisableUpdatesOnBoot = specs.DisableUpdates
|
||||
bootstrapParams.UserDataOptions.ExtraPackages = specs.ExtraPackages
|
||||
cloudCfg, err := util.GetCloudConfig(bootstrapParams, tools, bootstrapParams.Name)
|
||||
if err != nil {
|
||||
return api.InstancesPost{}, errors.Wrap(err, "generating cloud-config")
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ import (
|
|||
)
|
||||
|
||||
type extraSpecs struct {
|
||||
DisableUpdates bool `json:"disable_updates"`
|
||||
DisableUpdates bool `json:"disable_updates"`
|
||||
ExtraPackages []string `json:"extra_packages"`
|
||||
}
|
||||
|
||||
func parseExtraSpecsFromBootstrapParams(bootstrapParams params.BootstrapInstance) (extraSpecs, error) {
|
||||
|
|
|
|||
|
|
@ -271,6 +271,9 @@ func GetCloudConfig(bootstrapParams params.BootstrapInstance, tools github.Runne
|
|||
cloudCfg.PackageUpgrade = false
|
||||
cloudCfg.Packages = []string{}
|
||||
}
|
||||
for _, pkg := range bootstrapParams.UserDataOptions.ExtraPackages {
|
||||
cloudCfg.AddPackage(pkg)
|
||||
}
|
||||
|
||||
cloudCfg.AddSSHKey(bootstrapParams.SSHKeys...)
|
||||
cloudCfg.AddFile(installScript, "/install_runner.sh", "root:root", "755")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue