fix(fleet): Drop coreos.fleet from cloud-config
This commit is contained in:
parent
9757705ae8
commit
09c473a6cb
@ -14,7 +14,6 @@ type CloudConfig struct {
|
|||||||
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"`
|
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"`
|
||||||
Coreos struct {
|
Coreos struct {
|
||||||
Etcd EtcdEnvironment
|
Etcd EtcdEnvironment
|
||||||
Fleet struct{ Autostart bool }
|
|
||||||
Units []system.Unit
|
Units []system.Unit
|
||||||
}
|
}
|
||||||
WriteFiles []system.File `yaml:"write_files"`
|
WriteFiles []system.File `yaml:"write_files"`
|
||||||
@ -137,14 +136,5 @@ func Apply(cfg CloudConfig, env *Environment) error {
|
|||||||
system.StartUnits(cfg.Coreos.Units)
|
system.StartUnits(cfg.Coreos.Units)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.Coreos.Fleet.Autostart {
|
|
||||||
err := system.StartUnitByName("fleet.service")
|
|
||||||
if err == nil {
|
|
||||||
log.Printf("Started fleet service.")
|
|
||||||
} else {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,6 @@ func TestCloudConfigEmpty(t *testing.T) {
|
|||||||
t.Error("Parsed incorrect number of SSH keys")
|
t.Error("Parsed incorrect number of SSH keys")
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.Coreos.Fleet.Autostart {
|
|
||||||
t.Error("Expected AutostartFleet not to be defined")
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(cfg.WriteFiles) != 0 {
|
if len(cfg.WriteFiles) != 0 {
|
||||||
t.Error("Expected zero WriteFiles")
|
t.Error("Expected zero WriteFiles")
|
||||||
}
|
}
|
||||||
@ -36,8 +32,6 @@ func TestCloudConfig(t *testing.T) {
|
|||||||
coreos:
|
coreos:
|
||||||
etcd:
|
etcd:
|
||||||
discovery: "https://discovery.etcd.io/827c73219eeb2fa5530027c37bf18877"
|
discovery: "https://discovery.etcd.io/827c73219eeb2fa5530027c37bf18877"
|
||||||
fleet:
|
|
||||||
autostart: Yes
|
|
||||||
units:
|
units:
|
||||||
- name: 50-eth0.network
|
- name: 50-eth0.network
|
||||||
runtime: yes
|
runtime: yes
|
||||||
@ -77,10 +71,6 @@ hostname: trontastic
|
|||||||
t.Error("Expected first SSH key to be 'foobaz'")
|
t.Error("Expected first SSH key to be 'foobaz'")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Coreos.Fleet.Autostart {
|
|
||||||
t.Error("Expected AutostartFleet to be true")
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(cfg.WriteFiles) != 1 {
|
if len(cfg.WriteFiles) != 1 {
|
||||||
t.Error("Failed to parse correct number of write_files")
|
t.Error("Failed to parse correct number of write_files")
|
||||||
} else {
|
} else {
|
||||||
|
@ -133,16 +133,6 @@ func RestartUnitByName(name string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func StartUnitByName(name string) error {
|
|
||||||
conn, err := dbus.New()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = conn.StartUnit(name, "replace")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func ExecuteScript(scriptPath string) (string, error) {
|
func ExecuteScript(scriptPath string) (string, error) {
|
||||||
props := []dbus.Property{
|
props := []dbus.Property{
|
||||||
dbus.PropDescription("Unit generated and executed by coreos-cloudinit on behalf of user"),
|
dbus.PropDescription("Unit generated and executed by coreos-cloudinit on behalf of user"),
|
||||||
|
Loading…
Reference in New Issue
Block a user