Beispiel #1
0
// handlHostname takes a gentoo style /etc/conf.d/hostname and returns a cloud-config
func handleHostname(contents string, scripts_dir string) (*initialize.CloudConfig, error) {
	config := initialize.CloudConfig{}
	hostname := contents
	// HOSTNAME="polvi-test"
	re := regexp.MustCompile("HOSTNAME=\"(.+)\"")
	keys := re.FindStringSubmatch(hostname)
	if len(keys) == 2 {
		hostname := keys[1]

		config.Hostname = hostname
	}

	return &config, nil
}