SHA256
1
0
forked from pool/cloud-init

Accepting request 607053 from Cloud:Tools

- Update to version 18.1 (bsc#1092637, bsc#1084509)
  + Forward port cloud-init-python2-sigpipe.patch
  + Forward port cloud-init-no-python-linux-dist.patch
  + Add cloud-init-no-trace-empt-sect.patch
  + Hetzner: Exit early if dmi system-manufacturer is not Hetzner.
  + Add missing dependency on isc-dhcp-client to trunk ubuntu packaging.
  + (LP: #1759307)
  + FreeBSD: resizefs module now able to handle zfs/zpool.
  + [Dominic Schlegel] (LP: #1721243)
  + cc_puppet: Revert regression of puppet creating ssl and ssl_cert dirs
  + Enable IBMCloud datasource in settings.py.
  + IBMCloud: Initial IBM Cloud datasource.
  + tests: remove jsonschema from xenial tox environment.
  + tests: Fix newly added schema unit tests to skip if no jsonschema.
  + ec2: Adjust ec2 datasource after exception_cb change.
  + Reduce AzurePreprovisioning HTTP timeouts.
  + [Douglas Jordan] (LP: #1752977)
  + Revert the logic of exception_cb in read_url.
  + [Kurt Garloff] (LP: #1702160, #1298921)
  + ubuntu-advantage: Add new config module to support
  + ubuntu-advantage-tools
  + Handle global dns entries in netplan (LP: #1750884)
  + Identify OpenTelekomCloud Xen as OpenStack DS.
  + [Kurt Garloff] (LP: #1756471)
  + datasources: fix DataSource subclass get_hostname method signature
  + (LP: #1757176)
  + OpenNebula: Update network to return v2 config rather than ENI.
  + [Akihiko Ota]
  + Add Hetzner Cloud DataSource
  + net: recognize iscsi root cases without ip= on kernel command line.

OBS-URL: https://build.opensuse.org/request/show/607053
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cloud-init?expand=0&rev=50
This commit is contained in:
Dominique Leuenberger 2018-05-15 08:15:58 +00:00 committed by Git OBS Bridge
commit a60ee52798
8 changed files with 209 additions and 124 deletions

View File

@ -64,7 +64,7 @@ Subject: [PATCH 1/3] - Support chrony configuration (lp#1731619) + Add a
"'ntp' key existed in config, but not a dictionary type,"
" is a {_type} instead".format(_type=type_utils.obj_name(ntp_cfg)))
+ if ntp_cfg.get('enabled') and ntp_cfg.get('enabled') == 'true':
+ if ntp_cfg.get('enabled'):
+ cloud.distro.set_timesync_client()
+ else:
+ # When all distro implementations are switched return here

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:49d8b7b56adbc6b8bc2aac966954c6c192382ea0500497577f8867e7e25e1ae6
size 833394

3
cloud-init-18.2.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0224969ebdae6eadffc5f40823bb206d8b05d99a1b730018535102f38b155249
size 867297

View File

@ -1,19 +1,83 @@
--- setup.py.orig
+++ setup.py
@@ -26,6 +26,7 @@ import subprocess
RENDERED_TMPD_PREFIX = "RENDERED_TEMPD"
+VARIANT = None
def is_f(p):
return os.path.isfile(p)
@@ -114,10 +115,20 @@ def render_tmpl(template):
atexit.register(shutil.rmtree, tmpd)
bname = os.path.basename(template).rstrip(tmpl_ext)
fpath = os.path.join(tmpd, bname)
- tiny_p([sys.executable, './tools/render-cloudcfg', template, fpath])
+ if VARIANT:
+ tiny_p([sys.executable, './tools/render-cloudcfg', '--variant',
+ VARIANT, template, fpath])
+ else:
+ tiny_p([sys.executable, './tools/render-cloudcfg', template, fpath])
# return path relative to setup.py
return os.path.join(os.path.basename(tmpd), bname)
+# User can set the variant for template rendering
+if '--distro' in sys.argv:
+ idx = sys.argv.index('--distro')
+ VARIANT = sys.argv[idx+1]
+ del sys.argv[idx+1]
+ sys.argv.remove('--distro')
INITSYS_FILES = {
'sysvinit': [f for f in glob('sysvinit/redhat/*') if is_f(f)],
@@ -145,7 +156,6 @@ INITSYS_ROOTS = {
}
INITSYS_TYPES = sorted([f.partition(".")[0] for f in INITSYS_ROOTS.keys()])
-
# Install everything in the right location and take care of Linux (default) and
# FreeBSD systems.
USR = "usr"
@@ -158,6 +168,19 @@ if os.uname()[0] == 'FreeBSD':
elif os.path.isfile('/etc/redhat-release'):
USR_LIB_EXEC = "usr/libexec"
+if VARIANT and sys.argv[1] == 'install':
+ base = ETC
+ config_dir = '/cloud/cloud.cfg.d'
+ if sys.argv.index('--root'):
+ root_idx = sys.argv.index('--root')
+ root_loc = sys.argv[root_idx+1]
+ base = root_loc + '/' + ETC
+ if not os.path.exists(base + config_dir):
+ os.makedirs(base + config_dir)
+ usr_distro = open(base + '/cloud/cloud.cfg.d/cloud-init.user.distro', 'w')
+ usr_distro.write(VARIANT)
+ usr_distro.close()
+
class MyEggInfo(egg_info):
"""This makes sure to not include the rendered files in SOURCES.txt."""
@@ -259,7 +282,7 @@ requirements = read_requires()
setuptools.setup(
name='cloud-init',
version=get_version(),
- description='EC2 initialisation magic',
+ description='Cloud initialisation magic',
author='Scott Moser',
author_email='scott.moser@canonical.com',
url='http://launchpad.net/cloud-init/',
--- cloudinit/tests/test_util.py.orig
+++ cloudinit/tests/test_util.py
@@ -3,10 +3,12 @@
@@ -3,6 +3,7 @@
"""Tests for cloudinit.util"""
import logging
+import platform
from textwrap import dedent
import cloudinit.util as util
from cloudinit.tests.helpers import CiTestCase, mock
+from textwrap import dedent
LOG = logging.getLogger(__name__)
@@ -15,6 +17,29 @@ MOUNT_INFO = [
@@ -16,6 +17,29 @@ MOUNT_INFO = [
'153 68 254:0 / /home rw,relatime shared:101 - xfs /dev/sda2 rw,attr2'
]
@ -41,62 +105,67 @@
+""")
+
class TestUtil(CiTestCase):
class FakeCloud(object):
@@ -44,3 +69,61 @@ class TestUtil(CiTestCase):
m_mount_info.return_value = ('/dev/sda1', 'btrfs', '/', 'ro,relatime')
@@ -65,6 +89,54 @@ class TestUtil(CiTestCase):
is_rw = util.mount_is_read_write('/')
self.assertEqual(is_rw, False)
+
+ @mock.patch('os.path.exists')
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_distro_quoted_name(self, m_os_release, m_path_exists):
+ m_os_release.return_value = OS_RELEASE_SLES
+ m_path_exists.side_effect = os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('sles', '12.3', platform.machine()), dist)
+
+ m_os_release.return_value = OS_RELEASE_SLES
+ m_path_exists.side_effect = os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('sles', '12.3', platform.machine()), dist)
+
+ @mock.patch('os.path.exists')
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_distro_bare_name(self, m_os_release, m_path_exists):
+ m_os_release.return_value = OS_RELEASE_UBUNTU
+ m_path_exists.side_effect = os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('ubuntu', '16.04', platform.machine()), dist)
+
+ m_os_release.return_value = OS_RELEASE_UBUNTU
+ m_path_exists.side_effect = os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('ubuntu', '16.04', platform.machine()), dist)
+
+ @mock.patch('os.path.exists')
+ @mock.patch('platform.dist')
+ def test_get_linux_distro_no_data(self, m_platform_dist, m_path_exists):
+ m_platform_dist.return_value = ('', '', '')
+ m_path_exists.return_value = 0
+ dist = util.get_linux_distro()
+ self.assertEqual(('', '', ''), dist)
+
+ m_platform_dist.return_value = ('', '', '')
+ m_path_exists.return_value = 0
+ dist = util.get_linux_distro()
+ self.assertEqual(('', '', ''), dist)
+
+ @mock.patch('os.path.exists')
+ @mock.patch('platform.dist')
+ def test_get_linux_distro_no_impl(self, m_platform_dist, m_path_exists):
+ m_platform_dist.side_effect = Exception()
+ m_path_exists.return_value = 0
+ dist = util.get_linux_distro()
+ self.assertEqual(('', '', ''), dist)
+
+ m_platform_dist.side_effect = Exception()
+ m_path_exists.return_value = 0
+ dist = util.get_linux_distro()
+ self.assertEqual(('', '', ''), dist)
+
+ @mock.patch('os.path.exists')
+ @mock.patch('platform.dist')
+ def test_get_linux_distro_plat_data(self, m_platform_dist, m_path_exists):
+ m_platform_dist.return_value = ('foo', '1.1', 'aarch64')
+ m_path_exists.return_value = 0
+ dist = util.get_linux_distro()
+ self.assertEqual(('foo', '1.1', 'aarch64'), dist)
+
+ m_platform_dist.return_value = ('foo', '1.1', 'aarch64')
+ m_path_exists.return_value = 0
+ dist = util.get_linux_distro()
+ self.assertEqual(('foo', '1.1', 'aarch64'), dist)
+
+ @mock.patch('os.path.exists')
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_distro_user_set(self, m_user_data, m_path_exists):
+ m_user_data.return_value = 'debian'
+ m_path_exists.side_effect = user_set_distro
+ dist = util.get_linux_distro()
+ self.assertEqual(('debian', 'not set', platform.machine()), dist)
+
+ m_user_data.return_value = 'debian'
+ m_path_exists.side_effect = user_set_distro
+ dist = util.get_linux_distro()
+ self.assertEqual(('debian', 'not set', platform.machine()), dist)
+
class TestShellify(CiTestCase):
@@ -212,4 +284,13 @@ class TestBlkid(CiTestCase):
capture=True, decode="replace")
+def os_release_exists(path):
+ if path == '/etc/os-release':
+ return 1
@ -105,9 +174,11 @@
+def user_set_distro(path):
+ if path == '/etc/cloud/cloud.cfg.d/cloud-init.user.distro':
+ return 1
+
# vi: ts=4 expandtab
--- cloudinit/util.py.orig
+++ cloudinit/util.py
@@ -576,6 +576,43 @@ def get_cfg_option_str(yobj, key, defaul
@@ -575,6 +575,43 @@ def get_cfg_option_str(yobj, key, defaul
def get_cfg_option_int(yobj, key, default=0):
return int(get_cfg_option_str(yobj, key, default=default))
@ -151,19 +222,19 @@
def system_info():
info = {
@@ -584,19 +621,19 @@ def system_info():
@@ -583,19 +620,19 @@ def system_info():
'release': platform.release(),
'python': platform.python_version(),
'uname': platform.uname(),
- 'dist': platform.dist(), # pylint: disable=W1505
+ 'dist': get_linux_distro()
+ 'dist': get_linux_distro()
}
system = info['system'].lower()
var = 'unknown'
if system == "linux":
linux_dist = info['dist'][0].lower()
- if linux_dist in ('centos', 'fedora', 'debian'):
+ if linux_dist in ('centos', 'debian', 'fedora', 'rhel', 'suse'):
+ if linux_dist in ('centos', 'fedora', 'debian', 'rhel', 'suse'):
var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu'
@ -174,65 +245,3 @@
var = 'suse'
else:
var = 'linux'
--- setup.py.orig
+++ setup.py
@@ -25,7 +25,7 @@ from distutils.errors import DistutilsAr
import subprocess
RENDERED_TMPD_PREFIX = "RENDERED_TEMPD"
-
+VARIANT = None
def is_f(p):
return os.path.isfile(p)
@@ -114,10 +114,20 @@ def render_tmpl(template):
atexit.register(shutil.rmtree, tmpd)
bname = os.path.basename(template).rstrip(tmpl_ext)
fpath = os.path.join(tmpd, bname)
- tiny_p([sys.executable, './tools/render-cloudcfg', template, fpath])
+ if VARIANT:
+ tiny_p([sys.executable, './tools/render-cloudcfg', '--variant',
+ VARIANT, template, fpath])
+ else:
+ tiny_p([sys.executable, './tools/render-cloudcfg', template, fpath])
# return path relative to setup.py
return os.path.join(os.path.basename(tmpd), bname)
+# User can set the variant for template rendering
+if '--distro' in sys.argv:
+ idx = sys.argv.index('--distro')
+ VARIANT = sys.argv[idx+1]
+ del sys.argv[idx+1]
+ sys.argv.remove('--distro')
INITSYS_FILES = {
'sysvinit': [f for f in glob('sysvinit/redhat/*') if is_f(f)],
@@ -227,6 +237,19 @@ if not in_virtualenv():
for k in INITSYS_ROOTS.keys():
INITSYS_ROOTS[k] = "/" + INITSYS_ROOTS[k]
+if VARIANT and sys.argv[1] == 'install':
+ base = ETC
+ config_dir = '/cloud/cloud.cfg.d'
+ if sys.argv.index('--root'):
+ root_idx = sys.argv.index('--root')
+ root_loc = sys.argv[root_idx+1]
+ base = root_loc + '/' + ETC
+ if not os.path.exists(base + config_dir):
+ os.makedirs(base + config_dir)
+ usr_distro = open(base + '/cloud/cloud.cfg.d/cloud-init.user.distro', 'w')
+ usr_distro.write(VARIANT)
+ usr_distro.close()
+
data_files = [
(ETC + '/cloud', [render_tmpl("config/cloud.cfg.tmpl")]),
(ETC + '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')),
@@ -259,7 +282,7 @@ requirements = read_requires()
setuptools.setup(
name='cloud-init',
version=get_version(),
- description='EC2 initialisation magic',
+ description='Cloud instance initialisation magic',
author='Scott Moser',
author_email='scott.moser@canonical.com',
url='http://launchpad.net/cloud-init/',

View File

@ -0,0 +1,13 @@
--- cloudinit/stages.py.orig
+++ cloudinit/stages.py
@@ -691,7 +691,9 @@ class Modules(object):
module_list = []
if name not in self.cfg:
return module_list
- cfg_mods = self.cfg[name]
+ cfg_mods = self.cfg.get(name)
+ if not cfg_mods:
+ return module_list
# Create 'module_list', an array of hashes
# Where hash['mod'] = module name
# hash['freq'] = frequency

View File

@ -1,20 +1,12 @@
--- cloudinit/util.py.orig
+++ cloudinit/util.py
@@ -35,6 +35,7 @@ import time
from errno import ENOENT, ENOEXEC
from base64 import b64decode, b64encode
+from signal import signal, SIGPIPE, SIG_DFL
from six.moves.urllib import parse as urlparse
import six
@@ -1868,7 +1869,8 @@ def subp(args, data=None, rcs=None, env=
@@ -1920,7 +1920,8 @@ def subp(args, data=None, rcs=None, env=
try:
sp = subprocess.Popen(args, stdout=stdout,
sp = subprocess.Popen(bytes_args, stdout=stdout,
stderr=stderr, stdin=stdin,
- env=env, shell=shell)
+ env=env, shell=shell,
+ preexec_fn=lambda: signal(SIGPIPE, SIG_DFL))
(out, err) = sp.communicate(data)
except OSError as e:
raise ProcessExecutionError(
if status_cb:

View File

@ -1,3 +1,67 @@
-------------------------------------------------------------------
Fri May 11 14:20:28 UTC 2018 - rjschwei@suse.com
- Update to version 18.1 (bsc#1092637, bsc#1084509)
+ Forward port cloud-init-python2-sigpipe.patch
+ Forward port cloud-init-no-python-linux-dist.patch
+ Add cloud-init-no-trace-empt-sect.patch
+ Hetzner: Exit early if dmi system-manufacturer is not Hetzner.
+ Add missing dependency on isc-dhcp-client to trunk ubuntu packaging.
+ (LP: #1759307)
+ FreeBSD: resizefs module now able to handle zfs/zpool.
+ [Dominic Schlegel] (LP: #1721243)
+ cc_puppet: Revert regression of puppet creating ssl and ssl_cert dirs
+ Enable IBMCloud datasource in settings.py.
+ IBMCloud: Initial IBM Cloud datasource.
+ tests: remove jsonschema from xenial tox environment.
+ tests: Fix newly added schema unit tests to skip if no jsonschema.
+ ec2: Adjust ec2 datasource after exception_cb change.
+ Reduce AzurePreprovisioning HTTP timeouts.
+ [Douglas Jordan] (LP: #1752977)
+ Revert the logic of exception_cb in read_url.
+ [Kurt Garloff] (LP: #1702160, #1298921)
+ ubuntu-advantage: Add new config module to support
+ ubuntu-advantage-tools
+ Handle global dns entries in netplan (LP: #1750884)
+ Identify OpenTelekomCloud Xen as OpenStack DS.
+ [Kurt Garloff] (LP: #1756471)
+ datasources: fix DataSource subclass get_hostname method signature
+ (LP: #1757176)
+ OpenNebula: Update network to return v2 config rather than ENI.
+ [Akihiko Ota]
+ Add Hetzner Cloud DataSource
+ net: recognize iscsi root cases without ip= on kernel command line.
+ (LP: #1752391)
+ tests: fix flakes warning for unused variable
+ tests: patch leaked stderr messages from snap unit tests
+ cc_snap: Add new module to install and configure snapd and snap
+ packages.
+ tests: Make pylint happy and fix python2.6 uses of assertRaisesRegex.
+ netplan: render bridge port-priority values (LP: #1735821)
+ util: Fix subp regression. Allow specifying subp command as a string.
+ (LP: #1755965)
+ doc: fix all warnings issued by 'tox -e doc'
+ FreeBSD: Set hostname to FQDN. [Dominic Schlegel] (LP: #1753499)
+ tests: fix run_tree and bddeb
+ tests: Fix some warnings in tests that popped up with newer python.
+ set_hostname: When present in metadata, set it before network bringup.
+ (LP: #1746455)
+ tests: Centralize and re-use skipTest based on json schema presense.
+ This commit fixes get_hostname on the AzureDataSource.
+ [Douglas Jordan] (LP: #1754495)
+ shellify: raise TypeError on bad input.
+ Make salt minion module work on FreeBSD.
+ [Dominic Schlegel] (LP: #1721503)
+ Simplify some comparisions. [Rémy Léone]
+ Change some list creation and population to literal. [Rémy Léone]
+ GCE: fix reading of user-data that is not base64 encoded. (LP: #1752711)
+ doc: fix chef install from apt packages example in RTD.
+ Implement puppet 4 support [Romanos Skiadas] (LP: #1446804)
+ subp: Fix subp usage with non-ascii characters when no system locale.
+ (LP: #1751051)
+ salt: configure grains in grains file rather than in minion config.
[Daniel Wallace]
-------------------------------------------------------------------
Wed Mar 21 22:27:40 UTC 2018 - rjschwei@suse.com

View File

@ -18,7 +18,7 @@
%global configver 0.7
Name: cloud-init
Version: 18.1
Version: 18.2
Release: 0
License: GPL-3.0 and AGPL-3.0
Summary: Cloud node initialization tool
@ -51,6 +51,10 @@ Patch40: 0001-switch-to-using-iproute2-tools.patch
Patch41: cloud-init-no-python-linux-dist.patch
# Disable OVF tests
Patch42: cloud-init-skip-ovf-tests.patch
# FIXME no traceback for empt stage
# #lp1770462
# https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/345377
Patch43: cloud-init-no-trace-empt-sect.patch
BuildRequires: fdupes
BuildRequires: filesystem
# pkg-config is needed to find correct systemd unit dir
@ -185,7 +189,9 @@ Documentation and examples for cloud-init tools
%patch8
%patch10 -p1
%patch12
%if 0%{?suse_version} < 1315
%patch20
%endif
%patch27
%patch29 -p0
%patch34
@ -194,6 +200,7 @@ Documentation and examples for cloud-init tools
%patch40 -p1
%patch41
%patch42
%patch43
%build
%if 0%{?suse_version} && 0%{?suse_version} <= 1315