mirror of
https://github.com/rancher/os.git
synced 2025-08-10 19:12:30 +00:00
Merge pull request #1261 from rancher/revert-1256-move-packet-datasource
Revert "Move Packet datasource from cloud-init-pre to cloud-init"
This commit is contained in:
commit
f56501251e
@ -108,11 +108,6 @@ func currentDatasource() (datasource.Datasource, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ds := selectDatasource(dss)
|
ds := selectDatasource(dss)
|
||||||
|
|
||||||
if ds.Type() == "packet-metadata-service" {
|
|
||||||
enablePacketNetwork(&cfg.Rancher)
|
|
||||||
}
|
|
||||||
|
|
||||||
return ds, nil
|
return ds, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,9 +220,10 @@ func getDatasources(cfg *rancherConfig.CloudConfig) []datasource.Datasource {
|
|||||||
dss = append(dss, gce.NewDatasource("http://metadata.google.internal/"))
|
dss = append(dss, gce.NewDatasource("http://metadata.google.internal/"))
|
||||||
}
|
}
|
||||||
case "packet":
|
case "packet":
|
||||||
if network {
|
if !network {
|
||||||
dss = append(dss, packet.NewDatasource("https://metadata.packet.net/"))
|
enablePacketNetwork(&cfg.Rancher)
|
||||||
}
|
}
|
||||||
|
dss = append(dss, packet.NewDatasource("https://metadata.packet.net/"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func enablePacketNetwork(cfg *rancherConfig.RancherConfig) {
|
func enablePacketNetwork(cfg *rancherConfig.RancherConfig) {
|
||||||
|
bootStrapped := false
|
||||||
|
for _, v := range cfg.Network.Interfaces {
|
||||||
|
if v.Address != "" {
|
||||||
|
if err := netconf.ApplyNetworkConfigs(&cfg.Network); err != nil {
|
||||||
|
logrus.Errorf("Failed to bootstrap network: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
bootStrapped = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !bootStrapped {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
c := metadata.NewClient(http.DefaultClient)
|
c := metadata.NewClient(http.DefaultClient)
|
||||||
m, err := c.Metadata.Get()
|
m, err := c.Metadata.Get()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user