cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #05976
[Merge] ~chad.smith/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel.
Commit message:
New upstream snapshot to fix intermittent unittest failures on opennebula due to bash 5.0
LP: #1813641
Requested reviews:
cloud-init commiters (cloud-init-dev)
Related bugs:
Bug #1799540 in cloud-init: "ONBOOT not supported in SUSE distros"
https://bugs.launchpad.net/cloud-init/+bug/1799540
Bug #1813641 in cloud-init: "cloud-init on Disco, opennebula will intermittently fail unittests "
https://bugs.launchpad.net/cloud-init/+bug/1813641
For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/362363
--
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel.
diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py
index edee01e..28c79b8 100644
--- a/cloudinit/config/cc_rh_subscription.py
+++ b/cloudinit/config/cc_rh_subscription.py
@@ -249,14 +249,14 @@ class SubscriptionManager(object):
except util.ProcessExecutionError as e:
if e.stdout.rstrip() != '':
for line in e.stdout.split("\n"):
- if line is not '':
+ if line != '':
self.log_warn(line)
else:
self.log_warn("Setting the service level failed with: "
"{0}".format(e.stderr.strip()))
return False
for line in return_out.split("\n"):
- if line is not "":
+ if line != "":
self.log.debug(line)
return True
@@ -268,7 +268,7 @@ class SubscriptionManager(object):
self.log_warn("Auto-attach failed with: {0}".format(e))
return False
for line in return_out.split("\n"):
- if line is not "":
+ if line != "":
self.log.debug(line)
return True
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index fd8e501..19b3e60 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -273,6 +273,7 @@ class Renderer(renderer.Renderer):
('USERCTL', False),
('NM_CONTROLLED', False),
('BOOTPROTO', 'none'),
+ ('STARTMODE', 'auto'),
])
# If these keys exist, then their values will be used to form
@@ -367,6 +368,7 @@ class Renderer(renderer.Renderer):
iface_cfg.name))
if subnet.get('control') == 'manual':
iface_cfg['ONBOOT'] = False
+ iface_cfg['STARTMODE'] = 'manual'
# set IPv4 and IPv6 static addresses
ipv4_index = -1
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
index 6e1d04b..02c9a7b 100644
--- a/cloudinit/sources/DataSourceOpenNebula.py
+++ b/cloudinit/sources/DataSourceOpenNebula.py
@@ -337,7 +337,9 @@ def parse_shell_config(content, keylist=None, bash=None, asuser=None,
(output, _error) = util.subp(cmd, data=bcmd)
# exclude vars in bash that change on their own or that we used
- excluded = ("EPOCHREALTIME", "RANDOM", "LINENO", "SECONDS", "_", "__v")
+ excluded = (
+ "EPOCHREALTIME", "EPOCHSECONDS", "RANDOM", "LINENO", "SECONDS", "_",
+ "__v")
preset = {}
ret = {}
target = None
diff --git a/debian/changelog b/debian/changelog
index 26655fc..70f1879 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+cloud-init (18.5-21-g8ee294d5-0ubuntu1) disco; urgency=medium
+
+ * New upstream snapshot.
+ - opennebula: also exclude epochseconds from changed environment vars
+ (LP: #1813641)
+ - systemd: Render generator from template to account for system
+ differences. [Robert Schweikert]
+ - sysconfig: On SUSE, use STARTMODE instead of ONBOOT
+ [Robert Schweikert] (LP: #1799540)
+ - flake8: use ==/!= to compare str, bytes, and int literals
+ [Paride Legovini]
+
+ -- Chad Smith <chad.smith@xxxxxxxxxxxxx> Mon, 28 Jan 2019 17:01:53 -0700
+
cloud-init (18.5-17-gd1a2fe73-0ubuntu1) disco; urgency=medium
* New upstream snapshot.
diff --git a/setup.py b/setup.py
index ea37efc..186e215 100755
--- a/setup.py
+++ b/setup.py
@@ -30,6 +30,8 @@ VARIANT = None
def is_f(p):
return os.path.isfile(p)
+def is_generator(p):
+ return '-generator' in p
def tiny_p(cmd, capture=True):
# Darn python 2.6 doesn't have check_output (argggg)
@@ -90,7 +92,7 @@ def read_requires():
return str(deps).splitlines()
-def render_tmpl(template):
+def render_tmpl(template, mode=None):
"""render template into a tmpdir under same dir as setup.py
This is rendered to a temporary directory under the top level
@@ -119,6 +121,8 @@ def render_tmpl(template):
VARIANT, template, fpath])
else:
tiny_p([sys.executable, './tools/render-cloudcfg', template, fpath])
+ if mode:
+ os.chmod(fpath, mode)
# return path relative to setup.py
return os.path.join(os.path.basename(tmpd), bname)
@@ -138,8 +142,11 @@ INITSYS_FILES = {
'systemd': [render_tmpl(f)
for f in (glob('systemd/*.tmpl') +
glob('systemd/*.service') +
- glob('systemd/*.target')) if is_f(f)],
- 'systemd.generators': [f for f in glob('systemd/*-generator') if is_f(f)],
+ glob('systemd/*.target'))
+ if (is_f(f) and not is_generator(f))],
+ 'systemd.generators': [
+ render_tmpl(f, mode=0o755)
+ for f in glob('systemd/*') if is_f(f) and is_generator(f)],
'upstart': [f for f in glob('upstart/*') if is_f(f)],
}
INITSYS_ROOTS = {
diff --git a/systemd/cloud-init-generator b/systemd/cloud-init-generator.tmpl
similarity index 90%
rename from systemd/cloud-init-generator
rename to systemd/cloud-init-generator.tmpl
index bd9f267..cfa5eb5 100755
--- a/systemd/cloud-init-generator
+++ b/systemd/cloud-init-generator.tmpl
@@ -1,3 +1,4 @@
+## template:jinja
#!/bin/sh
set -f
@@ -9,7 +10,11 @@ DISABLE="disabled"
FOUND="found"
NOTFOUND="notfound"
RUN_ENABLED_FILE="$LOG_D/$ENABLE"
+{% if variant in ["suse"] %}
+CLOUD_SYSTEM_TARGET="/usr/lib/systemd/system/cloud-init.target"
+{% else %}
CLOUD_SYSTEM_TARGET="/lib/systemd/system/cloud-init.target"
+{% endif %}
CLOUD_TARGET_NAME="cloud-init.target"
# lxc sets 'container', but lets make that explicitly a global
CONTAINER="${container}"
diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py
index 6e33935..e986b59 100644
--- a/tests/unittests/test_distros/test_netconfig.py
+++ b/tests/unittests/test_distros/test_netconfig.py
@@ -468,6 +468,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -476,6 +477,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
DEVICE=eth1
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -499,6 +501,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
IPV6_DEFAULTGW=2607:f0d0:1002:0011::1
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -507,6 +510,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
DEVICE=eth1
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -559,6 +563,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -567,6 +572,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
DEVICE=eth1
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -587,6 +593,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
IPV6_DEFAULTGW=2607:f0d0:1002:0011::1
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -595,6 +602,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
DEVICE=eth1
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index 5313d2d..e041e97 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -145,6 +145,7 @@ IPADDR=172.19.1.34
NETMASK=255.255.252.0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
""".lstrip()),
@@ -178,6 +179,7 @@ IPADDR=172.19.1.34
NETMASK=255.255.252.0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
""".lstrip()),
@@ -247,6 +249,7 @@ NETMASK=255.255.252.0
NETMASK1=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
""".lstrip()),
@@ -282,6 +285,7 @@ NETMASK=255.255.252.0
NETMASK1=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
""".lstrip()),
@@ -373,6 +377,7 @@ IPV6_DEFAULTGW=2001:DB8::1
NETMASK=255.255.252.0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
""".lstrip()),
@@ -410,6 +415,7 @@ IPV6_DEFAULTGW=2001:DB8::1
NETMASK=255.255.252.0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
""".lstrip()),
@@ -526,6 +532,7 @@ NETWORK_CONFIGS = {
HWADDR=cf:d6:af:48:e8:80
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no"""),
'ifcfg-eth99': textwrap.dedent("""\
@@ -542,6 +549,7 @@ NETWORK_CONFIGS = {
METRIC=10000
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no"""),
},
@@ -655,6 +663,7 @@ NETWORK_CONFIGS = {
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
MTU=9000
@@ -694,6 +703,7 @@ NETWORK_CONFIGS = {
DEVICE=iface0
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -897,6 +907,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
MACADDR=aa:bb:cc:dd:ee:ff
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Bond
USERCTL=no"""),
'ifcfg-bond0.200': textwrap.dedent("""\
@@ -905,6 +916,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NM_CONTROLLED=no
ONBOOT=yes
PHYSDEV=bond0
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
VLAN=yes"""),
@@ -922,6 +934,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NM_CONTROLLED=no
ONBOOT=yes
PRIO=22
+ STARTMODE=auto
STP=no
TYPE=Bridge
USERCTL=no"""),
@@ -931,6 +944,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
HWADDR=c0:d6:9f:2c:e8:80
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no"""),
'ifcfg-eth0.101': textwrap.dedent("""\
@@ -949,6 +963,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NM_CONTROLLED=no
ONBOOT=yes
PHYSDEV=eth0
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
VLAN=yes"""),
@@ -959,6 +974,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
MASTER=bond0
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
SLAVE=yes
TYPE=Ethernet
USERCTL=no"""),
@@ -969,6 +985,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
MASTER=bond0
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
SLAVE=yes
TYPE=Ethernet
USERCTL=no"""),
@@ -979,6 +996,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
HWADDR=66:bb:9f:2c:e8:80
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no"""),
'ifcfg-eth4': textwrap.dedent("""\
@@ -988,6 +1006,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
HWADDR=98:bb:9f:2c:e8:80
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no"""),
'ifcfg-eth5': textwrap.dedent("""\
@@ -996,6 +1015,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
HWADDR=98:bb:9f:2c:e8:8a
NM_CONTROLLED=no
ONBOOT=no
+ STARTMODE=manual
TYPE=Ethernet
USERCTL=no""")
},
@@ -1307,6 +1327,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NETMASK1=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Bond
USERCTL=no
"""),
@@ -1318,6 +1339,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NM_CONTROLLED=no
ONBOOT=yes
SLAVE=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -1334,6 +1356,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NM_CONTROLLED=no
ONBOOT=yes
SLAVE=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -1359,6 +1382,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NETMASK1=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Bond
USERCTL=no
"""),
@@ -1370,6 +1394,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NM_CONTROLLED=no
ONBOOT=yes
SLAVE=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -1392,6 +1417,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NM_CONTROLLED=no
ONBOOT=yes
SLAVE=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -1429,6 +1455,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
HWADDR=aa:bb:cc:dd:e8:00
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no"""),
'ifcfg-en0.99': textwrap.dedent("""\
@@ -1447,6 +1474,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NM_CONTROLLED=no
ONBOOT=yes
PHYSDEV=en0
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
VLAN=yes"""),
@@ -1488,6 +1516,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NM_CONTROLLED=no
ONBOOT=yes
PRIO=22
+ STARTMODE=auto
STP=no
TYPE=Bridge
USERCTL=no
@@ -1501,6 +1530,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
IPV6INIT=yes
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -1513,6 +1543,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
IPV6INIT=yes
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -1587,6 +1618,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=no
+ STARTMODE=manual
TYPE=Ethernet
USERCTL=no
"""),
@@ -1597,6 +1629,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
MTU=1480
NM_CONTROLLED=no
ONBOOT=yes
+ STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""),
@@ -1606,6 +1639,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
HWADDR=52:54:00:12:34:ff
NM_CONTROLLED=no
ONBOOT=no
+ STARTMODE=manual
TYPE=Ethernet
USERCTL=no
"""),
@@ -1973,6 +2007,7 @@ DEVICE=eth1000
HWADDR=07-1C-C6-75-A4-BE
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
""".lstrip()
@@ -2094,6 +2129,7 @@ IPADDR=10.0.2.15
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""
@@ -2119,6 +2155,7 @@ BOOTPROTO=dhcp
DEVICE=eth0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""
@@ -2335,6 +2372,7 @@ DEVICE=eth1000
HWADDR=07-1C-C6-75-A4-BE
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
""".lstrip()
@@ -2456,6 +2494,7 @@ IPADDR=10.0.2.15
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""
@@ -2481,6 +2520,7 @@ BOOTPROTO=dhcp
DEVICE=eth0
NM_CONTROLLED=no
ONBOOT=yes
+STARTMODE=auto
TYPE=Ethernet
USERCTL=no
"""
Follow ups