Merge "Move DC ansible override files to dc-vault"
This commit is contained in:
commit
5ec99e186b
|
@ -282,7 +282,7 @@ ALARM_DEGRADED_STATUS = "degraded"
|
|||
ALARM_CRITICAL_STATUS = "critical"
|
||||
|
||||
# subcloud deploy file options
|
||||
ANSIBLE_OVERRIDES_PATH = '/var/opt/dc/ansible'
|
||||
ANSIBLE_OVERRIDES_PATH = '/opt/dc-vault/ansible'
|
||||
DEPLOY_PLAYBOOK = "deploy_playbook"
|
||||
DEPLOY_OVERRIDES = "deploy_overrides"
|
||||
DEPLOY_CHART = "deploy_chart"
|
||||
|
|
|
@ -92,6 +92,8 @@ class DCManagerService(service.Service):
|
|||
if not os.path.isdir(consts.DC_ANSIBLE_LOG_DIR):
|
||||
os.mkdir(consts.DC_ANSIBLE_LOG_DIR, 0o755)
|
||||
|
||||
os.makedirs(consts.ANSIBLE_OVERRIDES_PATH, 0o600, exist_ok=True)
|
||||
|
||||
self.subcloud_manager.handle_subcloud_operations_in_progress()
|
||||
super(DCManagerService, self).start()
|
||||
|
||||
|
|
|
@ -254,8 +254,8 @@ class TestSubcloudDeploy(testroot.DCManagerApiTest):
|
|||
deploy_config = psd_common.get_config_file_path("subcloud1",
|
||||
consts.DEPLOY_CONFIG)
|
||||
self.assertEqual(bootstrap_file,
|
||||
"/var/opt/dc/ansible/subcloud1.yml")
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1.yml')
|
||||
self.assertEqual(install_values,
|
||||
"/var/opt/dc/ansible/subcloud1/install_values.yml")
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1/install_values.yml')
|
||||
self.assertEqual(deploy_config,
|
||||
"/var/opt/dc/ansible/subcloud1_deploy_config.yml")
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_deploy_config.yml')
|
||||
|
|
|
@ -1591,11 +1591,11 @@ class TestSubcloudAPIOther(testroot.DCManagerApiTest):
|
|||
install_values = sc._get_config_file_path("subcloud1", "install_values")
|
||||
deploy_config = sc._get_config_file_path("subcloud1", consts.DEPLOY_CONFIG)
|
||||
self.assertEqual(bootstrap_file,
|
||||
"/var/opt/dc/ansible/subcloud1.yml")
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1.yml')
|
||||
self.assertEqual(install_values,
|
||||
"/var/opt/dc/ansible/subcloud1/install_values.yml")
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1/install_values.yml')
|
||||
self.assertEqual(deploy_config,
|
||||
"/var/opt/dc/ansible/subcloud1_deploy_config.yml")
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_deploy_config.yml')
|
||||
|
||||
@mock.patch.object(rpc_client, 'ManagerClient')
|
||||
def test_format_ip_address(self, mock_rpc_client):
|
||||
|
|
|
@ -1581,22 +1581,22 @@ class TestSubcloudManager(base.DCManagerTestCase):
|
|||
filename = sm._get_ansible_filename('subcloud1',
|
||||
consts.INVENTORY_FILE_POSTFIX)
|
||||
self.assertEqual(filename,
|
||||
'/var/opt/dc/ansible/subcloud1_inventory.yml')
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_inventory.yml')
|
||||
|
||||
def test_compose_install_command(self):
|
||||
sm = subcloud_manager.SubcloudManager()
|
||||
install_command = sm.compose_install_command(
|
||||
'subcloud1',
|
||||
'/var/opt/dc/ansible/subcloud1_inventory.yml',
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_inventory.yml',
|
||||
FAKE_PREVIOUS_SW_VERSION)
|
||||
self.assertEqual(
|
||||
install_command,
|
||||
[
|
||||
'ansible-playbook',
|
||||
subcloud_manager.ANSIBLE_SUBCLOUD_INSTALL_PLAYBOOK,
|
||||
'-i', '/var/opt/dc/ansible/subcloud1_inventory.yml',
|
||||
'-i', f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_inventory.yml',
|
||||
'--limit', 'subcloud1',
|
||||
'-e', "@/var/opt/dc/ansible/subcloud1/install_values.yml",
|
||||
'-e', f"@{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1/install_values.yml",
|
||||
'-e', "install_release_version=%s" % FAKE_PREVIOUS_SW_VERSION
|
||||
]
|
||||
)
|
||||
|
@ -1607,7 +1607,7 @@ class TestSubcloudManager(base.DCManagerTestCase):
|
|||
sm = subcloud_manager.SubcloudManager()
|
||||
apply_command = sm.compose_apply_command(
|
||||
'subcloud1',
|
||||
'/var/opt/dc/ansible/subcloud1_inventory.yml',
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_inventory.yml',
|
||||
FAKE_PREVIOUS_SW_VERSION)
|
||||
self.assertEqual(
|
||||
apply_command,
|
||||
|
@ -1616,9 +1616,9 @@ class TestSubcloudManager(base.DCManagerTestCase):
|
|||
cutils.get_playbook_for_software_version(
|
||||
subcloud_manager.ANSIBLE_SUBCLOUD_PLAYBOOK,
|
||||
FAKE_PREVIOUS_SW_VERSION),
|
||||
'-i', '/var/opt/dc/ansible/subcloud1_inventory.yml',
|
||||
'-i', f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_inventory.yml',
|
||||
'--limit', 'subcloud1', '-e',
|
||||
"override_files_dir='/var/opt/dc/ansible' region_name=subcloud1",
|
||||
f"override_files_dir='{consts.ANSIBLE_OVERRIDES_PATH}' region_name=subcloud1",
|
||||
'-e', "install_release_version=%s" % FAKE_PREVIOUS_SW_VERSION
|
||||
]
|
||||
)
|
||||
|
@ -1632,14 +1632,14 @@ class TestSubcloudManager(base.DCManagerTestCase):
|
|||
"deploy_config": "subcloud1.yaml"}
|
||||
deploy_command = sm.compose_deploy_command(
|
||||
'subcloud1',
|
||||
'/var/opt/dc/ansible/subcloud1_inventory.yml',
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_inventory.yml',
|
||||
fake_payload)
|
||||
self.assertEqual(
|
||||
deploy_command,
|
||||
[
|
||||
'ansible-playbook', 'test_playbook.yaml', '-e',
|
||||
'@/var/opt/dc/ansible/subcloud1_deploy_values.yml', '-i',
|
||||
'/var/opt/dc/ansible/subcloud1_inventory.yml',
|
||||
f'@{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_deploy_values.yml', '-i',
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_inventory.yml',
|
||||
'--limit', 'subcloud1'
|
||||
]
|
||||
)
|
||||
|
@ -1650,7 +1650,7 @@ class TestSubcloudManager(base.DCManagerTestCase):
|
|||
sm = subcloud_manager.SubcloudManager()
|
||||
rehome_command = sm.compose_rehome_command(
|
||||
'subcloud1',
|
||||
'/var/opt/dc/ansible/subcloud1_inventory.yml',
|
||||
f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_inventory.yml',
|
||||
FAKE_PREVIOUS_SW_VERSION)
|
||||
self.assertEqual(
|
||||
rehome_command,
|
||||
|
@ -1659,11 +1659,11 @@ class TestSubcloudManager(base.DCManagerTestCase):
|
|||
cutils.get_playbook_for_software_version(
|
||||
subcloud_manager.ANSIBLE_SUBCLOUD_REHOME_PLAYBOOK,
|
||||
FAKE_PREVIOUS_SW_VERSION),
|
||||
'-i', '/var/opt/dc/ansible/subcloud1_inventory.yml',
|
||||
'-i', f'{consts.ANSIBLE_OVERRIDES_PATH}/subcloud1_inventory.yml',
|
||||
'--limit', 'subcloud1',
|
||||
'--timeout', subcloud_manager.REHOME_PLAYBOOK_TIMEOUT,
|
||||
'-e',
|
||||
"override_files_dir='/var/opt/dc/ansible' region_name=subcloud1"
|
||||
f"override_files_dir='{consts.ANSIBLE_OVERRIDES_PATH}' region_name=subcloud1"
|
||||
]
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue