From ed945a9080556a20067be2a93831ff1f34b9ae9c Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 11 Nov 2015 17:52:13 -0500 Subject: [PATCH] Generate a unique DeployIdentifier on updates This patch updates 'overcloud deploy' commands so that updates (re-running deploy on an existing stack) generate a unique DeployIdentifier parameter. By passing an unique DeployIdentifier parameter into the overcloud stack we force all puppet config tasks (which are idempotent and safe to exec multiple times) again. We've had several issues with puppet not-rerunning on a variety of config related changes and additionally recieved user feedback that not re-running all puppet deployments on an update is confusing. Change-Id: Ia659181872a6537cc169f1d1531ebf5d36160183 Closes-bug: #1505430 Depends-On: Ic352ddd30807dc378e5e7b6c396bc53f5d6d5622 --- .../tests/v1/overcloud_deploy/test_overcloud_deploy.py | 10 ++++++++-- tripleoclient/v1/overcloud_deploy.py | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py index 4a364ec2f..1eab9ad7a 100644 --- a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py +++ b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py @@ -80,7 +80,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): @mock.patch('tripleoclient.utils.create_cephx_key', autospec=True) @mock.patch('uuid.uuid1', autospec=True) - def test_tht_scale(self, mock_uuid1, mock_create_cephx_key, + @mock.patch('time.time', autospec=True) + def test_tht_scale(self, mock_time, mock_uuid1, mock_create_cephx_key, mock_check_hypervisor_stats, mock_get_key, mock_create_env, generate_certs_mock, mock_get_templte_contents, mock_process_multiple_env, @@ -101,6 +102,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_create_cephx_key.return_value = "cephx_key" mock_uuid1.return_value = "uuid" + mock_time.return_value = 123456789 mock_generate_overcloud_passwords.return_value = self._get_passwords() @@ -167,6 +169,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): 'SwiftHashSuffix': 'password', 'SwiftPassword': 'password', 'SwiftStorageImage': 'overcloud-full', + 'DeployIdentifier': 123456789, } def _custom_create_params_env(parameters): @@ -230,7 +233,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): @mock.patch('tripleoclient.utils.create_cephx_key', autospec=True) @mock.patch('uuid.uuid1', autospec=True) - def test_tht_deploy(self, mock_uuid1, mock_create_cephx_key, + @mock.patch('time.time', autospec=True) + def test_tht_deploy(self, mock_time, mock_uuid1, mock_create_cephx_key, mock_check_hypervisor_stats, mock_get_key, mock_create_env, generate_certs_mock, mock_get_templte_contents, mock_process_multiple_env, @@ -251,6 +255,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_create_cephx_key.return_value = "cephx_key" mock_uuid1.return_value = "uuid" + mock_time.return_value = 123456789 mock_generate_overcloud_passwords.return_value = self._get_passwords() @@ -332,6 +337,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): 'SwiftHashSuffix': 'password', 'SwiftPassword': 'password', 'SwiftStorageImage': 'overcloud-full', + 'DeployIdentifier': 123456789, } def _custom_create_params_env(parameters): diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index 2f35a3bb5..244bc31a0 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -23,6 +23,7 @@ import re import six import sys import tempfile +import time import uuid from cliff import command @@ -91,6 +92,8 @@ class DeployOvercloud(command.Command): self.log.debug("Getting ctlplane from Neutron") net = network_client.api.find_attr('networks', 'ctlplane') parameters['NeutronControlPlaneID'] = net['id'] + timestamp = int(time.time()) + parameters['DeployIdentifier'] = timestamp param_args = ( ('NeutronPublicInterface', 'neutron_public_interface'),