Don't use mistral directory as WORK_DIR for config-download
As part of mistral removal all config-downloaded playbooks are run from tripleoclient. This changes the download location to $HOME/config-download. Documentation for default location will be changed along with all doc changes for mistral removal. Closes-Bug: #1874432 Depends-On: https://review.opendev.org/721568/ Change-Id: Ib4c9c47baabd64f008c4f61e4fa8c37a311350a3
This commit is contained in:
parent
7cef22cc68
commit
191438f743
@ -89,10 +89,11 @@ DEFAULT_VALIDATIONS_BASEDIR = '/usr/share/openstack-tripleo-validations'
|
||||
|
||||
VALIDATIONS_LOG_BASEDIR = '/var/log/validations'
|
||||
|
||||
DEFAULT_WORK_DIR = '/var/lib/mistral'
|
||||
DEFAULT_WORK_DIR = os.path.join(os.environ.get('HOME', '~/'),
|
||||
'config-download')
|
||||
|
||||
ANSIBLE_INVENTORY = \
|
||||
'/var/lib/mistral/overcloud/tripleo-ansible-inventory.yaml'
|
||||
ANSIBLE_INVENTORY = os.path.join(DEFAULT_WORK_DIR,
|
||||
'overcloud/tripleo-ansible-inventory.yaml')
|
||||
|
||||
ANSIBLE_VALIDATION_DIR = \
|
||||
'/usr/share/openstack-tripleo-validations/playbooks'
|
||||
|
@ -53,7 +53,7 @@ def export_passwords(swift, stack, excludes=True):
|
||||
|
||||
|
||||
def export_stack(heat, stack, should_filter=False,
|
||||
config_download_dir='/var/lib/mistral/overcloud'):
|
||||
config_download_dir=constants.DEFAULT_WORK_DIR):
|
||||
|
||||
# data to export
|
||||
# parameter: Parameter to be exported
|
||||
@ -90,6 +90,7 @@ def export_stack(heat, stack, should_filter=False,
|
||||
if "file" in export_param:
|
||||
# get file data
|
||||
file = os.path.join(config_download_dir,
|
||||
stack,
|
||||
export_param["file"])
|
||||
with open(file, 'r') as ff:
|
||||
try:
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
import os
|
||||
|
||||
from io import StringIO
|
||||
import mock
|
||||
@ -57,7 +57,10 @@ class TestExport(TestCase):
|
||||
|
||||
self.assertEqual(expected, data)
|
||||
self.mock_open.assert_called_once_with(
|
||||
'/var/lib/mistral/overcloud/group_vars/overcloud.json', 'r')
|
||||
os.path.join(
|
||||
os.environ.get('HOME'),
|
||||
'config-download/overcloud/group_vars/overcloud.json'),
|
||||
'r')
|
||||
|
||||
@mock.patch('tripleoclient.utils.get_stack')
|
||||
def test_export_stack_should_filter(self, mock_get_stack):
|
||||
@ -76,7 +79,10 @@ class TestExport(TestCase):
|
||||
|
||||
self.assertEqual(expected, data)
|
||||
self.mock_open.assert_called_once_with(
|
||||
'/var/lib/mistral/overcloud/group_vars/overcloud.json', 'r')
|
||||
os.path.join(
|
||||
os.environ.get('HOME'),
|
||||
'config-download/overcloud/group_vars/overcloud.json'),
|
||||
'r')
|
||||
|
||||
@mock.patch('tripleoclient.utils.get_stack')
|
||||
def test_export_stack_cd_dir(self, mock_get_stack):
|
||||
@ -84,7 +90,7 @@ class TestExport(TestCase):
|
||||
mock_get_stack.return_value = self.mock_stack
|
||||
with mock.patch('six.moves.builtins.open', self.mock_open):
|
||||
export.export_stack(heat, "overcloud",
|
||||
config_download_dir='/foo/overcloud')
|
||||
config_download_dir='/foo')
|
||||
self.mock_open.assert_called_once_with(
|
||||
'/foo/overcloud/group_vars/overcloud.json', 'r')
|
||||
|
||||
|
@ -1624,7 +1624,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
playbook = '/var/lib/mistral/overcloud/deploy_steps_playbook.yaml'
|
||||
playbook = os.path.join(os.environ.get(
|
||||
'HOME'), 'config-download/overcloud/deploy_steps_playbook.yaml')
|
||||
self.assertIn(
|
||||
[mock.call(
|
||||
ansible_cfg=None, ansible_timeout=42,
|
||||
|
@ -233,7 +233,8 @@ class TestDeleteNode(fakes.TestDeleteNode):
|
||||
playbook_dir='/usr/share/ansible/tripleo-playbooks',
|
||||
verbosity=mock.ANY,
|
||||
extra_vars={
|
||||
'access_path': '/var/lib/mistral',
|
||||
'access_path': os.path.join(os.environ.get('HOME'),
|
||||
'config-download'),
|
||||
'execution_user': mock.ANY},
|
||||
),
|
||||
mock.call(
|
||||
|
@ -11,6 +11,7 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import os
|
||||
|
||||
import mock
|
||||
|
||||
@ -37,7 +38,8 @@ class TestOvercloudExport(utils.TestCommand):
|
||||
@mock.patch('tripleoclient.export.export_passwords')
|
||||
def test_export(self, mock_export_passwords,
|
||||
mock_export_stack,
|
||||
mock_safe_dump, mock_exists):
|
||||
mock_safe_dump,
|
||||
mock_exists):
|
||||
argslist = []
|
||||
verifylist = []
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
@ -49,11 +51,13 @@ class TestOvercloudExport(utils.TestCommand):
|
||||
mock_export_passwords.assert_called_once_with(
|
||||
self.app.client_manager.tripleoclient.object_store,
|
||||
'overcloud', True)
|
||||
path = os.path.join(os.environ.get('HOME'),
|
||||
'config-download/overcloud')
|
||||
mock_export_stack.assert_called_once_with(
|
||||
self.app.client_manager.orchestration,
|
||||
'overcloud',
|
||||
False,
|
||||
'/var/lib/mistral/overcloud')
|
||||
path)
|
||||
self.assertEqual(
|
||||
{'parameter_defaults': {'key': 'value',
|
||||
'key0': 'value0'}},
|
||||
@ -65,7 +69,8 @@ class TestOvercloudExport(utils.TestCommand):
|
||||
@mock.patch('tripleoclient.export.export_passwords')
|
||||
def test_export_stack_name(self, mock_export_passwords,
|
||||
mock_export_stack,
|
||||
mock_safe_dump, mock_exists):
|
||||
mock_safe_dump,
|
||||
mock_exists):
|
||||
argslist = ['--stack', 'foo']
|
||||
verifylist = [('stack', 'foo')]
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
@ -75,11 +80,13 @@ class TestOvercloudExport(utils.TestCommand):
|
||||
mock_export_passwords.assert_called_once_with(
|
||||
self.app.client_manager.tripleoclient.object_store,
|
||||
'foo', True)
|
||||
path = os.path.join(os.environ.get('HOME'),
|
||||
'config-download/foo')
|
||||
mock_export_stack.assert_called_once_with(
|
||||
self.app.client_manager.orchestration,
|
||||
'foo',
|
||||
False,
|
||||
'/var/lib/mistral/foo')
|
||||
path)
|
||||
|
||||
@mock.patch('os.path.exists')
|
||||
@mock.patch('yaml.safe_dump')
|
||||
|
@ -923,10 +923,8 @@ class DeployOvercloud(command.Command):
|
||||
action='store',
|
||||
default=None,
|
||||
help=_('Directory to use for saved output when using '
|
||||
'--config-download. The directory must be '
|
||||
'writeable by the mistral user. When not '
|
||||
'specified, the default server side value '
|
||||
'will be used (/var/lib/mistral/<execution id>.')
|
||||
'--config-download. When not '
|
||||
'specified, $HOME/config-download will be used.')
|
||||
)
|
||||
parser.add_argument(
|
||||
'--override-ansible-cfg',
|
||||
|
@ -51,7 +51,7 @@ class ExportOvercloud(command.Command):
|
||||
action='store',
|
||||
help=_('Directory to search for config-download '
|
||||
'export data. Defaults to '
|
||||
'/var/lib/mistral/<stack>'))
|
||||
'$HOME/config-download/<stack>'))
|
||||
parser.add_argument('--no-password-excludes',
|
||||
action='store_true',
|
||||
dest='no_password_excludes',
|
||||
@ -78,7 +78,8 @@ class ExportOvercloud(command.Command):
|
||||
"File '%s' already exists, not exporting." % output_file)
|
||||
|
||||
if not parsed_args.config_download_dir:
|
||||
config_download_dir = os.path.join('/var/lib/mistral',
|
||||
config_download_dir = os.path.join(os.environ.get('HOME'),
|
||||
'config-download',
|
||||
parsed_args.stack)
|
||||
else:
|
||||
config_download_dir = parsed_args.config_download_dir
|
||||
|
Loading…
Reference in New Issue
Block a user