mirror of
https://github.com/rancher/os.git
synced 2025-06-24 14:01:34 +00:00
Post to Packet phone home URL on first boot
This commit is contained in:
parent
f56501251e
commit
2f2be31d8d
@ -1,6 +1,7 @@
|
||||
package cloudinitsave
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
@ -76,8 +77,8 @@ func enablePacketNetwork(cfg *rancherConfig.RancherConfig) {
|
||||
}
|
||||
|
||||
netCfg.Interfaces["bond0"] = bondCfg
|
||||
bytes, _ := yaml.Marshal(netCfg)
|
||||
logrus.Debugf("Generated network config: %s", string(bytes))
|
||||
b, _ := yaml.Marshal(netCfg)
|
||||
logrus.Debugf("Generated network config: %s", string(b))
|
||||
|
||||
cc := rancherConfig.CloudConfig{
|
||||
Rancher: rancherConfig.RancherConfig{
|
||||
@ -85,6 +86,13 @@ func enablePacketNetwork(cfg *rancherConfig.RancherConfig) {
|
||||
},
|
||||
}
|
||||
|
||||
// Post to phone home URL on first boot
|
||||
if _, err = os.Stat(rancherConfig.CloudConfigNetworkFile); err != nil {
|
||||
if _, err = http.Post(m.PhoneHomeURL, "application/json", bytes.NewReader([]byte{})); err != nil {
|
||||
logrus.Errorf("Failed to post to Packet phone home URL: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(path.Dir(rancherConfig.CloudConfigNetworkFile), 0700); err != nil {
|
||||
logrus.Errorf("Failed to create directory for file %s: %v", rancherConfig.CloudConfigNetworkFile, err)
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ github.com/mattn/go-shellwords v1.0.0
|
||||
github.com/opencontainers/runc edc34c4a8c1e261b5ce926ff557ecde1aff19ce3 https://github.com/ibuildthecloud/runc.git
|
||||
github.com/opencontainers/runtime-spec f955d90e70a98ddfb886bd930ffd076da9b67998
|
||||
github.com/opencontainers/specs f955d90e70a98ddfb886bd930ffd076da9b67998
|
||||
github.com/packethost/packngo 92012705236896736875186c9e49557897c6af90 https://github.com/ibuildthecloud/packngo.git
|
||||
github.com/packethost/packngo 7b3a781a3c8c45b0e55390fa3c4d24981402b99f https://github.com/joshwget/packngo.git
|
||||
github.com/pkg/errors d62207b3dc916c342cd6a7180fa861d898cf42ee
|
||||
github.com/pmezard/go-difflib d8ed2627bdf02c080bf22230dbb337003b7aba2d
|
||||
github.com/rancher/cniglue b56bd68e5df113ad3fcc59c58034c22afaede877
|
||||
|
1
vendor/github.com/packethost/packngo/metadata/metadata.go
generated
vendored
1
vendor/github.com/packethost/packngo/metadata/metadata.go
generated
vendored
@ -9,6 +9,7 @@ const (
|
||||
)
|
||||
|
||||
type Metadata struct {
|
||||
PhoneHomeURL string `json:"phone_home_url"`
|
||||
ApiUrl string `json:"api_url"`
|
||||
Id string `json:"id"`
|
||||
Hostname string `json:"hostname"`
|
||||
|
Loading…
Reference in New Issue
Block a user