drop old root command, fix flags, etc
This commit is contained in:
parent
5e3a83e585
commit
fbd550f48d
5 changed files with 78 additions and 290 deletions
39
http.go
39
http.go
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
|
@ -61,19 +60,11 @@ func (httphandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
}
|
||||
|
||||
func buildCloudConfig(name string, phoneHomeURL string) error {
|
||||
userdata, err := yaml.Marshal(cloudinit.UserData{
|
||||
Packages: argPackages,
|
||||
SSHAuthorizedKeys: argSSHKeys,
|
||||
PhoneHome: cloudinit.PhoneHome{
|
||||
URL: phoneHomeURL,
|
||||
Post: []string{"pub_key_dsa", "pub_key_rsa", "pub_key_ed25519", "fqdn"},
|
||||
},
|
||||
})
|
||||
func buildCloudConfig(base cloudinit.UserData, name string, phoneHomeURL string) error {
|
||||
userdata, err := yaml.Marshal(base)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpStaticContent["/user-data"] = append([]byte("#cloud-config\n"), userdata...)
|
||||
|
||||
metadata, err := yaml.Marshal(cloudinit.MetaData{
|
||||
|
@ -85,36 +76,16 @@ func buildCloudConfig(name string, phoneHomeURL string) error {
|
|||
}
|
||||
httpStaticContent["/meta-data"] = metadata
|
||||
|
||||
httpStaticContent["/vendor-data"] = nil
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func buildCloudConfigPrefix(prefix string, name string, phoneHomeURL string) error {
|
||||
userdata, err := yaml.Marshal(cloudinit.UserData{
|
||||
Packages: argPackages,
|
||||
SSHAuthorizedKeys: argSSHKeys,
|
||||
vendorData, err := yaml.Marshal(cloudinit.UserData{
|
||||
PhoneHome: cloudinit.PhoneHome{
|
||||
URL: phoneHomeURL,
|
||||
Post: []string{"pub_key_dsa"},
|
||||
Post: []string{"pub_key_dsa", "pub_key_rsa", "pub_key_ed25519", "fqdn"},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpStaticContent[fmt.Sprintf("/%s/user-data", prefix)] = append([]byte("#cloud-config\n"), userdata...)
|
||||
|
||||
metadata, err := yaml.Marshal(cloudinit.MetaData{
|
||||
InstanceID: name,
|
||||
LocalHostname: name,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpStaticContent[fmt.Sprintf("/%s/meta-data", prefix)] = metadata
|
||||
|
||||
httpStaticContent[fmt.Sprintf("/%s/vendor-data", prefix)] = nil
|
||||
httpStaticContent["/vendor-data"] = vendorData
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue