Merge pull request #119 from marineam/container
container and panic fixes
This commit is contained in:
commit
61e70fcce8
@ -31,6 +31,10 @@ func (ee EtcdEnvironment) String() (out string) {
|
|||||||
// Unit creates a Unit file drop-in for etcd, using any configured
|
// Unit creates a Unit file drop-in for etcd, using any configured
|
||||||
// options and adding a default MachineID if unset.
|
// options and adding a default MachineID if unset.
|
||||||
func (ee EtcdEnvironment) Unit(root string) (*system.Unit, error) {
|
func (ee EtcdEnvironment) Unit(root string) (*system.Unit, error) {
|
||||||
|
if ee == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
if _, ok := ee["name"]; !ok {
|
if _, ok := ee["name"]; !ok {
|
||||||
if machineID := system.MachineID(root); machineID != "" {
|
if machineID := system.MachineID(root); machineID != "" {
|
||||||
ee["name"] = machineID
|
ee["name"] = machineID
|
||||||
|
@ -152,3 +152,15 @@ Environment="ETCD_NAME=node007"
|
|||||||
t.Fatalf("File has incorrect contents")
|
t.Fatalf("File has incorrect contents")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEtcdEnvironmentWhenNil(t *testing.T) {
|
||||||
|
// EtcdEnvironment will be a nil map if it wasn't in the yaml
|
||||||
|
var ee EtcdEnvironment
|
||||||
|
if ee != nil {
|
||||||
|
t.Fatalf("EtcdEnvironment is not nil")
|
||||||
|
}
|
||||||
|
u, err := ee.Unit("")
|
||||||
|
if u != nil || err != nil {
|
||||||
|
t.Fatalf("Unit returned a non-nil value for nil input")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -5,10 +5,6 @@ ConditionPathIsMountPoint=!/media/configdrive
|
|||||||
# Only mount config drive block devices automatically in virtual machines
|
# Only mount config drive block devices automatically in virtual machines
|
||||||
ConditionVirtualization=vm
|
ConditionVirtualization=vm
|
||||||
|
|
||||||
# OpenStack defined config drive so they get to stick their name in it
|
|
||||||
Wants=user-cloudinit@media-configdrive-openstack-latest-user_data.service
|
|
||||||
Before=user-cloudinit@media-configdrive-openstack-latest-user_data.service
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=no
|
RemainAfterExit=no
|
||||||
|
@ -4,10 +4,6 @@ Conflicts=configdrive-block.service umount.target
|
|||||||
ConditionPathIsMountPoint=!/media/configdrive
|
ConditionPathIsMountPoint=!/media/configdrive
|
||||||
ConditionVirtualization=vm
|
ConditionVirtualization=vm
|
||||||
|
|
||||||
# OpenStack defined config drive so they get to stick their name in it
|
|
||||||
Wants=user-cloudinit@media-configdrive-openstack-latest-user_data.service
|
|
||||||
Before=user-cloudinit@media-configdrive-openstack-latest-user_data.service
|
|
||||||
|
|
||||||
# Support old style setup for now
|
# Support old style setup for now
|
||||||
Wants=addon-run@media-configdrive.service addon-config@media-configdrive.service
|
Wants=addon-run@media-configdrive.service addon-config@media-configdrive.service
|
||||||
Before=addon-run@media-configdrive.service addon-config@media-configdrive.service
|
Before=addon-run@media-configdrive.service addon-config@media-configdrive.service
|
||||||
|
5
units/user-cloudinit@.path
Normal file
5
units/user-cloudinit@.path
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Watch for a cloud-config at %f
|
||||||
|
|
||||||
|
[Path]
|
||||||
|
PathExists=%f
|
@ -3,9 +3,11 @@ Description=Load user-provided cloud configs
|
|||||||
Requires=system-config.target
|
Requires=system-config.target
|
||||||
After=system-config.target
|
After=system-config.target
|
||||||
|
|
||||||
# Load user_data placed by coreos-install
|
# Watch for configs at a couple common paths
|
||||||
Requires=user-cloudinit@var-lib-coreos\x2dinstall-user_data.service
|
Requires=user-cloudinit@media-configdrive-openstack-latest-user_data.path
|
||||||
After=user-cloudinit@var-lib-coreos\x2dinstall-user_data.service
|
After=user-cloudinit@media-configdrive-openstack-latest-user_data.path
|
||||||
|
Requires=user-cloudinit@var-lib-coreos\x2dinstall-user_data.path
|
||||||
|
After=user-cloudinit@var-lib-coreos\x2dinstall-user_data.path
|
||||||
|
|
||||||
Requires=user-cloudinit-proc-cmdline.service
|
Requires=user-cloudinit-proc-cmdline.service
|
||||||
After=user-cloudinit-proc-cmdline.service
|
After=user-cloudinit-proc-cmdline.service
|
||||||
|
Loading…
x
Reference in New Issue
Block a user