ea1e4c38fa
This reverts commitcdfc94f4e9
, reversing changes made to2051cd3e1c
. Conflicts: config/config.go config/config_test.go config/etc_hosts.go config/etcd.go config/file.go config/fleet.go config/oem.go config/unit.go config/update.go config/user.go initialize/config.go initialize/config_test.go initialize/env.go initialize/manage_etc_hosts.go initialize/workspace.go system/env.go system/etc_hosts_test.go system/etcd.go system/etcd_test.go system/fleet.go system/fleet_test.go system/oem.go system/oem_test.go system/systemd.go system/update.go system/update_test.go test
36 lines
702 B
Go
36 lines
702 B
Go
package initialize
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/coreos/coreos-cloudinit/system"
|
|
)
|
|
|
|
type FleetEnvironment map[string]string
|
|
|
|
func (fe FleetEnvironment) String() (out string) {
|
|
norm := normalizeSvcEnv(fe)
|
|
out += "[Service]\n"
|
|
|
|
for key, val := range norm {
|
|
out += fmt.Sprintf("Environment=\"FLEET_%s=%s\"\n", key, val)
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Units generates a Unit file drop-in for fleet, if any fleet options were
|
|
// configured in cloud-config
|
|
func (fe FleetEnvironment) Units(root string) ([]system.Unit, error) {
|
|
if len(fe) < 1 {
|
|
return nil, nil
|
|
}
|
|
fleet := system.Unit{
|
|
Name: "fleet.service",
|
|
Runtime: true,
|
|
DropIn: true,
|
|
Content: fe.String(),
|
|
}
|
|
return []system.Unit{fleet}, nil
|
|
}
|