Fix using old Swift rings when creating a new stack
The container to store Swift rings is not deleted when the stack is deleted. This results in re-deploying old rings when deploying a new stack. This patch creates a copy of the old rings with a timestamp suffix and removes the original object. Doing this will create new rings when creating a new stack. Closes-Bug: 1671783 Change-Id: Ie6363987ada9b516064c1ed3b215f809c3924393
This commit is contained in:
parent
d17a9af29c
commit
f82064e95a
@ -20,6 +20,7 @@ from heatclient.common import deployment_utils
|
||||
from heatclient import exc as heat_exc
|
||||
from mistral.workflow import utils as mistral_workflow_utils
|
||||
from mistralclient.api import base as mistralclient_exc
|
||||
from swiftclient import exceptions as swiftexceptions
|
||||
|
||||
from tripleo_common.actions import base
|
||||
from tripleo_common.actions import templates
|
||||
@ -172,6 +173,16 @@ class DeployStackAction(templates.ProcessTemplatesAction):
|
||||
stack_args['timeout_mins'] = self.timeout_mins
|
||||
|
||||
if stack_is_new:
|
||||
swift_client = self.get_object_client()
|
||||
try:
|
||||
swift_client.copy_object(
|
||||
"%s-swift-rings" % self.container, "swift-rings.tar.gz",
|
||||
"%s-swift-rings/%s-%d" % (
|
||||
self.container, "swift-rings.tar.gz", time.time()))
|
||||
swift_client.delete_object(
|
||||
"%s-swift-rings" % self.container, "swift-rings.tar.gz")
|
||||
except swiftexceptions.ClientException:
|
||||
pass
|
||||
LOG.info("Perfoming Heat stack create")
|
||||
return heat.stacks.create(**stack_args)
|
||||
|
||||
|
@ -260,6 +260,11 @@ class DeployStackActionTest(base.TestCase):
|
||||
template={'heat_template_version': '2016-04-30'},
|
||||
timeout_mins=1,
|
||||
)
|
||||
swift.delete_object.assert_called_once_with(
|
||||
"overcloud-swift-rings", "swift-rings.tar.gz")
|
||||
swift.copy_object.assert_called_once_with(
|
||||
"overcloud-swift-rings", "swift-rings.tar.gz",
|
||||
"overcloud-swift-rings/swift-rings.tar.gz-%d" % 1473366264)
|
||||
|
||||
|
||||
class OvercloudRcActionTestCase(base.TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user