mirror of
https://github.com/rancher/os.git
synced 2025-09-15 22:49:08 +00:00
Initial cloud-init support for ProxmoxVE
This commit is contained in:
@@ -36,6 +36,14 @@ func CloudInit(cfg *config.CloudConfig) (*config.CloudConfig, error) {
|
||||
cfg.Rancher.CloudInit.Datasources = append([]string{"exoscale"}, cfg.Rancher.CloudInit.Datasources...)
|
||||
}
|
||||
|
||||
proxmox, err := onlyProxmox()
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
if proxmox {
|
||||
cfg.Rancher.CloudInit.Datasources = append([]string{"proxmox"}, cfg.Rancher.CloutInit.Datasources...)
|
||||
}
|
||||
|
||||
if len(cfg.Rancher.CloudInit.Datasources) == 0 {
|
||||
log.Info("No specific datasources, ignore cloudinit")
|
||||
return cfg, nil
|
||||
@@ -151,3 +159,12 @@ func onlyExoscale() (bool, error) {
|
||||
|
||||
return strings.HasPrefix(string(f), "Exoscale"), nil
|
||||
}
|
||||
|
||||
func onlyProxmox() (bool, error) {
|
||||
f, err := ioutil.ReadFile("/sys/class/dmi/id/product_name")
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return strings.Contains(string(f), "Proxmox"), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user