
This commit adds the command "subcloud deploy config" to dcmanager. It provides similar options as dcmanager subcloud reconfig. However, the --deploy-config file is optional if it has been provided previously via subcloud deploy config or subcloud deploy create command. Test Plan: Success cases: - PASS: Bootstrap a subcloud then issue "dcmanager subcloud deploy config" command with --deploy-config option to apply initial config. Verify that the subcloud is successfully configured. - PASS: Create a deploy config using dcmanager subcloud deploy create with --deploy-config option. Install and bootstrap the subcloud then config the subcloud using dcmanger subcloud deploy config with --deploy-config option. Verify that the subcloud is successfully configured with config options provided last. - PASS: Bootstrap a subcloud then issue "dcmanager subcloud deploy config" command with --deploy-config option to apply an erroneous config. Verify that the subcloud fails to be configured. Repeat the command this time with a good config file and verify that the subcloud is successfully configured. - PASS: Apply config passing deploy_config file for a subcloud running a previous release (21.12) and verify that the subcloud was successfully configured. - PASS: Create a subcloud deploy with --deploy-config option, install and bootstrap the subcloud then issue "dcmanager subcloud deploy config" command without --deploy-config option. Verify that the subcloud is successfully configured. - PASS: Repeat previous tests but directly call the API (using CURL) instead of using the CLI. Failure cases: - PASS: Verify that it's not possible to run the config if deploy state is not 'complete', 'pre-config-failed', 'config-failed', 'deploy-failed', 'bootstrapped' or in a prestaging state. ('deploy-failed' will be removed once 'subcloud reconfig' is deprecated) - PASS: Verify that it's not possible to run "dcmanager subcloud deploy config" command without providing a deploy config file if this has never been provided before. - PASS: Verify that it's not possible to run the config without previously uploading deploy files. - PASS: Verify that it's not possible to configure without passing the 'sysadmin-password' parameter (using CURL, since the CLI will prompt for the password if it's omited) - PASS: Call the API directly, passing sysadmin-password as plain text as opposed to b64encoded and verify that the response contains the correct error code and message. Story: 2010756 Task: 48022 Signed-off-by: Victor Romano <victor.gluzromano@windriver.com> Change-Id: I65e1cbea1879d49066c2add69cabd04e64216b8f
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
#
|
|
# Copyright (c) 2023 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
from dcmanager.api.policies import base
|
|
from oslo_policy import policy
|
|
|
|
POLICY_ROOT = 'dc_api:phased_subcloud_deploy:%s'
|
|
|
|
|
|
phased_subcloud_deploy_rules = [
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % 'create',
|
|
check_str='rule:' + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Create a subcloud",
|
|
operations=[
|
|
{
|
|
'method': 'POST',
|
|
'path': '/v1.0/phased-subcloud-deploy'
|
|
}
|
|
]
|
|
),
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % 'modify',
|
|
check_str='rule:' + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Modify the subcloud deployment.",
|
|
operations=[
|
|
{
|
|
'method': 'PATCH',
|
|
'path': '/v1.0/phased-subcloud-deploy/{subcloud}/bootstrap'
|
|
},
|
|
{
|
|
'method': 'PATCH',
|
|
'path': '/v1.0/phased-subcloud-deploy/{subcloud}/configure'
|
|
}
|
|
]
|
|
)
|
|
]
|
|
|
|
|
|
def list_rules():
|
|
return phased_subcloud_deploy_rules
|