Update to 17.1

This commit is contained in:
Garrett Holmstrom 2017-10-04 16:48:41 -07:00
parent 371f80e504
commit 536667c88b
27 changed files with 328 additions and 1348 deletions

View File

@ -1,11 +0,0 @@
Index: cloud-init-0.7.2/tools/21-cloudinit.conf
===================================================================
--- cloud-init-0.7.2.orig/tools/21-cloudinit.conf
+++ cloud-init-0.7.2/tools/21-cloudinit.conf
@@ -1,5 +1,5 @@
# Log cloudinit generated log messages to file
-:syslogtag, isequal, "[CLOUDINIT]" /var/log/cloud-init.log
+:programname, isequal, "cloud-init" /var/log/cloud-init.log
# comment out the following line to allow CLOUDINIT messages through.
# Doing so means you'll also get CLOUDINIT messages in /var/log/syslog

View File

@ -1,14 +0,0 @@
Index: cloud-init-0.7.8/tests/unittests/test_handler/test_handler_apt_source_v3.py
===================================================================
--- cloud-init-0.7.8.orig/tests/unittests/test_handler/test_handler_apt_source_v3.py
+++ cloud-init-0.7.8/tests/unittests/test_handler/test_handler_apt_source_v3.py
@@ -947,6 +947,9 @@ deb http://ubuntu.com/ubuntu/ xenial-pro
self.assertEqual(
orig, cc_apt_configure.disable_suites(["proposed"], orig, rel))
+ # https://bugs.launchpad.net/cloud-init/+bug/1629149
+ import unittest
+ @unittest.skip('module not used on Fedora; test is env-sensitive')
def test_apt_v3_mirror_search_dns(self):
"""test_apt_v3_mirror_search_dns - Test searching dns patterns"""
pmir = "phit"

View File

@ -1,14 +0,0 @@
Index: cloud-init-0.7.8/systemd/cloud-init.service
===================================================================
--- cloud-init-0.7.8.orig/systemd/cloud-init.service
+++ cloud-init-0.7.8/systemd/cloud-init.service
@@ -1,8 +1,7 @@
[Unit]
Description=Initial cloud-init job (metadata service crawler)
-After=cloud-init-local.service networking.service
+After=cloud-init-local.service network.service NetworkManager.service
Before=network-online.target sshd.service sshd-keygen.service systemd-user-sessions.service
-Requires=networking.service
Wants=local-fs.target cloud-init-local.service sshd.service sshd-keygen.service
[Service]

View File

