From 1153c6d602e80e1b72983a8e53f6776933b6cea8 Mon Sep 17 00:00:00 2001 From: David Ames Date: Tue, 7 Mar 2017 11:28:59 -0800 Subject: [PATCH] Enable Ocata Amulet Tests - Add Zesty as a supported series to metadata.yaml. - Turn on Xenial-Ocata Amulet test definitions. - Sync charm helpers to get Juju 2.x amulet compatibility. - Keeping Zesty-Ocata Amulet test definitions turned off until the metadata.yaml changes propagate to the charm store. - Resync tox.ini to resolve amulet test failures. Change-Id: Ib07bdddd6e79f73785105ba4844c7aca654231b0 --- hooks/charmhelpers/contrib/charmsupport/nrpe.py | 7 +++++-- hooks/charmhelpers/core/host.py | 2 ++ metadata.yaml | 1 + tests/basic_deployment.py | 5 +---- tests/charmhelpers/core/host.py | 2 ++ tox.ini | 7 ++++++- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/hooks/charmhelpers/contrib/charmsupport/nrpe.py b/hooks/charmhelpers/contrib/charmsupport/nrpe.py index e095d41e..9646b838 100644 --- a/hooks/charmhelpers/contrib/charmsupport/nrpe.py +++ b/hooks/charmhelpers/contrib/charmsupport/nrpe.py @@ -227,6 +227,7 @@ class NRPE(object): nagios_logdir = '/var/log/nagios' nagios_exportdir = '/var/lib/nagios/export' nrpe_confdir = '/etc/nagios/nrpe.d' + homedir = '/var/lib/nagios' # home dir provided by nagios-nrpe-server def __init__(self, hostname=None, primary=True): super(NRPE, self).__init__() @@ -369,7 +370,7 @@ def add_init_service_checks(nrpe, services, unit_name, immediate_check=True): ) elif os.path.exists(sysv_init): cronpath = '/etc/cron.d/nagios-service-check-%s' % svc - checkpath = '/var/lib/nagios/service-check-%s.txt' % svc + checkpath = '%s/service-check-%s.txt' % (nrpe.homedir, svc) croncmd = ( '/usr/local/lib/nagios/plugins/check_exit_status.pl ' '-s /etc/init.d/%s status' % svc @@ -383,7 +384,9 @@ def add_init_service_checks(nrpe, services, unit_name, immediate_check=True): description='service check {%s}' % unit_name, check_cmd='check_status_file.py -f %s' % checkpath, ) - if immediate_check: + # if /var/lib/nagios doesn't exist open(checkpath, 'w') will fail + # (LP: #1670223). + if immediate_check and os.path.isdir(nrpe.homedir): f = open(checkpath, 'w') subprocess.call( croncmd.split(), diff --git a/hooks/charmhelpers/core/host.py b/hooks/charmhelpers/core/host.py index edbb72ff..05edfa50 100644 --- a/hooks/charmhelpers/core/host.py +++ b/hooks/charmhelpers/core/host.py @@ -306,6 +306,8 @@ SYSTEMD_SYSTEM = '/run/systemd/system' def init_is_systemd(): """Return True if the host system uses systemd, False otherwise.""" + if lsb_release()['DISTRIB_CODENAME'] == 'trusty': + return False return os.path.isdir(SYSTEMD_SYSTEM) diff --git a/metadata.yaml b/metadata.yaml index b165e318..bac50fff 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -12,6 +12,7 @@ tags: - openstack series: - xenial + - zesty - trusty - yakkety provides: diff --git a/tests/basic_deployment.py b/tests/basic_deployment.py index 4d6f0883..430ea65f 100644 --- a/tests/basic_deployment.py +++ b/tests/basic_deployment.py @@ -81,7 +81,7 @@ class NovaBasicDeployment(OpenStackAmuletDeployment): {'name': 'nova-cloud-controller'}, {'name': 'keystone'}, {'name': 'glance'}, - {'name': 'percona-cluster', 'constraints': {'mem': '3072M'}}, + {'name': 'percona-cluster'}, ] if self._get_openstack_release() >= self.xenial_ocata: other_ocata_services = [ @@ -179,10 +179,7 @@ class NovaBasicDeployment(OpenStackAmuletDeployment): 'admin-token': 'ubuntutesting', } pxc_config = { - 'dataset-size': '25%', 'max-connections': 1000, - 'root-password': 'ChangeMe123', - 'sst-password': 'ChangeMe123', } configs = { diff --git a/tests/charmhelpers/core/host.py b/tests/charmhelpers/core/host.py index edbb72ff..05edfa50 100644 --- a/tests/charmhelpers/core/host.py +++ b/tests/charmhelpers/core/host.py @@ -306,6 +306,8 @@ SYSTEMD_SYSTEM = '/run/systemd/system' def init_is_systemd(): """Return True if the host system uses systemd, False otherwise.""" + if lsb_release()['DISTRIB_CODENAME'] == 'trusty': + return False return os.path.isdir(SYSTEMD_SYSTEM) diff --git a/tox.ini b/tox.ini index d8d8d038..6f1aeace 100644 --- a/tox.ini +++ b/tox.ini @@ -14,13 +14,18 @@ install_command = pip install --allow-unverified python-apt {opts} {packages} commands = ostestr {posargs} whitelist_externals = juju -passenv = HOME TERM AMULET_* +passenv = HOME TERM AMULET_* CS_API_URL [testenv:py27] basepython = python2.7 deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt +[testenv:py35] +basepython = python3.5 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + [testenv:pep8] basepython = python2.7 deps = -r{toxinidir}/requirements.txt