Revert "Remove the overcloudrc.v3 file"

This reverts commit 977bc6f1b8.

The original change is backwards incompatible since it removes the
overcloudrc v3 file without any deprecation.

Related-Bug: #1733640
Change-Id: I6b62e014312f7502a693f2990556d58696b1df11
This commit is contained in:
Dougal Matthews 2018-01-29 14:46:23 +00:00
parent 977bc6f1b8
commit 8a6e018782
5 changed files with 21 additions and 13 deletions

View File

@ -1,8 +0,0 @@
---
deprecations:
- |
List deprecations notes here, or remove this section. All of the list
items in this section are combined when the release notes are rendered, so
the text needs to be worded so that it does not depend on any information
only available in another section, such as the prelude. This may mean
repeating some details.

View File

@ -31,6 +31,7 @@ class TestOvercloudCredentials(test_plugin.TestPluginV1):
output=json.dumps({
"result": {
"overcloudrc": "OVERCLOUDRC CONTENTS",
"overcloudrc.v3": "OVERCLOUDRC.v3 CONTENTS",
}
})
)
@ -48,8 +49,10 @@ class TestOvercloudCredentials(test_plugin.TestPluginV1):
self.cmd.take_action(parsed_args)
self.assertIn(mock.call('./overcloudrc', 'w'), m.call_args_list)
self.assertIn(mock.call('./overcloudrc.v3', 'w'), m.call_args_list)
mock_chmod.assert_has_calls([
mock.call('./overcloudrc', 384)])
mock.call('./overcloudrc', 384),
mock.call('./overcloudrc.v3', 384)])
self.workflow.action_executions.create.assert_called_once_with(
'tripleo.deployment.overcloudrc', {'container': 'overcloud'},
@ -72,10 +75,13 @@ class TestOvercloudCredentials(test_plugin.TestPluginV1):
self.cmd.take_action(parsed_args)
path = "{}/overcloudrc".format(temp)
pathv3 = "{}/overcloudrc.v3".format(temp)
self.assertIn(mock.call(path, 'w'), m.call_args_list)
self.assertIn(mock.call(pathv3, 'w'), m.call_args_list)
mock_chmod.assert_has_calls([
mock.call(path, 384)])
mock.call(path, 384),
mock.call(pathv3, 384)])
self.workflow.action_executions.create.assert_called_once_with(
'tripleo.deployment.overcloudrc', {'container': 'overcloud'},

View File

@ -212,19 +212,25 @@ class TestCreateOvercloudRC(TestCase):
tempdir = tempfile.mkdtemp()
rcfile = os.path.join(tempdir, 'teststackrc')
rcfile_v3 = os.path.join(tempdir, 'teststackrc.v3')
overcloudrcs = {
"overcloudrc": "overcloudrc v3 is the only version",
"overcloudrc": "overcloudrc not v3",
"overcloudrc.v3": "overcloudrc.v3",
}
try:
utils.write_overcloudrc(stack_name, overcloudrcs,
config_directory=tempdir)
rc = open(rcfile, 'rt').read()
self.assertIn('overcloudrc v3', rc)
self.assertIn('overcloudrc not v3', rc)
rc_v3 = open(rcfile_v3, 'rt').read()
self.assertIn('overcloudrc.v3', rc_v3)
finally:
if os.path.exists(rcfile):
os.unlink(rcfile)
if os.path.exists(rcfile_v3):
os.unlink(rcfile_v3)
os.rmdir(tempdir)

View File

@ -53,11 +53,15 @@ def write_overcloudrc(stack_name, overcloudrcs, config_directory='.'):
"""Write the overcloudrc files"""
rcpath = os.path.join(config_directory, '%src' % stack_name)
rcv3path = os.path.join(config_directory, '%src.v3' % stack_name)
with open(rcpath, 'w') as rcfile:
rcfile.write(overcloudrcs['overcloudrc'])
os.chmod(rcpath, 0o600)
with open(rcv3path, 'w') as rcv3file:
rcv3file.write(overcloudrcs['overcloudrc.v3'])
os.chmod(rcv3path, 0o600)
return os.path.abspath(rcpath)

View File

@ -18,7 +18,7 @@ from tripleoclient.workflows import deployment
class OvercloudCredentials(command.Command):
"""Create the overcloudrc file"""
"""Create the overcloudrc and overcloudrc.v3 files"""
log = logging.getLogger(__name__ + ".OvercloudCredentials")