From 0344c32678afa9521c04520c606df20867a05a9b Mon Sep 17 00:00:00 2001 From: Artem Roma Date: Mon, 14 Dec 2015 15:04:04 +0200 Subject: [PATCH] Add processing of 'identity' parameter for mcollective config Nailgun-agent provided the parameter for the config and restarts mcollective after update. But in some cases (see description of the related bug) such behavior may cause deployment failure. So now the data is supplied by astute in provision info and is placed into config on its creation as other parameters. Change-Id: I3670e571c13808da2b54bd6238d228e7cdb0ef96 Related-Bug: #1518306 Depends-On: I753eb76ed9c3b80f249c0c4b86ef48ef49274990 --- bareon/drivers/data/nailgun.py | 3 ++- bareon/objects/configdrive.py | 4 +++- bareon/tests/fixtures/simple_nailgun_driver.json | 1 + bareon/tests/test_configdrive.py | 2 +- bareon/tests/test_nailgun.py | 1 + cloud-init-templates/cloud_config_centos.jinja2 | 1 + cloud-init-templates/cloud_config_ubuntu.jinja2 | 1 + 7 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bareon/drivers/data/nailgun.py b/bareon/drivers/data/nailgun.py index 749beda..3f5fb8b 100644 --- a/bareon/drivers/data/nailgun.py +++ b/bareon/drivers/data/nailgun.py @@ -543,7 +543,8 @@ class Nailgun(BaseDataDriver, user=data['ks_meta']['mco_user'], password=data['ks_meta']['mco_password'], connector=data['ks_meta']['mco_connector'], - enable=data['ks_meta']['mco_enable'] + enable=data['ks_meta']['mco_enable'], + identity=data['ks_meta']['mco_identity'] ) LOG.debug('Setting configdrive profile %s' % data['profile']) diff --git a/bareon/objects/configdrive.py b/bareon/objects/configdrive.py index f1e24b2..7946410 100644 --- a/bareon/objects/configdrive.py +++ b/bareon/objects/configdrive.py @@ -44,7 +44,8 @@ class ConfigDrivePuppet(object): class ConfigDriveMcollective(object): - def __init__(self, pskey, vhost, host, user, password, connector, enable): + def __init__(self, pskey, vhost, host, user, password, connector, + enable, identity): self.pskey = pskey self.vhost = vhost self.host = host @@ -52,6 +53,7 @@ class ConfigDriveMcollective(object): self.password = password self.connector = connector self.enable = enable + self.identity = identity class ConfigDriveScheme(object): diff --git a/bareon/tests/fixtures/simple_nailgun_driver.json b/bareon/tests/fixtures/simple_nailgun_driver.json index c3aeb63..78bdac3 100644 --- a/bareon/tests/fixtures/simple_nailgun_driver.json +++ b/bareon/tests/fixtures/simple_nailgun_driver.json @@ -60,6 +60,7 @@ "mco_pskey": "unset", "mco_user": "mcollective", "mco_vhost": "mcollective", + "mco_identity": -1, "pm_data": { "kernel_params": "console=ttyS0,9600 console=tty0 rootdelay=90 nomodeset", "ks_spaces": [] diff --git a/bareon/tests/test_configdrive.py b/bareon/tests/test_configdrive.py index 33929bb..e4c3596 100644 --- a/bareon/tests/test_configdrive.py +++ b/bareon/tests/test_configdrive.py @@ -63,7 +63,7 @@ class TestConfigDriveScheme(unittest2.TestCase): 'timezone', {'repo1': 'repo1_url', 'repo2': 'repo2_url'}, 'gw') cd_puppet = configdrive.ConfigDrivePuppet('master', 0) cd_mcollective = configdrive.ConfigDriveMcollective( - 'pskey', 'vhost', 'host', 'user', 'password', 'connector', 1) + 'pskey', 'vhost', 'host', 'user', 'password', 'connector', 1, -1) self.cd_scheme.common = cd_common self.cd_scheme.puppet = cd_puppet self.cd_scheme.mcollective = cd_mcollective diff --git a/bareon/tests/test_nailgun.py b/bareon/tests/test_nailgun.py index e1a807d..199a228 100644 --- a/bareon/tests/test_nailgun.py +++ b/bareon/tests/test_nailgun.py @@ -99,6 +99,7 @@ PROVISION_SAMPLE_DATA = { }, "timezone": "America/Los_Angeles", "master_ip": "10.20.0.2", + "mco_identity": -1, "mco_enable": 1, "mco_vhost": "mcollective", "mco_pskey": "unset", diff --git a/cloud-init-templates/cloud_config_centos.jinja2 b/cloud-init-templates/cloud_config_centos.jinja2 index 7169962..0e39ef9 100644 --- a/cloud-init-templates/cloud_config_centos.jinja2 +++ b/cloud-init-templates/cloud_config_centos.jinja2 @@ -67,6 +67,7 @@ mcollective: ttl: 4294957 securityprovider: psk plugin.psk: {{ mcollective.pskey }} + identity: {{ mcollective.identity }} {% if mcollective.connector == 'stomp' %} connector = stomp plugin.stomp.host: {{ mcollective.host }} diff --git a/cloud-init-templates/cloud_config_ubuntu.jinja2 b/cloud-init-templates/cloud_config_ubuntu.jinja2 index d683d14..b546290 100644 --- a/cloud-init-templates/cloud_config_ubuntu.jinja2 +++ b/cloud-init-templates/cloud_config_ubuntu.jinja2 @@ -52,6 +52,7 @@ mcollective: ttl: 4294957 securityprovider: psk plugin.psk: {{ mcollective.pskey }} + identity: {{ mcollective.identity }} {% if mcollective.connector == 'stomp' %} connector = stomp plugin.stomp.host: {{ mcollective.host }}