@ -1,43 +0,0 @@
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
index b1fdd31..eabc67c 100644
--- a/cloudinit/settings.py
+++ b/cloudinit/settings.py
@@ -37,13 +37,16 @@ CFG_BUILTIN = {
],
'def_log_file': '/var/log/cloud-init.log',
'log_cfgs': [],
- 'syslog_fix_perms': ['syslog:adm', 'root:adm'],
+ 'mount_default_fields': [None, None, 'auto', 'defaults,nofail', '0', '2'],
+ 'ssh_deletekeys': False,
+ 'ssh_genkeytypes': [],
+ 'syslog_fix_perms': [],
'system_info': {
'paths': {
'cloud_dir': '/var/lib/cloud',
'templates_dir': '/etc/cloud/templates/',
},
- 'distro': 'ubuntu',
+ 'distro': 'fedora',
},
'vendor_data': {'enabled': True, 'prefix': []},
}
diff --git a/setup.py b/setup.py
index 0403607..d213e66 100755
--- a/setup.py
+++ b/setup.py
@@ -167,7 +167,6 @@ else:
(ETC + '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')),
(ETC + '/cloud/templates', glob('templates/*')),
(ETC + '/NetworkManager/dispatcher.d/', ['tools/hook-network-manager']),
- (ETC + '/dhcp/dhclient-exit-hooks.d/', ['tools/hook-dhclient']),
(USR_LIB_EXEC + '/cloud-init', ['tools/uncloud-init',
'tools/write-ssh-key-fingerprints']),
(USR + '/share/doc/cloud-init', [f for f in glob('doc/*') if is_f(f)]),
@@ -199,7 +198,6 @@ setuptools.setup(
scripts=['tools/cloud-init-per'],
license='Dual-licensed under GPLv3 or Apache 2.0',
data_files=data_files,
- install_requires=requirements,
cmdclass=cmdclass,
entry_points={
'console_scripts': [

View File

@ -1,32 +0,0 @@
Index: cloud-init-0.7.8/cloudinit/net/sysconfig.py
===================================================================
--- cloud-init-0.7.8.orig/cloudinit/net/sysconfig.py
+++ cloud-init-0.7.8/cloudinit/net/sysconfig.py
@@ -181,7 +181,6 @@ class Renderer(renderer.Renderer):
iface_defaults = tuple([
('ONBOOT', True),
('USERCTL', False),
- ('NM_CONTROLLED', False),
('BOOTPROTO', 'none'),
])
Index: cloud-init-0.7.8/tests/unittests/test_net.py
===================================================================
--- cloud-init-0.7.8.orig/tests/unittests/test_net.py
+++ cloud-init-0.7.8/tests/unittests/test_net.py
@@ -119,7 +119,6 @@ GATEWAY=172.19.3.254
HWADDR=fa:16:3e:ed:9a:59
IPADDR=172.19.1.34
NETMASK=255.255.252.0
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -483,7 +482,6 @@ class TestSysConfigRendering(TestCase):
BOOTPROTO=dhcp
DEVICE=eth1000
HWADDR=07-1C-C6-75-A4-BE
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

View File

@ -1,14 +0,0 @@
Index: cloud-init-0.7.9/systemd/cloud-init.service
===================================================================
--- cloud-init-0.7.9.orig/systemd/cloud-init.service
+++ cloud-init-0.7.9/systemd/cloud-init.service
@@ -4,7 +4,8 @@ Wants=cloud-init-local.service
Wants=sshd-keygen.service
Wants=sshd.service
After=cloud-init-local.service
-After=networking.service
+After=network.service
+After=NetworkManager.service
Before=network-online.target
Before=sshd-keygen.service
Before=sshd.service

View File

@ -1,68 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/ec2_utils.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/ec2_utils.py
+++ cloud-init-0.7.9/cloudinit/ec2_utils.py
@@ -82,6 +82,9 @@ class MetadataMaterializer(object):
field_name = get_name(field)
if not field or not field_name:
continue
+ # Don't materialize credentials
+ if field_name == 'security-credentials':
+ continue
if has_children(field):
if field_name not in children:
children.append(field_name)
Index: cloud-init-0.7.9/tests/unittests/test_ec2_util.py
===================================================================
--- cloud-init-0.7.9.orig/tests/unittests/test_ec2_util.py
+++ cloud-init-0.7.9/tests/unittests/test_ec2_util.py
@@ -140,4 +140,49 @@ class TestEc2Util(helpers.HttprettyTestC
self.assertEqual(bdm['ami'], 'sdb')
self.assertEqual(bdm['ephemeral0'], 'sdc')
+ @hp.activate
+ def test_metadata_no_security_credentials(self):
+ base_url = 'http://169.254.169.254/%s/meta-data/' % (self.VERSION)
+ hp.register_uri(hp.GET, base_url, status=200,
+ body="\n".join(['instance-id',
+ 'iam/']))
+ hp.register_uri(hp.GET, uh.combine_url(base_url, 'instance-id'),
+ status=200, body='i-0123451689abcdef0')
+ hp.register_uri(hp.GET,
+ uh.combine_url(base_url, 'iam/'),
+ status=200,
+ body="\n".join(['info/', 'security-credentials/']))
+ hp.register_uri(hp.GET,
+ uh.combine_url(base_url, 'iam/info/'),
+ status=200,
+ body='LastUpdated')
+ hp.register_uri(hp.GET,
+ uh.combine_url(base_url, 'iam/info/LastUpdated'),
+ status=200, body='2016-10-27T17:29:39Z')
+ hp.register_uri(hp.GET,
+ uh.combine_url(base_url, 'iam/security-credentials/'),
+ status=200,
+ body='ReadOnly/')
+ hp.register_uri(hp.GET,
+ uh.combine_url(base_url,
+ 'iam/security-credentials/ReadOnly/'),
+ status=200,
+ body="\n".join(['LastUpdated', 'Expiration']))
+ hp.register_uri(hp.GET,
+ uh.combine_url(
+ base_url,
+ 'iam/security-credentials/ReadOnly/LastUpdated'),
+ status=200, body='2016-10-27T17:28:17Z')
+ hp.register_uri(hp.GET,
+ uh.combine_url(
+ base_url,
+ 'iam/security-credentials/ReadOnly/Expiration'),
+ status=200, body='2016-10-28T00:00:34Z')
+ md = eu.get_instance_metadata(self.VERSION, retries=0, timeout=0.1)
+ self.assertEqual(md['instance-id'], 'i-0123451689abcdef0')
+ iam = md['iam']
+ self.assertEqual(1, len(iam))
+ self.assertEqual(iam['info']['LastUpdated'], '2016-10-27T17:29:39Z')
+ self.assertNotIn('security-credentials', iam)
+
# vi: ts=4 expandtab

View File

@ -1,50 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/sources/helpers/digitalocean.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/sources/helpers/digitalocean.py
+++ cloud-init-0.7.9/cloudinit/sources/helpers/digitalocean.py
@@ -121,27 +121,31 @@ def convert_network_configuration(config
return subpart
- all_nics = []
- for k in ('public', 'private'):
- if k in config:
- all_nics.extend(config[k])
-
- macs_to_nics = cloudnet.get_interfaces_by_mac()
nic_configs = []
+ macs_to_nics = cloudnet.get_interfaces_by_mac()
+ LOG.debug("nic mapping: %s", macs_to_nics)
- for nic in all_nics:
+ for n in config:
+ nic = config[n][0]
+ LOG.debug("considering %s", nic)
mac_address = nic.get('mac')
+ if mac_address not in macs_to_nics:
+ raise RuntimeError("Did not find network interface on system "
+ "with mac '%s'. Cannot apply configuration: %s"
+ % (mac_address, nic))
+
sysfs_name = macs_to_nics.get(mac_address)
nic_type = nic.get('type', 'unknown')
- # Note: the entry 'public' above contains a list, but
- # the list will only ever have one nic inside it per digital ocean.
- # If it ever had more than one nic, then this code would
- # assign all 'public' the same name.
- if_name = NIC_MAP.get(nic_type, sysfs_name)
- LOG.debug("mapped %s interface to %s, assigning name of %s",
- mac_address, sysfs_name, if_name)
+ if_name = NIC_MAP.get(nic_type, sysfs_name)
+ if if_name != sysfs_name:
+ LOG.debug("Found %s interface '%s' on '%s', assigned name of '%s'",
+ nic_type, mac_address, sysfs_name, if_name)
+ else:
+ msg = ("Found interface '%s' on '%s', which is not a public "
+ "or private interface. Using default system naming.")
+ LOG.debug(msg, mac_address, sysfs_name)
ncfg = {'type': 'physical',
'mac_address': mac_address,

View File

@ -1,32 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/sources/helpers/digitalocean.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/sources/helpers/digitalocean.py
+++ cloud-init-0.7.9/cloudinit/sources/helpers/digitalocean.py
@@ -23,11 +23,8 @@ def assign_ipv4_link_local(nic=None):
"""
if not nic:
- for cdev in sorted(cloudnet.get_devicelist()):
- if cloudnet.is_physical(cdev):
- nic = cdev
- LOG.debug("assigned nic '%s' for link-local discovery", nic)
- break
+ nic = get_link_local_nic()
+ LOG.debug("selected interface '%s' for reading metadata", nic)
if not nic:
raise RuntimeError("unable to find interfaces to access the"
@@ -57,6 +54,13 @@ def assign_ipv4_link_local(nic=None):
return nic
+def get_link_local_nic():
+ nics = [f for f in cloudnet.get_devicelist() if cloudnet.is_physical(f)]
+ if not nics:
+ return None
+ return min(nics, key=lambda d: cloudnet.read_sys_net_int(d, 'ifindex'))
+
+
def del_ipv4_link_local(nic=None):
"""Remove the ip4LL address. While this is not necessary, the ip4LL
address is extraneous and confusing to users.

View File

@ -1,158 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/sources/helpers/digitalocean.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/sources/helpers/digitalocean.py
+++ cloud-init-0.7.9/cloudinit/sources/helpers/digitalocean.py
@@ -107,15 +107,12 @@ def convert_network_configuration(config
}
"""
- def _get_subnet_part(pcfg, nameservers=None):
+ def _get_subnet_part(pcfg):
subpart = {'type': 'static',
'control': 'auto',
'address': pcfg.get('ip_address'),
'gateway': pcfg.get('gateway')}
- if nameservers:
- subpart['dns_nameservers'] = nameservers
-
if ":" in pcfg.get('ip_address'):
subpart['address'] = "{0}/{1}".format(pcfg.get('ip_address'),
pcfg.get('cidr'))
@@ -157,13 +154,8 @@ def convert_network_configuration(config
continue
sub_part = _get_subnet_part(raw_subnet)
- if nic_type == 'public' and 'anchor' not in netdef:
- # add DNS resolvers to the public interfaces only
- sub_part = _get_subnet_part(raw_subnet, dns_servers)
- else:
- # remove the gateway any non-public interfaces
- if 'gateway' in sub_part:
- del sub_part['gateway']
+ if netdef in ('private', 'anchor_ipv4', 'anchor_ipv6'):
+ del sub_part['gateway']
subnets.append(sub_part)
@@ -171,6 +163,10 @@ def convert_network_configuration(config
nic_configs.append(ncfg)
LOG.debug("nic '%s' configuration: %s", if_name, ncfg)
+ if dns_servers:
+ LOG.debug("added dns servers: %s", dns_servers)
+ nic_configs.append({'type': 'nameserver', 'address': dns_servers})
+
return {'version': 1, 'config': nic_configs}
Index: cloud-init-0.7.9/tests/unittests/test_datasource/test_digitalocean.py
===================================================================
--- cloud-init-0.7.9.orig/tests/unittests/test_datasource/test_digitalocean.py
+++ cloud-init-0.7.9/tests/unittests/test_datasource/test_digitalocean.py
@@ -194,7 +194,13 @@ class TestDataSourceDigitalOcean(TestCas
class TestNetworkConvert(TestCase):
- def _get_networking(self):
+ @mock.patch('cloudinit.net.get_interfaces_by_mac')
+ def _get_networking(self, m_get_by_mac):
+ m_get_by_mac.return_value = {
+ '04:01:57:d1:9e:01': 'ens1',
+ '04:01:57:d1:9e:02': 'ens2',
+ 'b8:ae:ed:75:5f:9a': 'enp0s25',
+ 'ae:cc:08:7c:88:00': 'meta2p1'}
netcfg = digitalocean.convert_network_configuration(
DO_META['interfaces'], DO_META['dns']['nameservers'])
self.assertIn('config', netcfg)
@@ -203,18 +209,33 @@ class TestNetworkConvert(TestCase):
def test_networking_defined(self):
netcfg = self._get_networking()
self.assertIsNotNone(netcfg)
+ dns_defined = False
- for nic_def in netcfg.get('config'):
- print(json.dumps(nic_def, indent=3))
- n_type = nic_def.get('type')
- n_subnets = nic_def.get('type')
- n_name = nic_def.get('name')
- n_mac = nic_def.get('mac_address')
-
- self.assertIsNotNone(n_type)
- self.assertIsNotNone(n_subnets)
- self.assertIsNotNone(n_name)
- self.assertIsNotNone(n_mac)
+ for part in netcfg.get('config'):
+ n_type = part.get('type')
+ print("testing part ", n_type, "\n", json.dumps(part, indent=3))
+
+ if n_type == 'nameserver':
+ n_address = part.get('address')
+ self.assertIsNotNone(n_address)
+ self.assertEqual(len(n_address), 3)
+
+ dns_resolvers = DO_META["dns"]["nameservers"]
+ for x in n_address:
+ self.assertIn(x, dns_resolvers)
+ dns_defined = True
+
+ else:
+ n_subnets = part.get('type')
+ n_name = part.get('name')
+ n_mac = part.get('mac_address')
+
+ self.assertIsNotNone(n_type)
+ self.assertIsNotNone(n_subnets)
+ self.assertIsNotNone(n_name)
+ self.assertIsNotNone(n_mac)
+
+ self.assertTrue(dns_defined)
def _get_nic_definition(self, int_type, expected_name):
"""helper function to return if_type (i.e. public) and the expected
@@ -255,12 +276,6 @@ class TestNetworkConvert(TestCase):
self.assertEqual(meta_def.get('mac'), nic_def.get('mac_address'))
self.assertEqual('physical', nic_def.get('type'))
- def _check_dns_nameservers(self, subn_def):
- self.assertIn('dns_nameservers', subn_def)
- expected_nameservers = DO_META['dns']['nameservers']
- nic_nameservers = subn_def.get('dns_nameservers')
- self.assertEqual(expected_nameservers, nic_nameservers)
-
def test_public_interface_ipv6(self):
"""test public ipv6 addressing"""
(nic_def, meta_def) = self._get_nic_definition('public', 'eth0')
@@ -275,7 +290,6 @@ class TestNetworkConvert(TestCase):
self.assertEqual(cidr_notated_address, subn_def.get('address'))
self.assertEqual(ipv6_def.get('gateway'), subn_def.get('gateway'))
- self._check_dns_nameservers(subn_def)
def test_public_interface_ipv4(self):
"""test public ipv4 addressing"""
@@ -288,7 +302,6 @@ class TestNetworkConvert(TestCase):
self.assertEqual(ipv4_def.get('netmask'), subn_def.get('netmask'))
self.assertEqual(ipv4_def.get('gateway'), subn_def.get('gateway'))
- self._check_dns_nameservers(subn_def)
def test_public_interface_anchor_ipv4(self):
"""test public ipv4 addressing"""
@@ -302,10 +315,15 @@ class TestNetworkConvert(TestCase):
self.assertEqual(ipv4_def.get('netmask'), subn_def.get('netmask'))
self.assertNotIn('gateway', subn_def)
- def test_convert_without_private(self):
+ @mock.patch('cloudinit.net.get_interfaces_by_mac')
+ def test_convert_without_private(self, m_get_by_mac):
+ m_get_by_mac.return_value = {
+ 'b8:ae:ed:75:5f:9a': 'enp0s25',
+ 'ae:cc:08:7c:88:00': 'meta2p1'}
netcfg = digitalocean.convert_network_configuration(
DO_META_2['interfaces'], DO_META_2['dns']['nameservers'])
+ # print(netcfg)
byname = {}
for i in netcfg['config']:
if 'name' in i:

View File

@ -1,28 +0,0 @@
From 8c4de19989caec2cd06cb7aef78b7c66621a54d7 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Fri, 20 Jan 2017 11:17:16 -0500
Subject: [PATCH] tests: Neuter lxd testing
We aren't going to support our cloud-init build in lxd, and it requires pylxd
bindings, which I'm not going to package myself.
---
tests/cloud_tests/platforms/__init__.py | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tests/cloud_tests/platforms/__init__.py b/tests/cloud_tests/platforms/__init__.py
index f9f5603..b21aba0 100644
--- a/tests/cloud_tests/platforms/__init__.py
+++ b/tests/cloud_tests/platforms/__init__.py
@@ -1,9 +1,6 @@
# This file is part of cloud-init. See LICENSE file for license information.
-from tests.cloud_tests.platforms import lxd
-
PLATFORMS = {
- 'lxd': lxd.LXDPlatform,
}
--
2.9.3

View File

@ -1,30 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/distros/rhel.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/distros/rhel.py
+++ cloud-init-0.7.9/cloudinit/distros/rhel.py
@@ -190,13 +190,18 @@ class Distro(distros.Distro):
if pkgs is None:
pkgs = []
- cmd = ['yum']
- # If enabled, then yum will be tolerant of errors on the command line
- # with regard to packages.
- # For example: if you request to install foo, bar and baz and baz is
- # installed; yum won't error out complaining that baz is already
- # installed.
- cmd.append("-t")
+ if util.which('dnf'):
+ LOG.debug('Using DNF for package management')
+ cmd = ['dnf']
+ else:
+ LOG.debug('Using YUM for package management')
+ # the '-t' argument makes yum tolerant of errors on the command
+ # line with regard to packages.
+ #
+ # For example: if you request to install foo, bar and baz and baz
+ # is installed; yum won't error out complaining that baz is already
+ # installed.
+ cmd = ['yum', '-t']
# Determines whether or not yum prompts for confirmation
# of critical actions. We don't want to prompt...
cmd.append("-y")

View File

@ -1,16 +0,0 @@
diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py
index be8a49e..b95b956 100644
--- a/cloudinit/ssh_util.py
+++ b/cloudinit/ssh_util.py
@@ -22,8 +22,11 @@ DEF_SSHD_CFG = "/etc/ssh/sshd_config"
VALID_KEY_TYPES = (
"dsa",
"ecdsa",
+ "ecdsa-sha2-nistp256",
"ecdsa-sha2-nistp256-cert-v01@openssh.com",
+ "ecdsa-sha2-nistp384",
"ecdsa-sha2-nistp384-cert-v01@openssh.com",
+ "ecdsa-sha2-nistp521",
"ecdsa-sha2-nistp521-cert-v01@openssh.com",
"ed25519",
"rsa",

View File

@ -1,140 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/config/cc_disk_setup.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/config/cc_disk_setup.py
+++ cloud-init-0.7.9/cloudinit/config/cc_disk_setup.py
@@ -910,12 +910,23 @@ def mkfs(fs_cfg):
"must be set.", label)
# Create the commands
+ shell = False
if fs_cmd:
fs_cmd = fs_cfg['cmd'] % {
'label': label,
'filesystem': fs_type,
'device': device,
}
+ shell = True
+
+ if overwrite:
+ LOG.warning(
+ "fs_setup:overwrite ignored because cmd was specified: %s",
+ fs_cmd)
+ if fs_opts:
+ LOG.warning(
+ "fs_setup:extra_opts ignored because cmd was specified: %s",
+ fs_cmd)
else:
# Find the mkfs command
mkfs_cmd = util.which("mkfs.%s" % fs_type)
@@ -936,14 +947,14 @@ def mkfs(fs_cfg):
if overwrite or device_type(device) == "disk":
fs_cmd.append(lookup_force_flag(fs_type))
- # Add the extends FS options
- if fs_opts:
- fs_cmd.extend(fs_opts)
+ # Add the extends FS options
+ if fs_opts:
+ fs_cmd.extend(fs_opts)
LOG.debug("Creating file system %s on %s", label, device)
- LOG.debug(" Using cmd: %s", " ".join(fs_cmd))
+ LOG.debug(" Using cmd: %s", str(fs_cmd))
try:
- util.subp(fs_cmd)
+ util.subp(fs_cmd, shell=shell)
except Exception as e:
raise Exception("Failed to exec of '%s':\n%s" % (fs_cmd, e))
Index: cloud-init-0.7.9/doc/examples/cloud-config-disk-setup.txt
===================================================================
--- cloud-init-0.7.9.orig/doc/examples/cloud-config-disk-setup.txt
+++ cloud-init-0.7.9/doc/examples/cloud-config-disk-setup.txt
@@ -155,11 +155,11 @@ fs_setup:
filesystem: 'ext3'
device: 'ephemeral0'
partition: 'auto'
- - label: mylabl2
+ - label: mylabl2
filesystem: 'ext4'
device: '/dev/xvda1'
- - special:
- cmd: mkfs -t %(FILESYSTEM)s -L %(LABEL)s %(DEVICE)s
+ - cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
+ label: mylabl3
filesystem: 'btrfs'
device: '/dev/xvdh'
Index: cloud-init-0.7.9/tests/unittests/test_handler/test_handler_disk_setup.py
===================================================================
--- cloud-init-0.7.9.orig/tests/unittests/test_handler/test_handler_disk_setup.py
+++ cloud-init-0.7.9/tests/unittests/test_handler/test_handler_disk_setup.py
@@ -17,6 +17,10 @@ class TestIsDiskUsed(TestCase):
self.check_fs = self.patches.enter_context(
mock.patch('{0}.check_fs'.format(mod_name)))
+ def tearDown(self):
+ super(TestIsDiskUsed, self).tearDown()
+ self.patches.close()
+
def test_multiple_child_nodes_returns_true(self):
self.enumerate_disk.return_value = (mock.MagicMock() for _ in range(2))
self.check_fs.return_value = (mock.MagicMock(), None, mock.MagicMock())
@@ -103,4 +107,57 @@ class TestGetPartitionMbrLayout(TestCase
',{0},83\n,,82'.format(expected_partition_size),
cc_disk_setup.get_partition_mbr_layout(disk_size, [33, [66, 82]]))
+
+@mock.patch('cloudinit.config.cc_disk_setup.find_device_node',
+ return_value=('/dev/xdb1', False))
+@mock.patch('cloudinit.config.cc_disk_setup.device_type', return_value=None)
+@mock.patch('cloudinit.config.cc_disk_setup.util.subp', return_value=('', ''))
+class TestMkfsCommandHandling(TestCase):
+
+ def test_with_cmd(self, subp, *args):
+ """mkfs honors cmd and logs warnings when extra_opts or overwrite are
+ provided."""
+ with self.assertLogs(
+ 'cloudinit.config.cc_disk_setup') as logs:
+ cc_disk_setup.mkfs({
+ 'cmd': 'mkfs -t %(filesystem)s -L %(label)s %(device)s',
+ 'filesystem': 'ext4',
+ 'device': '/dev/xdb1',
+ 'label': 'with_cmd',
+ 'extra_opts': ['should', 'generate', 'warning'],
+ 'overwrite': 'should generate warning too'
+ })
+
+ self.assertIn(
+ 'WARNING:cloudinit.config.cc_disk_setup:fs_setup:extra_opts ' +
+ 'ignored because cmd was specified: mkfs -t ext4 -L with_cmd ' +
+ '/dev/xdb1',
+ logs.output)
+ self.assertIn(
+ 'WARNING:cloudinit.config.cc_disk_setup:fs_setup:overwrite ' +
+ 'ignored because cmd was specified: mkfs -t ext4 -L with_cmd ' +
+ '/dev/xdb1',
+ logs.output)
+
+ subp.assert_called_once_with(
+ 'mkfs -t ext4 -L with_cmd /dev/xdb1', shell=True)
+
+ @mock.patch('cloudinit.config.cc_disk_setup.util.which')
+ def test_overwrite_and_extra_opts_without_cmd(self, m_which, subp, *args):
+ """mkfs observes extra_opts and overwrite settings when cmd is not
+ present."""
+ m_which.side_effect = lambda p: {'mkfs.ext4': '/sbin/mkfs.ext4'}[p]
+ cc_disk_setup.mkfs({
+ 'filesystem': 'ext4',
+ 'device': '/dev/xdb1',
+ 'label': 'without_cmd',
+ 'extra_opts': ['are', 'added'],
+ 'overwrite': True
+ })
+
+ subp.assert_called_once_with(
+ ['/sbin/mkfs.ext4', '/dev/xdb1',
+ '-L', 'without_cmd', '-F', 'are', 'added'],
+ shell=False)
+
# vi: ts=4 expandtab

View File

@ -1,44 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/distros/parsers/resolv_conf.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/distros/parsers/resolv_conf.py
+++ cloud-init-0.7.9/cloudinit/distros/parsers/resolv_conf.py
@@ -6,9 +6,11 @@
from six import StringIO
+from cloudinit.distros.parsers import chop_comment
+from cloudinit import log as logging
from cloudinit import util
-from cloudinit.distros.parsers import chop_comment
+LOG = logging.getLogger(__name__)
# See: man resolv.conf
@@ -79,9 +81,10 @@ class ResolvConf(object):
if len(new_ns) == len(current_ns):
return current_ns
if len(current_ns) >= 3:
- # Hard restriction on only 3 name servers
- raise ValueError(("Adding %r would go beyond the "
- "'3' maximum name servers") % (ns))
+ LOG.warn("ignoring nameserver %r: adding would "
+ "exceed the maximum of "
+ "'3' name servers (see resolv.conf(5))" % (ns))
+ return current_ns[:3]
self._remove_option('nameserver')
for n in new_ns:
self._contents.append(('option', ['nameserver', n, '']))
Index: cloud-init-0.7.9/tests/unittests/test_distros/test_resolv.py
===================================================================
--- cloud-init-0.7.9.orig/tests/unittests/test_distros/test_resolv.py
+++ cloud-init-0.7.9/tests/unittests/test_distros/test_resolv.py
@@ -46,7 +46,7 @@ class TestResolvHelper(TestCase):
self.assertNotIn('10.3', rp.nameservers)
self.assertEqual(len(rp.nameservers), 3)
rp.add_nameserver('10.2')
- self.assertRaises(ValueError, rp.add_nameserver, '10.3')
+ rp.add_nameserver('10.3')
self.assertNotIn('10.3', rp.nameservers)
def test_search_domains(self):

View File

@ -1,201 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/net/sysconfig.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/net/sysconfig.py
+++ cloud-init-0.7.9/cloudinit/net/sysconfig.py
@@ -87,7 +87,8 @@ class Route(ConfigMap):
def __init__(self, route_name, base_sysconf_dir):
super(Route, self).__init__()
self.last_idx = 1
- self.has_set_default = False
+ self.has_set_default_ipv4 = False
+ self.has_set_default_ipv6 = False
self._route_name = route_name
self._base_sysconf_dir = base_sysconf_dir
@@ -95,7 +96,8 @@ class Route(ConfigMap):
r = Route(self._route_name, self._base_sysconf_dir)
r._conf = self._conf.copy()
r.last_idx = self.last_idx
- r.has_set_default = self.has_set_default
+ r.has_set_default_ipv4 = self.has_set_default_ipv4
+ r.has_set_default_ipv6 = self.has_set_default_ipv6
return r
@property
@@ -119,10 +121,10 @@ class NetInterface(ConfigMap):
super(NetInterface, self).__init__()
self.children = []
self.routes = Route(iface_name, base_sysconf_dir)
- self._kind = kind
+ self.kind = kind
+
self._iface_name = iface_name
self._conf['DEVICE'] = iface_name
- self._conf['TYPE'] = self.iface_types[kind]
self._base_sysconf_dir = base_sysconf_dir
@property
@@ -140,6 +142,8 @@ class NetInterface(ConfigMap):
@kind.setter
def kind(self, kind):
+ if kind not in self.iface_types:
+ raise ValueError(kind)
self._kind = kind
self._conf['TYPE'] = self.iface_types[kind]
@@ -172,7 +176,7 @@ class Renderer(renderer.Renderer):
('BOOTPROTO', 'none'),
])
- # If these keys exist, then there values will be used to form
+ # If these keys exist, then their values will be used to form
# a BONDING_OPTS grouping; otherwise no grouping will be set.
bond_tpl_opts = tuple([
('bond_mode', "mode=%s"),
@@ -198,6 +202,7 @@ class Renderer(renderer.Renderer):
def _render_iface_shared(cls, iface, iface_cfg):
for k, v in cls.iface_defaults:
iface_cfg[k] = v
+
for (old_key, new_key) in [('mac_address', 'HWADDR'), ('mtu', 'MTU')]:
old_value = iface.get(old_key)
if old_value is not None:
@@ -226,10 +231,20 @@ class Renderer(renderer.Renderer):
if 'netmask' in subnet:
iface_cfg['NETMASK'] = subnet['netmask']
for route in subnet.get('routes', []):
+ if subnet.get('ipv6'):
+ gw_cfg = 'IPV6_DEFAULTGW'
+ else:
+ gw_cfg = 'GATEWAY'
+
if _is_default_route(route):
- if route_cfg.has_set_default:
- raise ValueError("Duplicate declaration of default"
- " route found for interface '%s'"
+ if (
+ (subnet.get('ipv4') and
+ route_cfg.has_set_default_ipv4) or
+ (subnet.get('ipv6') and
+ route_cfg.has_set_default_ipv6)
+ ):
+ raise ValueError("Duplicate declaration of default "
+ "route found for interface '%s'"
% (iface_cfg.name))
# NOTE(harlowja): ipv6 and ipv4 default gateways
gw_key = 'GATEWAY0'
@@ -241,7 +256,7 @@ class Renderer(renderer.Renderer):
# also provided the default route?
iface_cfg['DEFROUTE'] = True
if 'gateway' in route:
- iface_cfg['GATEWAY'] = route['gateway']
+ iface_cfg[gw_cfg] = route['gateway']
route_cfg.has_set_default = True
else:
gw_key = 'GATEWAY%s' % route_cfg.last_idx
Index: cloud-init-0.7.9/tests/unittests/test_net.py
===================================================================
--- cloud-init-0.7.9.orig/tests/unittests/test_net.py
+++ cloud-init-0.7.9/tests/unittests/test_net.py
@@ -165,6 +165,100 @@ nameserver 172.19.0.12
('etc/udev/rules.d/70-persistent-net.rules',
"".join(['SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ',
'ATTR{address}=="fa:16:3e:ed:9a:59", NAME="eth0"\n']))]
+ },
+ {
+ 'in_data': {
+ "services": [{"type": "dns", "address": "172.19.0.12"}],
+ "networks": [{
+ "network_id": "public-ipv4",
+ "type": "ipv4", "netmask": "255.255.252.0",
+ "link": "tap1a81968a-79",
+ "routes": [{
+ "netmask": "0.0.0.0",
+ "network": "0.0.0.0",
+ "gateway": "172.19.3.254",
+ }],
+ "ip_address": "172.19.1.34", "id": "network0"
+ }, {
+ "network_id": "public-ipv6",
+ "type": "ipv6", "netmask": "",
+ "link": "tap1a81968a-79",
+ "routes": [
+ {
+ "gateway": "2001:DB8::1",
+ "netmask": "::",
+ "network": "::"
+ }
+ ],
+ "ip_address": "2001:DB8::10", "id": "network1"
+ }],
+ "links": [
+ {
+ "ethernet_mac_address": "fa:16:3e:ed:9a:59",
+ "mtu": None, "type": "bridge", "id":
+ "tap1a81968a-79",
+ "vif_id": "1a81968a-797a-400f-8a80-567f997eb93f"
+ },
+ ],
+ },
+ 'in_macs': {
+ 'fa:16:3e:ed:9a:59': 'eth0',
+ },
+ 'out_sysconfig': [
+ ('etc/sysconfig/network-scripts/ifcfg-eth0',
+ """
+# Created by cloud-init on instance boot automatically, do not edit.
+#
+BOOTPROTO=none
+DEVICE=eth0
+HWADDR=fa:16:3e:ed:9a:59
+NM_CONTROLLED=no
+ONBOOT=yes
+TYPE=Ethernet
+USERCTL=no
+""".lstrip()),
+ ('etc/sysconfig/network-scripts/ifcfg-eth0:0',
+ """
+# Created by cloud-init on instance boot automatically, do not edit.
+#
+BOOTPROTO=static
+DEFROUTE=yes
+DEVICE=eth0:0
+GATEWAY=172.19.3.254
+HWADDR=fa:16:3e:ed:9a:59
+IPADDR=172.19.1.34
+NETMASK=255.255.252.0
+NM_CONTROLLED=no
+ONBOOT=yes
+TYPE=Ethernet
+USERCTL=no
+""".lstrip()),
+ ('etc/sysconfig/network-scripts/ifcfg-eth0:1',
+ """
+# Created by cloud-init on instance boot automatically, do not edit.
+#
+BOOTPROTO=static
+DEFROUTE=yes
+DEVICE=eth0:1
+HWADDR=fa:16:3e:ed:9a:59
+IPV6ADDR=2001:DB8::10
+IPV6INIT=yes
+IPV6_DEFAULTGW=2001:DB8::1
+NETMASK=
+NM_CONTROLLED=no
+ONBOOT=yes
+TYPE=Ethernet
+USERCTL=no
+""".lstrip()),
+ ('etc/resolv.conf',
+ """
+; Created by cloud-init on instance boot automatically, do not edit.
+;
+nameserver 172.19.0.12
+""".lstrip()),
+ ('etc/udev/rules.d/70-persistent-net.rules',
+ "".join(['SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ',
+ 'ATTR{address}=="fa:16:3e:ed:9a:59", NAME="eth0"\n']))]
}
]

View File

@ -1,140 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/distros/parsers/networkmanager_conf.py
===================================================================
--- /dev/null
+++ cloud-init-0.7.9/cloudinit/distros/parsers/networkmanager_conf.py
@@ -0,0 +1,23 @@
+# Copyright (C) 2017 Red Hat, Inc.
+#
+# Author: Ryan McCabe <rmccabe@redhat.com>
+#
+# This file is part of cloud-init. See LICENSE file for license information.
+
+import configobj
+
+# This module is used to set additional NetworkManager configuration
+# in /etc/NetworkManager/conf.d
+#
+
+
+class NetworkManagerConf(configobj.ConfigObj):
+ def __init__(self, contents):
+ configobj.ConfigObj.__init__(self, contents,
+ interpolation=False,
+ write_empty_values=False)
+
+ def set_section_keypair(self, section_name, key, value):
+ if section_name not in self.sections:
+ self.main[section_name] = {}
+ self.main[section_name] = {key: value}
Index: cloud-init-0.7.9/cloudinit/net/sysconfig.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/net/sysconfig.py
+++ cloud-init-0.7.9/cloudinit/net/sysconfig.py
@@ -5,6 +5,7 @@ import re
import six
+from cloudinit.distros.parsers import networkmanager_conf
from cloudinit.distros.parsers import resolv_conf
from cloudinit import util
@@ -197,6 +198,9 @@ class Renderer(renderer.Renderer):
self.netrules_path = config.get(
'netrules_path', 'etc/udev/rules.d/70-persistent-net.rules')
self.dns_path = config.get('dns_path', 'etc/resolv.conf')
+ nm_conf_path = 'etc/NetworkManager/conf.d/99-cloud-init.conf'
+ self.networkmanager_conf_path = config.get('networkmanager_conf_path',
+ nm_conf_path)
@classmethod
def _render_iface_shared(cls, iface, iface_cfg):
@@ -342,6 +346,21 @@ class Renderer(renderer.Renderer):
content.add_search_domain(searchdomain)
return "\n".join([_make_header(';'), str(content)])
+ @staticmethod
+ def _render_networkmanager_conf(network_state):
+ content = networkmanager_conf.NetworkManagerConf("")
+
+ # If DNS server information is provided, configure
+ # NetworkManager to not manage dns, so that /etc/resolv.conf
+ # does not get clobbered.
+ if network_state.dns_nameservers:
+ content.set_section_keypair('main', 'dns', 'none')
+
+ if len(content) == 0:
+ return None
+ out = "".join([_make_header(), "\n", "\n".join(content.write()), "\n"])
+ return out
+
@classmethod
def _render_bridge_interfaces(cls, network_state, iface_contents):
bridge_filter = renderer.filter_by_type('bridge')
@@ -387,18 +406,25 @@ class Renderer(renderer.Renderer):
return contents
def render_network_state(self, target, network_state):
+ file_mode = 0o644
base_sysconf_dir = os.path.join(target, self.sysconf_dir)
for path, data in self._render_sysconfig(base_sysconf_dir,
network_state).items():
- util.write_file(path, data)
+ util.write_file(path, data, file_mode)
if self.dns_path:
dns_path = os.path.join(target, self.dns_path)
resolv_content = self._render_dns(network_state,
existing_dns_path=dns_path)
- util.write_file(dns_path, resolv_content)
+ util.write_file(dns_path, resolv_content, file_mode)
+ if self.networkmanager_conf_path:
+ nm_conf_path = util.target_path(target,
+ self.networkmanager_conf_path)
+ nm_conf_content = self._render_networkmanager_conf(network_state)
+ if nm_conf_content:
+ util.write_file(nm_conf_path, nm_conf_content, file_mode)
if self.netrules_path:
netrules_content = self._render_persistent_net(network_state)
netrules_path = os.path.join(target, self.netrules_path)
- util.write_file(netrules_path, netrules_content)
+ util.write_file(netrules_path, netrules_content, file_mode)
# vi: ts=4 expandtab
Index: cloud-init-0.7.9/tests/unittests/test_net.py
===================================================================
--- cloud-init-0.7.9.orig/tests/unittests/test_net.py
+++ cloud-init-0.7.9/tests/unittests/test_net.py
@@ -162,6 +162,13 @@ NETMASK0=0.0.0.0
;
nameserver 172.19.0.12
""".lstrip()),
+ ('etc/NetworkManager/conf.d/99-cloud-init.conf',
+ """
+# Created by cloud-init on instance boot automatically, do not edit.
+#
+[main]
+dns = none
+""".lstrip()),
('etc/udev/rules.d/70-persistent-net.rules',
"".join(['SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ',
'ATTR{address}=="fa:16:3e:ed:9a:59", NAME="eth0"\n']))]
@@ -256,6 +263,20 @@ USERCTL=no
;
nameserver 172.19.0.12
""".lstrip()),
+ ('etc/NetworkManager/conf.d/99-cloud-init.conf',
+ """
+# Created by cloud-init on instance boot automatically, do not edit.
+#
+[main]
+dns = none
+""".lstrip()),
+ ('etc/NetworkManager/conf.d/99-cloud-init.conf',
+ """
+# Created by cloud-init on instance boot automatically, do not edit.
+#
+[main]
+dns = none
+""".lstrip()),
('etc/udev/rules.d/70-persistent-net.rules',
"".join(['SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ',
'ATTR{address}=="fa:16:3e:ed:9a:59", NAME="eth0"\n']))]

View File

@ -1,36 +0,0 @@
From 29a9296cd68516e76d0bd8da320754a222c4ee45 Mon Sep 17 00:00:00 2001
From: Dusty Mabe <dusty@dustymabe.com>
Date: Wed, 13 Sep 2017 11:08:56 -0400
Subject: [PATCH 1/2] resizefs: pass mount point to xfs_growfs
Supposedly it was never a feature to be able to pass a path to a block
device to xfs_growfs and have it grow the filesystem. The behavior changed
upstream recently. It is only supported to pass the mount point of a mounted
XFS filesystem. This causes breakages in cloud-init.
Upstream xfs change was commit b97815a0321072a7154ecab63e297af84066fc78.
https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/?id=b97815a0321
rhbz: rhbz: https://bugzilla.redhat.com/show_bug.cgi?id=1490505
Signed-off-by: Dusty Mabe <dusty@dustymabe.com>
---
cloudinit/config/cc_resizefs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
index f14d383..f42b6a6 100644
--- a/cloudinit/config/cc_resizefs.py
+++ b/cloudinit/config/cc_resizefs.py
@@ -67,7 +67,7 @@ def _resize_ext(mount_point, devpth):
def _resize_xfs(mount_point, devpth):
- return ('xfs_growfs', devpth)
+ return ('xfs_growfs', mount_point)
def _resize_ufs(mount_point, devpth):
--
2.9.4

View File

@ -1,17 +0,0 @@
Index: cloud-init-0.7.9/cloudinit/net/sysconfig.py
===================================================================
--- cloud-init-0.7.9.orig/cloudinit/net/sysconfig.py
+++ cloud-init-0.7.9/cloudinit/net/sysconfig.py
@@ -282,10 +282,10 @@ class Renderer(renderer.Renderer):
cls._render_subnet(iface_cfg, route_cfg, iface_subnets[0])
elif len(iface_subnets) > 1:
for i, iface_subnet in enumerate(iface_subnets,
- start=len(iface.children)):
+ start=len(iface_cfg.children)):
iface_sub_cfg = iface_cfg.copy()
iface_sub_cfg.name = "%s:%s" % (iface_name, i)
- iface.children.append(iface_sub_cfg)
+ iface_cfg.children.append(iface_sub_cfg)
cls._render_subnet(iface_sub_cfg, route_cfg, iface_subnet)
@classmethod

View File

@ -1,12 +0,0 @@
Index: cloud-init-0.7.9/systemd/cloud-final.service
===================================================================
--- cloud-init-0.7.9.orig/systemd/cloud-final.service
+++ cloud-init-0.7.9/systemd/cloud-final.service
@@ -1,6 +1,6 @@
[Unit]
Description=Execute cloud user/final scripts
-After=network-online.target cloud-config.service rc-local.service multi-user.target
+After=network-online.target cloud-config.service rc-local.service
Wants=network-online.target cloud-config.service
[Service]

View File

@ -1,21 +0,0 @@
Index: cloud-init-0.7.9/systemd/cloud-init.service
===================================================================
--- cloud-init-0.7.9.orig/systemd/cloud-init.service
+++ cloud-init-0.7.9/systemd/cloud-init.service
@@ -1,6 +1,5 @@
[Unit]
Description=Initial cloud-init job (metadata service crawler)
-DefaultDependencies=no
Wants=cloud-init-local.service
Wants=sshd-keygen.service
Wants=sshd.service
@@ -9,9 +8,7 @@ After=networking.service
Before=network-online.target
Before=sshd-keygen.service
Before=sshd.service
-Before=sysinit.target
Before=systemd-user-sessions.service
-Conflicts=shutdown.target
[Service]
Type=oneshot

View File

@ -0,0 +1,17 @@
Index: cloud-init-17.1/tests/cloud_tests/platforms/__init__.py
===================================================================
--- cloud-init-17.1.orig/tests/cloud_tests/platforms/__init__.py
+++ cloud-init-17.1/tests/cloud_tests/platforms/__init__.py
@@ -2,12 +2,10 @@
"""Main init."""
-from tests.cloud_tests.platforms import lxd
from tests.cloud_tests.platforms import nocloudkvm
PLATFORMS = {
'nocloud-kvm': nocloudkvm.NoCloudKVMPlatform,
- 'lxd': lxd.LXDPlatform,
}

View File

@ -0,0 +1,291 @@
Index: cloud-init-17.1/cloudinit/net/sysconfig.py
===================================================================
--- cloud-init-17.1.orig/cloudinit/net/sysconfig.py
+++ cloud-init-17.1/cloudinit/net/sysconfig.py
@@ -230,7 +230,6 @@ class Renderer(renderer.Renderer):
iface_defaults = tuple([
('ONBOOT', True),
('USERCTL', False),
- ('NM_CONTROLLED', False),
('BOOTPROTO', 'none'),
])
Index: cloud-init-17.1/tests/unittests/test_net.py
===================================================================
--- cloud-init-17.1.orig/tests/unittests/test_net.py
+++ cloud-init-17.1/tests/unittests/test_net.py
@@ -146,7 +146,6 @@ GATEWAY=172.19.3.254
HWADDR=fa:16:3e:ed:9a:59
IPADDR=172.19.1.34
NETMASK=255.255.252.0
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -214,7 +213,6 @@ IPADDR=172.19.1.34
IPADDR1=10.0.0.10
NETMASK=255.255.252.0
NETMASK1=255.255.255.0
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -304,7 +302,6 @@ IPV6ADDR_SECONDARIES="2001:DB9::10/64 20
IPV6INIT=yes
IPV6_DEFAULTGW=2001:DB8::1
NETMASK=255.255.252.0
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -428,7 +425,6 @@ NETWORK_CONFIGS = {
BOOTPROTO=none
DEVICE=eth1
HWADDR=cf:d6:af:48:e8:80
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no"""),
@@ -440,7 +436,6 @@ NETWORK_CONFIGS = {
HWADDR=c0:d6:9f:2c:e8:80
IPADDR=192.168.21.3
NETMASK=255.255.255.0
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no"""),
@@ -552,7 +547,6 @@ NETWORK_CONFIGS = {
IPV6ADDR=2001:1::1/64
IPV6INIT=yes
NETMASK=255.255.255.0
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -794,14 +788,12 @@ pre-down route del -net 10.0.0.0 netmask
DHCPV6C=yes
IPV6INIT=yes
MACADDR=aa:bb:cc:dd:ee:ff
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Bond
USERCTL=no"""),
'ifcfg-bond0.200': textwrap.dedent("""\
BOOTPROTO=dhcp
DEVICE=bond0.200
- NM_CONTROLLED=no
ONBOOT=yes
PHYSDEV=bond0
TYPE=Ethernet
@@ -817,7 +809,6 @@ pre-down route del -net 10.0.0.0 netmask
IPV6INIT=yes
IPV6_DEFAULTGW=2001:4800:78ff:1b::1
NETMASK=255.255.255.0
- NM_CONTROLLED=no
ONBOOT=yes
PRIO=22
STP=off
@@ -827,7 +818,6 @@ pre-down route del -net 10.0.0.0 netmask
BOOTPROTO=none
DEVICE=eth0
HWADDR=c0:d6:9f:2c:e8:80
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no"""),
@@ -841,7 +831,6 @@ pre-down route del -net 10.0.0.0 netmask
MTU=1500
NETMASK=255.255.255.0
NETMASK1=255.255.255.0
- NM_CONTROLLED=no
ONBOOT=yes
PHYSDEV=eth0
TYPE=Ethernet
@@ -852,7 +841,6 @@ pre-down route del -net 10.0.0.0 netmask
DEVICE=eth1
HWADDR=aa:d6:9f:2c:e8:80
MASTER=bond0
- NM_CONTROLLED=no
ONBOOT=yes
SLAVE=yes
TYPE=Ethernet
@@ -862,7 +850,6 @@ pre-down route del -net 10.0.0.0 netmask
DEVICE=eth2
HWADDR=c0:bb:9f:2c:e8:80
MASTER=bond0
- NM_CONTROLLED=no
ONBOOT=yes
SLAVE=yes
TYPE=Ethernet
@@ -872,7 +859,6 @@ pre-down route del -net 10.0.0.0 netmask
BRIDGE=br0
DEVICE=eth3
HWADDR=66:bb:9f:2c:e8:80
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no"""),
@@ -881,7 +867,6 @@ pre-down route del -net 10.0.0.0 netmask
BRIDGE=br0
DEVICE=eth4
HWADDR=98:bb:9f:2c:e8:80
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no"""),
@@ -889,7 +874,6 @@ pre-down route del -net 10.0.0.0 netmask
BOOTPROTO=dhcp
DEVICE=eth5
HWADDR=98:bb:9f:2c:e8:8a
- NM_CONTROLLED=no
ONBOOT=no
TYPE=Ethernet
USERCTL=no""")
@@ -1171,7 +1155,6 @@ pre-down route del -net 10.0.0.0 netmask
IPV6INIT=yes
NETMASK=255.255.255.0
NETMASK1=255.255.255.0
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Bond
USERCTL=no
@@ -1181,7 +1164,6 @@ pre-down route del -net 10.0.0.0 netmask
DEVICE=bond0s0
HWADDR=aa:bb:cc:dd:e8:00
MASTER=bond0
- NM_CONTROLLED=no
ONBOOT=yes
SLAVE=yes
TYPE=Ethernet
@@ -1199,7 +1181,6 @@ pre-down route del -net 10.0.0.0 netmask
DEVICE=bond0s1
HWADDR=aa:bb:cc:dd:e8:01
MASTER=bond0
- NM_CONTROLLED=no
ONBOOT=yes
SLAVE=yes
TYPE=Ethernet
@@ -1236,7 +1217,6 @@ pre-down route del -net 10.0.0.0 netmask
BOOTPROTO=none
DEVICE=en0
HWADDR=aa:bb:cc:dd:e8:00
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no"""),
@@ -1252,7 +1232,6 @@ pre-down route del -net 10.0.0.0 netmask
IPV6_DEFAULTGW=2001:1::1
NETMASK=255.255.255.0
NETMASK1=255.255.255.0
- NM_CONTROLLED=no
ONBOOT=yes
PHYSDEV=en0
TYPE=Ethernet
@@ -1293,7 +1272,6 @@ pre-down route del -net 10.0.0.0 netmask
DEVICE=br0
IPADDR=192.168.2.2
NETMASK=255.255.255.0
- NM_CONTROLLED=no
ONBOOT=yes
PRIO=22
STP=off
@@ -1307,7 +1285,6 @@ pre-down route del -net 10.0.0.0 netmask
HWADDR=52:54:00:12:34:00
IPV6ADDR=2001:1::100/96
IPV6INIT=yes
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -1319,7 +1296,6 @@ pre-down route del -net 10.0.0.0 netmask
HWADDR=52:54:00:12:34:01
IPV6ADDR=2001:1::101/96
IPV6INIT=yes
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -1393,7 +1369,6 @@ pre-down route del -net 10.0.0.0 netmask
HWADDR=52:54:00:12:34:00
IPADDR=192.168.1.2
NETMASK=255.255.255.0
- NM_CONTROLLED=no
ONBOOT=no
TYPE=Ethernet
USERCTL=no
@@ -1403,7 +1378,6 @@ pre-down route del -net 10.0.0.0 netmask
DEVICE=eth1
HWADDR=52:54:00:12:34:aa
MTU=1480
- NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -1412,7 +1386,6 @@ pre-down route del -net 10.0.0.0 netmask
BOOTPROTO=none
DEVICE=eth2
HWADDR=52:54:00:12:34:ff
- NM_CONTROLLED=no
ONBOOT=no
TYPE=Ethernet
USERCTL=no
@@ -1685,7 +1658,6 @@ class TestSysConfigRendering(CiTestCase)
BOOTPROTO=dhcp
DEVICE=eth1000
HWADDR=07-1C-C6-75-A4-BE
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -1805,7 +1777,6 @@ GATEWAY=10.0.2.2
HWADDR=52:54:00:12:34:00
IPADDR=10.0.2.15
NETMASK=255.255.255.0
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -1826,7 +1797,6 @@ USERCTL=no
#
BOOTPROTO=dhcp
DEVICE=eth0
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
Index: cloud-init-17.1/tests/unittests/test_distros/test_netconfig.py
===================================================================
--- cloud-init-17.1.orig/tests/unittests/test_distros/test_netconfig.py
+++ cloud-init-17.1/tests/unittests/test_distros/test_netconfig.py
@@ -481,7 +481,6 @@ DEVICE=eth0
GATEWAY=192.168.1.254
IPADDR=192.168.1.5
NETMASK=255.255.255.0
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -498,7 +497,6 @@ USERCTL=no
#
BOOTPROTO=dhcp
DEVICE=eth1
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -632,7 +630,6 @@ DEVICE=eth0
IPV6ADDR=2607:f0d0:1002:0011::2/64
IPV6INIT=yes
IPV6_DEFAULTGW=2607:f0d0:1002:0011::1
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
@@ -647,7 +644,6 @@ USERCTL=no
#
BOOTPROTO=dhcp
DEVICE=eth1
-NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

View File

@ -1,12 +0,0 @@
The following cloud-init modules are currently unsupported on this OS:
- apt-configure
- apt-pipelining
- apt_update_upgrade
- byobu
- chef
- emit_upstart
- fan
- grub_dpkg
- landscape
- lxd
- snappy

View File

@ -1,93 +0,0 @@
# The top level settings are used as module
# and system configuration.
# A set of users which may be applied and/or used by various modules
# when a 'default' entry is found it will reference the 'default_user'
# from the distro configuration specified below
users:
- default
# If this is set, 'root' will not be able to ssh in and they
# will get a message to login instead as the above user (fedora).
disable_root: true
# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: false
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
ssh_deletekeys: 0
ssh_genkeytypes: ~
syslog_fix_perms: ~
# Example datasource config
# datasource:
# Ec2:
# metadata_urls: ['blah.com']
# timeout: 5 # (defaults to 50 seconds)
# max_wait: 10 # (defaults to 120 seconds)
# The modules that run in the 'init' stage
cloud_init_modules:
- migrator
- seed_random
- bootcmd
- write_files
- growpart
- resizefs
- disk_setup
- mounts
- set_hostname
- update_hostname
- update_etc_hosts
- rsyslog
- users-groups
- ssh
# The modules that run in the 'config' stage
cloud_config_modules:
- locale
- set-passwords
- yum-add-repo
- ntp
- timezone
- disable-ec2-metadata
- runcmd
# The modules that run in the 'final' stage
cloud_final_modules:
- package-update-upgrade-install
- puppet
- chef
- salt-minion
- mcollective
- rightscale_userdata
- scripts-vendor
- scripts-per-once
- scripts-per-boot
- scripts-per-instance
- scripts-user
- ssh-authkey-fingerprints
- keys-to-console
- phone-home
- final-message
- power-state-change
# System and/or distro specific settings
# (not accessible to handlers/transforms)
system_info:
# This will affect which distro class gets used
distro: fedora
# Default user name + that default user's groups
default_user:
name: fedora
lock_passwd: true
gecos: Fedora
groups: [wheel, adm, systemd-journal]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
paths:
cloud_dir: /var/lib/cloud
templates_dir: /etc/cloud/templates
ssh_svcname: sshd
# vim:syntax=yaml

View File

@ -1,119 +1,19 @@
Name: cloud-init
Version: 0.7.9
Release: 9%{?dist}
Version: 17.1
Release: 1%{?dist}
Summary: Cloud instance init scripts
License: GPLv3
License: ASL 2.0 or GPLv3
URL: http://launchpad.net/cloud-init
Source0: https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz
Source1: cloud-init-fedora.cfg
Source2: cloud-init-README.fedora
Source3: cloud-init-tmpfiles.conf
Source1: cloud-init-tmpfiles.conf
Patch0: cloud-init-0.7.8-fedora.patch
# Fix rsyslog log filtering
# https://code.launchpad.net/~gholms/cloud-init/rsyslog-programname/+merge/186906
Patch1: cloud-init-0.7.5-rsyslog-programname.patch
# Add 3 ecdsa-sha2-nistp* ssh key types now that they are standardized
# https://bugzilla.redhat.com/show_bug.cgi?id=1151824
# https://bugs.launchpad.net/cloud-init/+bug/1658174
# https://git.launchpad.net/cloud-init/commit/?id=853df0a0e85002582694b88db886f206f64b23c7
Patch3: cloud-init-0.7.9-ecdsa.patch
# Use dnf instead of yum when available
# https://bugzilla.redhat.com/show_bug.cgi?id=1194451
# https://git.launchpad.net/cloud-init/commit/?id=a3daf184fd47dede8d91588281437453bd38fc1c
Patch7: cloud-init-0.7.9-dnf.patch
# Skip apt-source tests that are sensitive to the system's hostname
# https://bugs.launchpad.net/cloud-init/+bug/1629149
Patch8: cloud-init-0.7.8-apt-dns-test.patch
# Disable tests that require pylxd, which we don't have on Fedora
Patch1: cloud-init-17.1-disable-lxd-tests.patch
# Do not write NM_CONTROLLED=no in generated interface config files
# https://bugzilla.redhat.com/show_bug.cgi?id=1385172
Patch11: cloud-init-0.7.8-nm-controlled.patch
# Disable tests that require pylxd
Patch12: cloud-init-0.7.9-disable-lxd-tests.patch
# Fix calls to hostnamectl occurring before dbus is up
# https://bugzilla.redhat.com/show_bug.cgi?id=1417025
# Fix systemd dependency cycle with cloud-init and multi-user.target
# https://bugzilla.redhat.com/show_bug.cgi?id=1428492
# https://bugzilla.redhat.com/show_bug.cgi?id=1430511
Patch13: cloud-init-0.7.9-systemd-cloud-init.patch
# Fix systemd dependency cycle with cloud-final and os-collect-config
# https://bugzilla.redhat.com/show_bug.cgi?id=1420946
# https://bugzilla.redhat.com/show_bug.cgi?id=1428492
Patch14: cloud-init-0.7.9-systemd-cloud-final.patch
# Fix errors in network sysconfig handling
# https://bugzilla.redhat.com/show_bug.cgi?id=1389530
# https://bugs.launchpad.net/cloud-init/+bug/1665441
# https://git.launchpad.net/cloud-init/commit/?id=f81d6c7bde2af206d449de593b35773068270c84
Patch15: cloud-init-0.7.9-sysconfig-iface.patch
# Make > 3 name servers a warning, not a fatal error
# This is useful when both IPv4 and IPv6 name servers are present.
# https://bugs.launchpad.net/cloud-init/+bug/1670052
# https://git.launchpad.net/cloud-init/commit/?id=657fd40f9ee692a817ec4614cd0d6cb0539ffabf
Patch16: cloud-init-0.7.9-gt3-nameservers.patch
# Fix IPv6 gateways in network sysconfig
# https://bugs.launchpad.net/cloud-init/+bug/1669504
# https://git.launchpad.net/cloud-init/commit/?id=1d751a6f46f044e3c3827f3cef0e4a2e71d50fe7
Patch17: cloud-init-0.7.9-ipv6-gateway.patch
# Order cloud-init.service after network.service and NetworkManager.service
# cloud-init.service is meant to run when networking is up, but before
# network-online.target unleashes other services in case people want to
# set up networking customizations that run before those services do.
# https://bugzilla.redhat.com/show_bug.cgi?id=1400249
Patch18: cloud-init-0.7.9-before-network-target.patch
# Do not cache IAM instance profile credentials on disk
# https://bugs.launchpad.net/cloud-init/+bug/1638312
# https://git.launchpad.net/cloud-init/commit/?id=b71592ce0e0a9f9f9f225315015ca57b312ad30d
Patch19: cloud-init-0.7.9-credcache.patch
# Make DigitalOcean data sources handle DNS servers similar to OpenStack
# https://bugzilla.redhat.com/show_bug.cgi?id=1442463
# https://bugs.launchpad.net/cloud-init/+bug/1675571
# https://git.launchpad.net/cloud-init/commit/?id=5442b517ebe5508159a46d11d500fbc6ad854ba0
# https://git.launchpad.net/cloud-init/commit/?id=493f6c3e923902d5d4f3d87e1cc4c726ea90ada4
Patch20: cloud-init-0.7.9-digitalocean-loopback.patch
# Configure all NICs presented in DigitalOcean metadata
# https://bugzilla.redhat.com/show_bug.cgi?id=1442463
# https://git.launchpad.net/cloud-init/commit/?id=ff44056771416cb811879b13b97f88d8f2057071
Patch21: cloud-init-0.7.9-digitalocean-all-nics.patch
# Make DigitalOcean use interface indexes, not names, to choose which one
# to assign the link-local address used for metadata
# https://bugzilla.redhat.com/show_bug.cgi?id=1442463
# https://git.launchpad.net/cloud-init/commit/?id=dad97585be0f30202a5a351800f20d4432b94694
Patch22: cloud-init-0.7.9-digitalocean-ifindex.patch
# Resolve a conflict between cloud-init and NetworkManager writing resolv.conf
# https://bugzilla.redhat.com/show_bug.cgi?id=1454491
# https://bugzilla.redhat.com/show_bug.cgi?id=1461959
# https://bugs.launchpad.net/cloud-init/+bug/1693251
# https://git.launchpad.net/cloud-init/commit/?id=67bab5bb804e2346673430868935f6bbcdb88f13
Patch23: cloud-init-0.7.9-nm-resolvconf.patch
# Fix broken fs_setup cmd option handling
# https://bugs.launchpad.net/cloud-init/+bug/1687712
# https://git.launchpad.net/cloud-init/commit/?id=4f0f171c29bb9abb5cbb6f9adbe68015089aeed9
# https://git.launchpad.net/cloud-init/commit/?id=951863c211ab0f8c43a9443d080dbbe0f6b454a6
Patch24: cloud-init-0.7.9-fs-setup-cmd.patch
# resizefs: pass mount point to xfs_growfs
# https://bugzilla.redhat.com/show_bug.cgi?id=1490505
# https://code.launchpad.net/~dustymabe/cloud-init/+git/cloud-init/+merge/330701
Patch25: cloud-init-0.7.9-resizefs-pass-mount-point-to-xfs_growfs.patch
Patch2: cloud-init-17.1-nm-controlled.patch
BuildArch: noarch
@ -129,6 +29,7 @@ BuildRequires: python3-configobj
BuildRequires: python3-httpretty >= 0.8.14-2
BuildRequires: python3-jinja2
BuildRequires: python3-jsonpatch
BuildRequires: python3-jsonschema
BuildRequires: python3-mock
BuildRequires: python3-nose
BuildRequires: python3-oauthlib
@ -138,6 +39,9 @@ BuildRequires: python3-PyYAML
BuildRequires: python3-requests
BuildRequires: python3-six
BuildRequires: python3-unittest2
# dnf is needed to make cc_ntp unit tests work
# https://bugs.launchpad.net/cloud-init/+bug/1721573
BuildRequires: /usr/bin/dnf
Requires: e2fsprogs
Requires: iproute
@ -148,6 +52,7 @@ Requires: procps
Requires: python3-configobj
Requires: python3-jinja2
Requires: python3-jsonpatch
Requires: python3-jsonschema
Requires: python3-oauthlib
Requires: python3-prettytable
Requires: python3-pyserial
@ -174,8 +79,6 @@ ssh keys and to let the user run various scripts.
sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/env python3|' \
-e 's|#!/usr/bin/python|#!/usr/bin/python3|' tools/* cloudinit/ssh_util.py
cp -p %{SOURCE2} README.fedora
%build
%py3_build
@ -184,26 +87,18 @@ cp -p %{SOURCE2} README.fedora
%install
%py3_install -- --init-system=systemd
# Don't ship the tests
rm -r $RPM_BUILD_ROOT%{python3_sitelib}/tests
python3 tools/render-cloudcfg --variant fedora > $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
mkdir -p $RPM_BUILD_ROOT/var/lib/cloud
# /run/cloud-init needs a tmpfiles.d entry
mkdir -p $RPM_BUILD_ROOT/run/cloud-init
mkdir -p $RPM_BUILD_ROOT/%{_tmpfilesdir}
cp -p %{SOURCE3} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
# We supply our own config file since our software differs from Ubuntu's.
cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
# Add in hook-dhclient to help enable azure
# https://bugzilla.redhat.com/show_bug.cgi?id=1477333
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/dhcp/dhclient-exit-hooks.d
cp -p tools/hook-dhclient $RPM_BUILD_ROOT/%{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient
%check
nosetests-%{python3_version} tests/unittests/
@ -222,8 +117,8 @@ nosetests-%{python3_version} tests/unittests/
%files
%license LICENSE
%doc ChangeLog README.fedora
%license LICENSE LICENSE-Apache2.0 LICENSE-GPLv3
%doc ChangeLog
%doc doc/*
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
%dir %{_sysconfdir}/cloud/cloud.cfg.d
@ -252,6 +147,9 @@ nosetests-%{python3_version} tests/unittests/
%changelog
* Wed Oct 4 2017 Garrett Holmstrom <gholms@fedoraproject.org> - 17.1-1
- Updated to 17.1
* Fri Sep 15 2017 Dusty Mabe <dusty@dustymabe.com> - 0.7.9-9
- Fix issues with growing xfs filesystems [RH:1490505]
- Add in hook-dhclient to help enable azure [RH:1477333]

View File

@ -1 +1 @@
SHA512 (cloud-init-0.7.9.tar.gz) = ee52909f634f51dcf9e1229a8f49faa8c562bf05b69fac108fcc80cb3217f4364a33cf696df015e4dcd7887c68cf6108729850648b4daee07b3d3247ca3cc5b1
SHA512 (cloud-init-17.1.tar.gz) = 988cae4291c8d6a5bce012b78d651c602c02ad38c3790e9ed9aa7c815ae84c98767718ab9b0d346ddbc9c83cb886d455590128af750183618c0bf0f0c5a79564