diff options
35 files changed, 77 insertions, 61 deletions
@@ -11,6 +11,8 @@ cheetah. This helps in python3 effort. (LP: #1219223) - change install path for systemd files to /lib/systemd/system [Dimitri John Ledkov] + - change trunk debian packaging to use pybuild and drop cdbs. + [Dimitri John Ledkov] 0.7.5: - open 0.7.5 - Add a debug log message around import failures diff --git a/cloudinit/netinfo.py b/cloudinit/netinfo.py index 30b6f3b3..1bdca9f7 100644 --- a/cloudinit/netinfo.py +++ b/cloudinit/netinfo.py @@ -56,8 +56,8 @@ def netdev_info(empty=""): # newer (freebsd and fedora) show 'inet xx.yy' # just skip this 'inet' entry. (LP: #1285185) try: - if (toks[i] in ("inet", "inet6") and - toks[i + 1].startswith("addr:")): + if ((toks[i] in ("inet", "inet6") and + toks[i + 1].startswith("addr:"))): continue except IndexError: pass diff --git a/packages/bddeb b/packages/bddeb index a1498d94..9d264f92 100755 --- a/packages/bddeb +++ b/packages/bddeb @@ -76,7 +76,7 @@ def write_debian_folder(root, version, revno, append_requires=[]): params={'requires': requires}) # Just copy the following directly - for base_fn in ['dirs', 'copyright', 'compat', 'pycompat', 'rules']: + for base_fn in ['dirs', 'copyright', 'compat', 'rules']: shutil.copy(util.abs_join(find_root(), 'packages', 'debian', base_fn), util.abs_join(deb_dir, base_fn)) @@ -99,7 +99,8 @@ def main(): parser.add_argument("--init-system", dest="init_system", help=("build deb with INIT_SYSTEM=xxx" " (default: %(default)s"), - default=os.environ.get("INIT_SYSTEM", "upstart")) + default=os.environ.get("INIT_SYSTEM", + "upstart,systemd")) for ent in DEBUILD_ARGS: diff --git a/packages/debian/compat b/packages/debian/compat index 7ed6ff82..ec635144 100644 --- a/packages/debian/compat +++ b/packages/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/packages/debian/control.in b/packages/debian/control.in index 7e42b94b..18a4600c 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -1,10 +1,11 @@ ## This is a cheetah template Source: cloud-init Section: admin -Priority: extra +Priority: optional Maintainer: Scott Moser <smoser@ubuntu.com> -Build-Depends: cdbs, - debhelper (>= 5.0.38), +Build-Depends: debhelper (>= 9), + dh-python, + dh-systemd, python (>= 2.6.6-3~), python-nose, pyflakes, @@ -12,7 +13,10 @@ Build-Depends: cdbs, python-setuptools, python-cheetah, python-mocker, - python-setuptools + python-httpretty, +#for $r in $requires + ${r}, +#end for XS-Python-Version: all Standards-Version: 3.9.3 diff --git a/packages/debian/pycompat b/packages/debian/pycompat deleted file mode 100644 index 0cfbf088..00000000 --- a/packages/debian/pycompat +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/packages/debian/rules b/packages/debian/rules index 7623ac9d..9e0c5ddb 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -1,18 +1,17 @@ #!/usr/bin/make -f -DEB_PYTHON2_MODULE_PACKAGES = cloud-init -INIT_SYSTEM ?= upstart +INIT_SYSTEM ?= upstart,systemd +export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM) -binary-install/cloud-init::cloud-init-fixups +%: + dh $@ --with python2,systemd --buildsystem pybuild -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/python-distutils.mk +override_dh_install: + dh_install + install -d debian/cloud-init/etc/rsyslog.d + cp tools/21-cloudinit.conf debian/cloud-init/etc/rsyslog.d/21-cloudinit.conf -DEB_PYTHON_INSTALL_ARGS_ALL += --init-system=$(INIT_SYSTEM) - -DEB_DH_INSTALL_SOURCEDIR := debian/tmp - -cloud-init-fixups: - install -d $(DEB_DESTDIR)/etc/rsyslog.d - cp tools/21-cloudinit.conf $(DEB_DESTDIR)/etc/rsyslog.d/21-cloudinit.conf - +override_dh_auto_test: + # Becuase setup tools didn't copy data... + cp -r tests/data .pybuild/pythonX.Y_2.7/build/tests + http_proxy= dh_auto_test -- --test-nose @@ -35,6 +35,7 @@ import subprocess def is_f(p): return os.path.isfile(p) + def tiny_p(cmd, capture=True): # Darn python 2.6 doesn't have check_output (argggg) stdout = subprocess.PIPE @@ -51,6 +52,7 @@ def tiny_p(cmd, capture=True): % (cmd, ret, out, err)) return (out, err) + def systemd_unitdir(): cmd = ['pkg-config', '--variable=systemdsystemunitdir', 'systemd'] try: @@ -92,26 +94,35 @@ class InitsysInstallData(install): user_options = install.user_options + [ # This will magically show up in member variable 'init_sys' ('init-system=', None, - ('init system to configure (%s) [default: None]') % + ('init system(s) to configure (%s) [default: None]') % (", ".join(INITSYS_TYPES)) ), ] def initialize_options(self): install.initialize_options(self) - self.init_system = None + self.init_system = "" def finalize_options(self): install.finalize_options(self) - if self.init_system and self.init_system not in INITSYS_TYPES: + + if self.init_system and isinstance(self.init_system, str): + self.init_system = self.init_system.split(",") + + if len(self.init_system) == 0: raise DistutilsArgError(("You must specify one of (%s) when" - " specifying a init system!") % (", ".join(INITSYS_TYPES))) - elif self.init_system: + " specifying init system(s)!") % (", ".join(INITSYS_TYPES))) + + bad = [f for f in self.init_system if f not in INITSYS_TYPES] + if len(bad) != 0: + raise DistutilsArgError( + "Invalid --init-system: %s" % (','.join(bad))) + + for sys in self.init_system: self.distribution.data_files.append( - (INITSYS_ROOTS[self.init_system], - INITSYS_FILES[self.init_system])) - # Force that command to reinitalize (with new file list) - self.distribution.reinitialize_command('install_data', True) + (INITSYS_ROOTS[sys], INITSYS_FILES[sys])) + # Force that command to reinitalize (with new file list) + self.distribution.reinitialize_command('install_data', True) setuptools.setup(name='cloud-init', diff --git a/tests/unittests/test_builtin_handlers.py b/tests/unittests/test_builtin_handlers.py index b387f13b..af7f442e 100644 --- a/tests/unittests/test_builtin_handlers.py +++ b/tests/unittests/test_builtin_handlers.py @@ -2,7 +2,7 @@ import os -from tests.unittests import helpers as test_helpers +from . import helpers as test_helpers from cloudinit import handlers from cloudinit import helpers diff --git a/tests/unittests/test_data.py b/tests/unittests/test_data.py index 68729c57..41d0dc29 100644 --- a/tests/unittests/test_data.py +++ b/tests/unittests/test_data.py @@ -20,7 +20,7 @@ from cloudinit import util INSTANCE_ID = "i-testing" -from tests.unittests import helpers +from . import helpers class FakeDataSource(sources.DataSource): diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py index ccfd672a..88c82d5e 100644 --- a/tests/unittests/test_datasource/test_azure.py +++ b/tests/unittests/test_datasource/test_azure.py @@ -1,7 +1,7 @@ from cloudinit import helpers from cloudinit.util import load_file from cloudinit.sources import DataSourceAzure -from tests.unittests.helpers import populate_dir +from ..helpers import populate_dir import base64 import crypt diff --git a/tests/unittests/test_datasource/test_cloudsigma.py b/tests/unittests/test_datasource/test_cloudsigma.py index eadb3cb7..306ac7d8 100644 --- a/tests/unittests/test_datasource/test_cloudsigma.py +++ b/tests/unittests/test_datasource/test_cloudsigma.py @@ -4,7 +4,7 @@ import copy from cloudinit.cs_utils import Cepko from cloudinit.sources import DataSourceCloudSigma -from tests.unittests import helpers as test_helpers +from .. import helpers as test_helpers SERVER_CONTEXT = { diff --git a/tests/unittests/test_datasource/test_configdrive.py b/tests/unittests/test_datasource/test_configdrive.py index 4404668e..d88066e5 100644 --- a/tests/unittests/test_datasource/test_configdrive.py +++ b/tests/unittests/test_datasource/test_configdrive.py @@ -12,7 +12,7 @@ from cloudinit.sources import DataSourceConfigDrive as ds from cloudinit.sources.helpers import openstack from cloudinit import util -from tests.unittests import helpers as unit_helpers +from .. import helpers as unit_helpers PUBKEY = u'ssh-rsa AAAAB3NzaC1....sIkJhq8wdX+4I3A4cYbYP ubuntu@server-460\n' EC2_META = { diff --git a/tests/unittests/test_datasource/test_gce.py b/tests/unittests/test_datasource/test_gce.py index 19ffb6c1..60a0ce48 100644 --- a/tests/unittests/test_datasource/test_gce.py +++ b/tests/unittests/test_datasource/test_gce.py @@ -24,7 +24,7 @@ from cloudinit import settings from cloudinit import helpers from cloudinit.sources import DataSourceGCE -from tests.unittests import helpers as test_helpers +from .. import helpers as test_helpers GCE_META = { 'instance/id': '123', diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py index 73cfadcb..c157beb8 100644 --- a/tests/unittests/test_datasource/test_maas.py +++ b/tests/unittests/test_datasource/test_maas.py @@ -3,7 +3,7 @@ import os from cloudinit.sources import DataSourceMAAS from cloudinit import url_helper -from tests.unittests.helpers import populate_dir +from ..helpers import populate_dir import mocker diff --git a/tests/unittests/test_datasource/test_nocloud.py b/tests/unittests/test_datasource/test_nocloud.py index a65833eb..14274562 100644 --- a/tests/unittests/test_datasource/test_nocloud.py +++ b/tests/unittests/test_datasource/test_nocloud.py @@ -1,7 +1,7 @@ from cloudinit import helpers from cloudinit.sources import DataSourceNoCloud from cloudinit import util -from tests.unittests.helpers import populate_dir +from ..helpers import populate_dir from mocker import MockerTestCase import os diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py index ec6b752b..b4fd1f4d 100644 --- a/tests/unittests/test_datasource/test_opennebula.py +++ b/tests/unittests/test_datasource/test_opennebula.py @@ -2,7 +2,7 @@ from cloudinit import helpers from cloudinit.sources import DataSourceOpenNebula as ds from cloudinit import util from mocker import MockerTestCase -from tests.unittests.helpers import populate_dir +from ..helpers import populate_dir from base64 import b64encode import os diff --git a/tests/unittests/test_datasource/test_openstack.py b/tests/unittests/test_datasource/test_openstack.py index d29e5363..c088bb55 100644 --- a/tests/unittests/test_datasource/test_openstack.py +++ b/tests/unittests/test_datasource/test_openstack.py @@ -24,7 +24,7 @@ from StringIO import StringIO from urlparse import urlparse -from tests.unittests import helpers as test_helpers +from .. import helpers as test_helpers from cloudinit import helpers from cloudinit import settings diff --git a/tests/unittests/test_datasource/test_smartos.py b/tests/unittests/test_datasource/test_smartos.py index f64aea07..b197b600 100644 --- a/tests/unittests/test_datasource/test_smartos.py +++ b/tests/unittests/test_datasource/test_smartos.py @@ -25,7 +25,7 @@ import base64 from cloudinit import helpers as c_helpers from cloudinit.sources import DataSourceSmartOS -from tests.unittests import helpers +from .. import helpers import os import os.path import re diff --git a/tests/unittests/test_distros/test_generic.py b/tests/unittests/test_distros/test_generic.py index 7befb8c8..c24c790e 100644 --- a/tests/unittests/test_distros/test_generic.py +++ b/tests/unittests/test_distros/test_generic.py @@ -1,7 +1,7 @@ from cloudinit import distros from cloudinit import util -from tests.unittests import helpers +from .. import helpers import os diff --git a/tests/unittests/test_ec2_util.py b/tests/unittests/test_ec2_util.py index aaec2694..700254a3 100644 --- a/tests/unittests/test_ec2_util.py +++ b/tests/unittests/test_ec2_util.py @@ -1,4 +1,4 @@ -from tests.unittests import helpers +from . import helpers from cloudinit import ec2_utils as eu from cloudinit import url_helper as uh diff --git a/tests/unittests/test_filters/test_launch_index.py b/tests/unittests/test_filters/test_launch_index.py index 773bb312..2f4c2fda 100644 --- a/tests/unittests/test_filters/test_launch_index.py +++ b/tests/unittests/test_filters/test_launch_index.py @@ -1,6 +1,6 @@ import copy -from tests.unittests import helpers +from .. import helpers import itertools diff --git a/tests/unittests/test_handler/test_handler_growpart.py b/tests/unittests/test_handler/test_handler_growpart.py index f2ed4597..f6dc4521 100644 --- a/tests/unittests/test_handler/test_handler_growpart.py +++ b/tests/unittests/test_handler/test_handler_growpart.py @@ -188,8 +188,8 @@ class TestResize(MockerTestCase): self.assertEqual(cc_growpart.RESIZE.SKIPPED, find(enoent[0], resized)[1]) #self.assertEqual(resize_calls, - #[("/dev/XXda", "1", "/dev/XXda1"), - #("/dev/YYda", "2", "/dev/YYda2")]) + # [("/dev/XXda", "1", "/dev/XXda1"), + # ("/dev/YYda", "2", "/dev/YYda2")]) finally: cc_growpart.device_part_info = opinfo os.stat = real_stat diff --git a/tests/unittests/test_handler/test_handler_locale.py b/tests/unittests/test_handler/test_handler_locale.py index 72ad00fd..eb251636 100644 --- a/tests/unittests/test_handler/test_handler_locale.py +++ b/tests/unittests/test_handler/test_handler_locale.py @@ -25,7 +25,7 @@ from cloudinit import util from cloudinit.sources import DataSourceNoCloud -from tests.unittests import helpers as t_help +from .. import helpers as t_help from configobj import ConfigObj diff --git a/tests/unittests/test_handler/test_handler_power_state.py b/tests/unittests/test_handler/test_handler_power_state.py index f6e37fa5..4b7b2112 100644 --- a/tests/unittests/test_handler/test_handler_power_state.py +++ b/tests/unittests/test_handler/test_handler_power_state.py @@ -1,6 +1,6 @@ from cloudinit.config import cc_power_state_change as psc -from tests.unittests import helpers as t_help +from .. import helpers as t_help class TestLoadPowerState(t_help.TestCase): diff --git a/tests/unittests/test_handler/test_handler_seed_random.py b/tests/unittests/test_handler/test_handler_seed_random.py index be2fa4a4..40481f16 100644 --- a/tests/unittests/test_handler/test_handler_seed_random.py +++ b/tests/unittests/test_handler/test_handler_seed_random.py @@ -1,4 +1,4 @@ - # Copyright (C) 2013 Hewlett-Packard Development Company, L.P. +# Copyright (C) 2013 Hewlett-Packard Development Company, L.P. # # Author: Juerg Haefliger <juerg.haefliger@hp.com> # @@ -31,7 +31,7 @@ from cloudinit import util from cloudinit.sources import DataSourceNone -from tests.unittests import helpers as t_help +from .. import helpers as t_help import logging diff --git a/tests/unittests/test_handler/test_handler_set_hostname.py b/tests/unittests/test_handler/test_handler_set_hostname.py index 6344ec0c..03004ab9 100644 --- a/tests/unittests/test_handler/test_handler_set_hostname.py +++ b/tests/unittests/test_handler/test_handler_set_hostname.py @@ -5,7 +5,7 @@ from cloudinit import distros from cloudinit import helpers from cloudinit import util -from tests.unittests import helpers as t_help +from .. import helpers as t_help import logging diff --git a/tests/unittests/test_handler/test_handler_timezone.py b/tests/unittests/test_handler/test_handler_timezone.py index 40b69773..874db340 100644 --- a/tests/unittests/test_handler/test_handler_timezone.py +++ b/tests/unittests/test_handler/test_handler_timezone.py @@ -25,7 +25,7 @@ from cloudinit import util from cloudinit.sources import DataSourceNoCloud -from tests.unittests import helpers as t_help +from .. import helpers as t_help from configobj import ConfigObj diff --git a/tests/unittests/test_handler/test_handler_yum_add_repo.py b/tests/unittests/test_handler/test_handler_yum_add_repo.py index 7c6f7c40..156441c7 100644 --- a/tests/unittests/test_handler/test_handler_yum_add_repo.py +++ b/tests/unittests/test_handler/test_handler_yum_add_repo.py @@ -2,7 +2,7 @@ from cloudinit import util from cloudinit.config import cc_yum_add_repo -from tests.unittests import helpers +from .. import helpers import logging diff --git a/tests/unittests/test_merging.py b/tests/unittests/test_merging.py index 486b9158..17704f8e 100644 --- a/tests/unittests/test_merging.py +++ b/tests/unittests/test_merging.py @@ -1,4 +1,4 @@ -from tests.unittests import helpers +from . import helpers from cloudinit.handlers import cloud_config from cloudinit.handlers import (CONTENT_START, CONTENT_END) diff --git a/tests/unittests/test_pathprefix2dict.py b/tests/unittests/test_pathprefix2dict.py index c68c263c..590c4b82 100644 --- a/tests/unittests/test_pathprefix2dict.py +++ b/tests/unittests/test_pathprefix2dict.py @@ -1,7 +1,7 @@ from cloudinit import util from mocker import MockerTestCase -from tests.unittests.helpers import populate_dir +from .helpers import populate_dir class TestPathPrefix2Dict(MockerTestCase): diff --git a/tests/unittests/test_runs/test_merge_run.py b/tests/unittests/test_runs/test_merge_run.py index 5ffe95a2..32b41925 100644 --- a/tests/unittests/test_runs/test_merge_run.py +++ b/tests/unittests/test_runs/test_merge_run.py @@ -1,6 +1,6 @@ import os -from tests.unittests import helpers +from .. import helpers from cloudinit.settings import (PER_INSTANCE) from cloudinit import stages diff --git a/tests/unittests/test_runs/test_simple_run.py b/tests/unittests/test_runs/test_simple_run.py index 9a7178d1..c9ba949e 100644 --- a/tests/unittests/test_runs/test_simple_run.py +++ b/tests/unittests/test_runs/test_simple_run.py @@ -1,6 +1,6 @@ import os -from tests.unittests import helpers +from .. import helpers from cloudinit.settings import (PER_INSTANCE) from cloudinit import stages diff --git a/tests/unittests/test_templating.py b/tests/unittests/test_templating.py index 1ec3004b..87681f0f 100644 --- a/tests/unittests/test_templating.py +++ b/tests/unittests/test_templating.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from tests.unittests import helpers as test_helpers +from . import helpers as test_helpers import textwrap from cloudinit import templater diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 38ab0c96..335ab730 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -5,7 +5,7 @@ import stat import yaml from mocker import MockerTestCase -from tests.unittests import helpers +from . import helpers from unittest import TestCase from cloudinit import importer |