Add stack_name support to ANSIBLE_INVENTORY
This change updates the ANSIBLE_INVENTORY constant to support stacks with different names. Change-Id: I601ff211d53a29dbda195cb2df8708e57efbcb94 Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
parent
c28e805b63
commit
329cad5794
@ -94,7 +94,7 @@ DEFAULT_WORK_DIR = os.path.join(os.environ.get('HOME', '~/'),
|
|||||||
'config-download')
|
'config-download')
|
||||||
|
|
||||||
ANSIBLE_INVENTORY = os.path.join(DEFAULT_WORK_DIR,
|
ANSIBLE_INVENTORY = os.path.join(DEFAULT_WORK_DIR,
|
||||||
'overcloud/tripleo-ansible-inventory.yaml')
|
'{}/tripleo-ansible-inventory.yaml')
|
||||||
|
|
||||||
ANSIBLE_VALIDATION_DIR = \
|
ANSIBLE_VALIDATION_DIR = \
|
||||||
'/usr/share/openstack-tripleo-validations/playbooks'
|
'/usr/share/openstack-tripleo-validations/playbooks'
|
||||||
|
@ -14,9 +14,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import os
|
||||||
|
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
from tripleoclient import constants
|
||||||
from tripleoclient.tests import fakes
|
from tripleoclient.tests import fakes
|
||||||
from tripleoclient.v2 import overcloud_support
|
from tripleoclient.v2 import overcloud_support
|
||||||
|
|
||||||
@ -66,3 +68,25 @@ class TestOvercloudSupportReport(utils.TestCommand):
|
|||||||
'sos_destination': 'test'
|
'sos_destination': 'test'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@mock.patch('tripleoclient.utils.run_ansible_playbook',
|
||||||
|
autospec=True)
|
||||||
|
def test_overcloud_support_args_stack(self, mock_playbook):
|
||||||
|
arglist = ['server1', '--output', 'test', '--stack', 'notovercloud']
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, [])
|
||||||
|
self.cmd.take_action(parsed_args)
|
||||||
|
inv = os.path.join(
|
||||||
|
constants.DEFAULT_WORK_DIR,
|
||||||
|
'notovercloud/tripleo-ansible-inventory.yaml'
|
||||||
|
)
|
||||||
|
mock_playbook.assert_called_once_with(
|
||||||
|
workdir=mock.ANY,
|
||||||
|
playbook='cli-support-collect-logs.yaml',
|
||||||
|
inventory=inv,
|
||||||
|
playbook_dir=mock.ANY,
|
||||||
|
verbosity=3,
|
||||||
|
extra_vars={
|
||||||
|
'server_name': 'server1',
|
||||||
|
'sos_destination': 'test'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@ -34,6 +34,9 @@ class ReportExecute(command.Command):
|
|||||||
' to match. For example "Controller" will'
|
' to match. For example "Controller" will'
|
||||||
' match all controllers for an'
|
' match all controllers for an'
|
||||||
' environment.'))
|
' environment.'))
|
||||||
|
parser.add_argument('--stack',
|
||||||
|
help=_("Stack name to use for log collection."),
|
||||||
|
default='overcloud')
|
||||||
# Deprecated in U
|
# Deprecated in U
|
||||||
parser.add_argument('-c',
|
parser.add_argument('-c',
|
||||||
'--container',
|
'--container',
|
||||||
@ -90,7 +93,9 @@ class ReportExecute(command.Command):
|
|||||||
with utils.TempDirs() as tmp:
|
with utils.TempDirs() as tmp:
|
||||||
utils.run_ansible_playbook(
|
utils.run_ansible_playbook(
|
||||||
playbook='cli-support-collect-logs.yaml',
|
playbook='cli-support-collect-logs.yaml',
|
||||||
inventory=constants.ANSIBLE_INVENTORY,
|
inventory=constants.ANSIBLE_INVENTORY.format(
|
||||||
|
parsed_args.stack
|
||||||
|
),
|
||||||
workdir=tmp,
|
workdir=tmp,
|
||||||
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
|
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
|
||||||
verbosity=utils.playbook_verbosity(self=self),
|
verbosity=utils.playbook_verbosity(self=self),
|
||||||
|
Loading…
Reference in New Issue
Block a user