Remove subcloud add secondary from CLI
Remove "dcmanager subcloud add --secondary" from CLI. This command is not supposed to be used by end user. Test Plan: 1. PASS - Run 'dcmanager subcloud add --secondary' and verify that the error message prompted; 2. PASS - Run a normal 'subcloud add' (without --secondary) and verify that the command work as expected. Story: 2010852 Task: 48818 Signed-off-by: Wang Tao <tao.wang@windriver.com> Change-Id: Ib3069797a9dcb90242e7eb8ec2584d1b2faf38d4
This commit is contained in:
parent
04d2517df3
commit
bf3d515c94
|
@ -229,13 +229,6 @@ class AddSubcloud(base.DCManagerShowOne):
|
|||
'release of the system controller will be used.'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--secondary',
|
||||
required=False,
|
||||
action='store_true',
|
||||
help='A flag indicating if this subcloud is a placeholder '
|
||||
'for incoming subcloud rehoming.'
|
||||
)
|
||||
return parser
|
||||
|
||||
def _get_resources(self, parsed_args):
|
||||
|
@ -265,19 +258,12 @@ class AddSubcloud(base.DCManagerShowOne):
|
|||
error_msg = "migrate with deploy-config is not allowed"
|
||||
raise exceptions.DCManagerClientException(error_msg)
|
||||
|
||||
if parsed_args.secondary:
|
||||
error_msg = "secondary with deploy-config is not allowed"
|
||||
raise exceptions.DCManagerClientException(error_msg)
|
||||
|
||||
if not os.path.isfile(parsed_args.deploy_config):
|
||||
error_msg = "deploy-config does not exist: %s" % \
|
||||
parsed_args.deploy_config
|
||||
raise exceptions.DCManagerClientException(error_msg)
|
||||
files['deploy_config'] = parsed_args.deploy_config
|
||||
|
||||
# To add a secondary subcloud,
|
||||
# do not need sysadmin_password
|
||||
if not parsed_args.secondary:
|
||||
# Prompt the user for the subcloud's password if it isn't provided
|
||||
if parsed_args.sysadmin_password is not None:
|
||||
data['sysadmin_password'] = base64.b64encode(
|
||||
|
@ -305,9 +291,6 @@ class AddSubcloud(base.DCManagerShowOne):
|
|||
if parsed_args.release is not None:
|
||||
data['release'] = parsed_args.release
|
||||
|
||||
if parsed_args.secondary:
|
||||
data['secondary'] = 'true'
|
||||
|
||||
if parsed_args.name is not None:
|
||||
if parsed_args.migrate:
|
||||
data['name'] = parsed_args.name
|
||||
|
|
|
@ -391,32 +391,3 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
|
|||
actual_call_without_release[1])
|
||||
self.assertRaises(SystemExit, self.call,
|
||||
subcloud_cmd.MigrateSubcloud, app_args=[])
|
||||
|
||||
def test_add_secondary_subcloud(self):
|
||||
self.client.subcloud_manager.add_subcloud.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode='w') as f_bootstrap:
|
||||
bootstrap_file_path = os.path.abspath(f_bootstrap.name)
|
||||
actual_call = self.call(
|
||||
subcloud_cmd.AddSubcloud,
|
||||
app_args=[
|
||||
'--bootstrap-address', base.BOOTSTRAP_ADDRESS,
|
||||
'--bootstrap-values', bootstrap_file_path,
|
||||
'--sysadmin-password', 'testpassword',
|
||||
'--secondary',
|
||||
])
|
||||
self.assertEqual(
|
||||
base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID_REHOME_DATA,
|
||||
actual_call[1])
|
||||
with tempfile.NamedTemporaryFile() as f_config:
|
||||
config_file_path = os.path.abspath(f_config.name)
|
||||
self.assertRaises(
|
||||
DCManagerClientException, self.call,
|
||||
subcloud_cmd.AddSubcloud, app_args=[
|
||||
'--bootstrap-address', base.BOOTSTRAP_ADDRESS,
|
||||
'--bootstrap-values', bootstrap_file_path,
|
||||
'--sysadmin-password', 'testpassword',
|
||||
'--deploy-config', config_file_path,
|
||||
'--secondary'
|
||||
])
|
||||
|
|
Loading…
Reference in New Issue