From 3ab2a665b5386a8ff1de7f255cfbca44e6df46ed Mon Sep 17 00:00:00 2001 From: Vladimir Kozhukalov Date: Fri, 27 Feb 2015 12:45:29 +0300 Subject: [PATCH] IBP: removed repo preconfiguration from cloud-init New deployment task flow assumes we have the deployment stage which configures repos on a node just before running puppet. So, we don't need to perform this repo pre-configuration in fuel agent any more. Change-Id: Ib3ffc2944d20470476fe800a1bf95382780a4bf9 Implements: blueprint consume-external-ubuntu --- cloud-init-templates/boothook_centos.jinja2 | 2 - .../cloud_config_centos.jinja2 | 10 ----- .../cloud_config_ubuntu.jinja2 | 7 --- fuel_agent/drivers/nailgun.py | 4 +- fuel_agent/tests/test_nailgun.py | 43 +++++++++++++++++-- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/cloud-init-templates/boothook_centos.jinja2 b/cloud-init-templates/boothook_centos.jinja2 index a5b310a..11719a0 100644 --- a/cloud-init-templates/boothook_centos.jinja2 +++ b/cloud-init-templates/boothook_centos.jinja2 @@ -102,8 +102,6 @@ cloud-init-per instance nailgun_agent /bin/sh -c 'echo "flock -w 0 -o /var/lock/ # Copying default bash settings to the root directory cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/ -cloud-init-per instance clean_repos find /etc/yum.repos.d/. -name '*.repo' -delete - # Puppet config cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml diff --git a/cloud-init-templates/cloud_config_centos.jinja2 b/cloud-init-templates/cloud_config_centos.jinja2 index 496437f..f94325b 100644 --- a/cloud-init-templates/cloud_config_centos.jinja2 +++ b/cloud-init-templates/cloud_config_centos.jinja2 @@ -51,16 +51,6 @@ write_files: - content: target path: /etc/nailgun_systemtype - -yum_repos: -{% for reponame, repourl in common.ks_repos.items() %} - {{ reponame }}: - baseurl: {{ repourl }} - enabled: true - gpgcheck: false -{% endfor %} - - mcollective: conf: main_collective: mcollective diff --git a/cloud-init-templates/cloud_config_ubuntu.jinja2 b/cloud-init-templates/cloud_config_ubuntu.jinja2 index 63ddc94..87e5216 100644 --- a/cloud-init-templates/cloud_config_ubuntu.jinja2 +++ b/cloud-init-templates/cloud_config_ubuntu.jinja2 @@ -39,13 +39,6 @@ write_files: path: /etc/nailgun-agent/config.yaml - content: target path: /etc/nailgun_systemtype - - content: APT::Get::AllowUnauthenticated 1; - path: /etc/apt/apt.conf.d/02mirantis-allow-unsigned - -apt_sources: -{% for reponame, repourl in common.ks_repos.items() %} - - source: deb {{ repourl }} -{% endfor %} mcollective: conf: diff --git a/fuel_agent/drivers/nailgun.py b/fuel_agent/drivers/nailgun.py index 54bd2fd..ef723c5 100644 --- a/fuel_agent/drivers/nailgun.py +++ b/fuel_agent/drivers/nailgun.py @@ -321,9 +321,7 @@ class Nailgun(object): admin_mask=admin_interface['netmask'], admin_iface_name=admin_interface['name'], timezone=data['ks_meta'].get('timezone', 'America/Los_Angeles'), - ks_repos=dict(map(lambda x: x.strip('"').strip("'"), - item.split('=')) for item in - data['ks_meta']['repo_metadata'].split(',')) + ks_repos=data['ks_meta']['repo_setup']['repos'] ) LOG.debug('Adding puppet parameters') diff --git a/fuel_agent/tests/test_nailgun.py b/fuel_agent/tests/test_nailgun.py index ce58444..2797024 100644 --- a/fuel_agent/tests/test_nailgun.py +++ b/fuel_agent/tests/test_nailgun.py @@ -106,7 +106,26 @@ PROVISION_SAMPLE_DATA = { "mco_auto_setup": 1, "auth_key": "fake_auth_key", "authorized_keys": ["fake_authorized_key1", "fake_authorized_key2"], - "repo_metadata": 'repo1="repo1_url",' + "repo2='repo2_url'", + "repo_setup": { + "repos": [ + { + "name": "repo1", + "type": "deb", + "uri": "uri1", + "suite": "suite", + "section": "section", + "priority": 1001 + }, + { + "name": "repo2", + "type": "deb", + "uri": "uri2", + "suite": "suite", + "section": "section", + "priority": 1001 + } + ] + }, "pm_data": { "kernel_params": "console=ttyS0,9600 console=tty0 rootdelay=90 " "nomodeset", @@ -524,8 +543,26 @@ class TestNailgun(test_base.BaseTestCase): self.assertEqual('marionette', cd_scheme.mcollective.password) self.assertEqual('rabbitmq', cd_scheme.mcollective.connector) self.assertEqual('pro_fi-le', cd_scheme.profile) - self.assertEqual({'repo1': 'repo1_url', 'repo2': 'repo2_url'}, - cd_scheme.common.ks_repos) + self.assertEqual( + [ + { + "name": "repo1", + "type": "deb", + "uri": "uri1", + "suite": "suite", + "section": "section", + "priority": 1001 + }, + { + "name": "repo2", + "type": "deb", + "uri": "uri2", + "suite": "suite", + "section": "section", + "priority": 1001 + } + ], + cd_scheme.common.ks_repos) @mock.patch.object(hu, 'list_block_devices') def test_partition_scheme(self, mock_lbd):