Create a zuul job for black formatter
Create a Zuul job to check Black Formatter in the code. This commit also applies the Black formatter to the entire project. Test Plan Pass - Success on stx-distcloud-client-tox-black Pass - Success on tox command Story: 2011149 Task: 50393 Change-Id: I5d7b537e83931304ffd5f67ce51e8ebb44f7e65b Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit is contained in:
12
.zuul.yaml
12
.zuul.yaml
@@ -10,12 +10,14 @@
|
|||||||
- stx-distcloud-client-tox-pep8
|
- stx-distcloud-client-tox-pep8
|
||||||
- stx-distcloud-client-tox-py39
|
- stx-distcloud-client-tox-py39
|
||||||
- stx-distcloud-client-tox-pylint
|
- stx-distcloud-client-tox-pylint
|
||||||
|
- stx-distcloud-client-tox-black
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-linters
|
- openstack-tox-linters
|
||||||
- stx-distcloud-client-tox-pep8
|
- stx-distcloud-client-tox-pep8
|
||||||
- stx-distcloud-client-tox-py39
|
- stx-distcloud-client-tox-py39
|
||||||
- stx-distcloud-client-tox-pylint
|
- stx-distcloud-client-tox-pylint
|
||||||
|
- stx-distcloud-client-tox-black
|
||||||
post:
|
post:
|
||||||
jobs:
|
jobs:
|
||||||
- stx-distcloud-client-upload-git-mirror
|
- stx-distcloud-client-upload-git-mirror
|
||||||
@@ -50,6 +52,16 @@
|
|||||||
tox_envlist: pep8
|
tox_envlist: pep8
|
||||||
tox_extra_args: -c distributedcloud-client/tox.ini
|
tox_extra_args: -c distributedcloud-client/tox.ini
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: stx-distcloud-client-tox-black
|
||||||
|
parent: tox
|
||||||
|
description: Run black for distcloud-client
|
||||||
|
nodeset: debian-bullseye
|
||||||
|
vars:
|
||||||
|
python_version: 3.9
|
||||||
|
tox_envlist: black_check
|
||||||
|
tox_extra_args: -c distributedcloud-client/tox.ini
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: stx-distcloud-client-upload-git-mirror
|
name: stx-distcloud-client-upload-git-mirror
|
||||||
parent: upload-git-mirror
|
parent: upload-git-mirror
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# Copyright (c) 2016 Ericsson AB
|
# Copyright (c) 2016 Ericsson AB
|
||||||
# Copyright (c) 2017-2021 Wind River Systems, Inc.
|
# Copyright (c) 2017-2021, 2024 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@@ -17,5 +17,4 @@
|
|||||||
import pbr.version
|
import pbr.version
|
||||||
|
|
||||||
|
|
||||||
__version__ = pbr.version.VersionInfo(
|
__version__ = pbr.version.VersionInfo("distributedcloud_client").version_string()
|
||||||
'distributedcloud_client').version_string()
|
|
||||||
|
@@ -57,7 +57,7 @@ class Subcloud(Resource):
|
|||||||
"prestage-status": "prestage_status",
|
"prestage-status": "prestage_status",
|
||||||
"prestage-versions": "prestage_versions",
|
"prestage-versions": "prestage_versions",
|
||||||
"region-name": "region_name",
|
"region-name": "region_name",
|
||||||
"info_message": "info_message"
|
"info_message": "info_message",
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -90,7 +90,7 @@ class Subcloud(Resource):
|
|||||||
region_name=None,
|
region_name=None,
|
||||||
prestage_status=None,
|
prestage_status=None,
|
||||||
prestage_versions=None,
|
prestage_versions=None,
|
||||||
info_message=None
|
info_message=None,
|
||||||
):
|
):
|
||||||
if endpoint_sync_status is None:
|
if endpoint_sync_status is None:
|
||||||
endpoint_sync_status = {}
|
endpoint_sync_status = {}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# Copyright 2016 - Ericsson AB
|
# Copyright 2016 - Ericsson AB
|
||||||
# Copyright (c) 2017, 2019, 2021 Wind River Systems, Inc.
|
# Copyright (c) 2017, 2019, 2021, 2024 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -19,14 +19,28 @@ import six
|
|||||||
from dcmanagerclient.api.v1 import client as client_v1
|
from dcmanagerclient.api.v1 import client as client_v1
|
||||||
|
|
||||||
|
|
||||||
def client(dcmanager_url=None, username=None, api_key=None,
|
def client(
|
||||||
project_name=None, auth_url=None, project_id=None,
|
dcmanager_url=None,
|
||||||
endpoint_type='publicURL', service_type='dcmanager',
|
username=None,
|
||||||
auth_token=None, user_id=None, cacert=None, insecure=False,
|
api_key=None,
|
||||||
profile=None, auth_type='keystone', client_id=None,
|
project_name=None,
|
||||||
client_secret=None, session=None, **kwargs):
|
auth_url=None,
|
||||||
|
project_id=None,
|
||||||
|
endpoint_type="publicURL",
|
||||||
|
service_type="dcmanager",
|
||||||
|
auth_token=None,
|
||||||
|
user_id=None,
|
||||||
|
cacert=None,
|
||||||
|
insecure=False,
|
||||||
|
profile=None,
|
||||||
|
auth_type="keystone",
|
||||||
|
client_id=None,
|
||||||
|
client_secret=None,
|
||||||
|
session=None,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
if dcmanager_url and not isinstance(dcmanager_url, six.string_types):
|
if dcmanager_url and not isinstance(dcmanager_url, six.string_types):
|
||||||
raise RuntimeError('DC Manager url should be a string.')
|
raise RuntimeError("DC Manager url should be a string.")
|
||||||
|
|
||||||
return client_v1.Client(
|
return client_v1.Client(
|
||||||
dcmanager_url=dcmanager_url,
|
dcmanager_url=dcmanager_url,
|
||||||
|
@@ -43,7 +43,6 @@ def log_request(func):
|
|||||||
|
|
||||||
|
|
||||||
class HTTPClient:
|
class HTTPClient:
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
base_url,
|
base_url,
|
||||||
|
@@ -26,17 +26,18 @@ from dcmanagerclient.api.v1.alarm_manager import AlarmManager
|
|||||||
from dcmanagerclient.api.v1.fw_update_manager import FwUpdateManager
|
from dcmanagerclient.api.v1.fw_update_manager import FwUpdateManager
|
||||||
from dcmanagerclient.api.v1.kube_rootca_update_manager import KubeRootcaUpdateManager
|
from dcmanagerclient.api.v1.kube_rootca_update_manager import KubeRootcaUpdateManager
|
||||||
from dcmanagerclient.api.v1.kube_upgrade_manager import KubeUpgradeManager
|
from dcmanagerclient.api.v1.kube_upgrade_manager import KubeUpgradeManager
|
||||||
from dcmanagerclient.api.v1.peer_group_association_manager import \
|
from dcmanagerclient.api.v1.peer_group_association_manager import (
|
||||||
PeerGroupAssociationManager
|
PeerGroupAssociationManager,
|
||||||
from dcmanagerclient.api.v1.phased_subcloud_deploy_manager import \
|
)
|
||||||
PhasedSubcloudDeployManager
|
from dcmanagerclient.api.v1.phased_subcloud_deploy_manager import (
|
||||||
|
PhasedSubcloudDeployManager,
|
||||||
|
)
|
||||||
from dcmanagerclient.api.v1.strategy_step_manager import StrategyStepManager
|
from dcmanagerclient.api.v1.strategy_step_manager import StrategyStepManager
|
||||||
from dcmanagerclient.api.v1.subcloud_backup_manager import SubcloudBackupManager
|
from dcmanagerclient.api.v1.subcloud_backup_manager import SubcloudBackupManager
|
||||||
from dcmanagerclient.api.v1.subcloud_deploy_manager import SubcloudDeployManager
|
from dcmanagerclient.api.v1.subcloud_deploy_manager import SubcloudDeployManager
|
||||||
from dcmanagerclient.api.v1.subcloud_group_manager import SubcloudGroupManager
|
from dcmanagerclient.api.v1.subcloud_group_manager import SubcloudGroupManager
|
||||||
from dcmanagerclient.api.v1.subcloud_manager import SubcloudManager
|
from dcmanagerclient.api.v1.subcloud_manager import SubcloudManager
|
||||||
from dcmanagerclient.api.v1.subcloud_peer_group_manager import \
|
from dcmanagerclient.api.v1.subcloud_peer_group_manager import SubcloudPeerGroupManager
|
||||||
SubcloudPeerGroupManager
|
|
||||||
from dcmanagerclient.api.v1.sw_deploy_manager import SwDeployManager
|
from dcmanagerclient.api.v1.sw_deploy_manager import SwDeployManager
|
||||||
from dcmanagerclient.api.v1.sw_patch_manager import SwPatchManager
|
from dcmanagerclient.api.v1.sw_patch_manager import SwPatchManager
|
||||||
from dcmanagerclient.api.v1.sw_prestage_manager import SwPrestageManager
|
from dcmanagerclient.api.v1.sw_prestage_manager import SwPrestageManager
|
||||||
|
@@ -20,6 +20,5 @@ SW_UPDATE_TYPE_FIRMWARE = "firmware"
|
|||||||
|
|
||||||
|
|
||||||
class FwUpdateManager(SwUpdateManager):
|
class FwUpdateManager(SwUpdateManager):
|
||||||
|
|
||||||
def __init__(self, http_client):
|
def __init__(self, http_client):
|
||||||
super().__init__(http_client, update_type=SW_UPDATE_TYPE_FIRMWARE)
|
super().__init__(http_client, update_type=SW_UPDATE_TYPE_FIRMWARE)
|
||||||
|
@@ -9,7 +9,6 @@ SW_UPDATE_TYPE_KUBE_ROOTCA_UPDATE = "kube-rootca-update"
|
|||||||
|
|
||||||
|
|
||||||
class KubeRootcaUpdateManager(SwUpdateManager):
|
class KubeRootcaUpdateManager(SwUpdateManager):
|
||||||
|
|
||||||
def __init__(self, http_client):
|
def __init__(self, http_client):
|
||||||
super().__init__(http_client, update_type=SW_UPDATE_TYPE_KUBE_ROOTCA_UPDATE)
|
super().__init__(http_client, update_type=SW_UPDATE_TYPE_KUBE_ROOTCA_UPDATE)
|
||||||
self.extra_args = ["subject", "expiry-date", "cert-file"]
|
self.extra_args = ["subject", "expiry-date", "cert-file"]
|
||||||
|
@@ -20,7 +20,6 @@ SW_UPDATE_TYPE_KUBERNETES = "kubernetes"
|
|||||||
|
|
||||||
|
|
||||||
class KubeUpgradeManager(SwUpdateManager):
|
class KubeUpgradeManager(SwUpdateManager):
|
||||||
|
|
||||||
def __init__(self, http_client):
|
def __init__(self, http_client):
|
||||||
super().__init__(http_client, update_type=SW_UPDATE_TYPE_KUBERNETES)
|
super().__init__(http_client, update_type=SW_UPDATE_TYPE_KUBERNETES)
|
||||||
self.extra_args = ["to-version"]
|
self.extra_args = ["to-version"]
|
||||||
|
@@ -47,9 +47,7 @@ class PeerGroupAssociationManager(base.ResourceManager):
|
|||||||
|
|
||||||
def _json_to_resource(self, json_object):
|
def _json_to_resource(self, json_object):
|
||||||
sync_message = (
|
sync_message = (
|
||||||
None
|
None if "sync-message" not in json_object else json_object["sync-message"]
|
||||||
if "sync-message" not in json_object
|
|
||||||
else json_object["sync-message"]
|
|
||||||
)
|
)
|
||||||
return self.resource_class(
|
return self.resource_class(
|
||||||
self,
|
self,
|
||||||
|
@@ -45,7 +45,6 @@ class StrategyStep(base.Resource):
|
|||||||
|
|
||||||
|
|
||||||
class StrategyStepManager(base.ResourceManager):
|
class StrategyStepManager(base.ResourceManager):
|
||||||
|
|
||||||
def __init__(self, http_client):
|
def __init__(self, http_client):
|
||||||
super().__init__(http_client)
|
super().__init__(http_client)
|
||||||
self.resource_class = StrategyStep
|
self.resource_class = StrategyStep
|
||||||
|
@@ -13,7 +13,6 @@ from dcmanagerclient.api.base import get_json
|
|||||||
|
|
||||||
|
|
||||||
class SubcloudBackupManager(base.ResourceManager):
|
class SubcloudBackupManager(base.ResourceManager):
|
||||||
|
|
||||||
resource_class = base.Subcloud
|
resource_class = base.Subcloud
|
||||||
|
|
||||||
def json_to_resource(self, json_object):
|
def json_to_resource(self, json_object):
|
||||||
|
@@ -19,7 +19,6 @@ SW_UPDATE_TYPE_PRESTAGE = "prestage"
|
|||||||
|
|
||||||
|
|
||||||
class SwPrestageManager(SwUpdateManager):
|
class SwPrestageManager(SwUpdateManager):
|
||||||
|
|
||||||
def __init__(self, http_client):
|
def __init__(self, http_client):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
http_client,
|
http_client,
|
||||||
|
@@ -20,6 +20,5 @@ SW_UPDATE_TYPE_UPGRADE = "upgrade"
|
|||||||
|
|
||||||
|
|
||||||
class SwUpgradeManager(SwUpdateManager):
|
class SwUpgradeManager(SwUpdateManager):
|
||||||
|
|
||||||
def __init__(self, http_client):
|
def __init__(self, http_client):
|
||||||
super().__init__(http_client, update_type=SW_UPDATE_TYPE_UPGRADE)
|
super().__init__(http_client, update_type=SW_UPDATE_TYPE_UPGRADE)
|
||||||
|
@@ -72,9 +72,7 @@ class SystemPeerManager(base.ResourceManager):
|
|||||||
heartbeat_interval=json_object["heartbeat-interval"],
|
heartbeat_interval=json_object["heartbeat-interval"],
|
||||||
heartbeat_failure_threshold=json_object["heartbeat-failure-threshold"],
|
heartbeat_failure_threshold=json_object["heartbeat-failure-threshold"],
|
||||||
heartbeat_failure_policy=json_object["heartbeat-failure-policy"],
|
heartbeat_failure_policy=json_object["heartbeat-failure-policy"],
|
||||||
heartbeat_maintenance_timeout=json_object[
|
heartbeat_maintenance_timeout=json_object["heartbeat-maintenance-timeout"],
|
||||||
"heartbeat-maintenance-timeout"
|
|
||||||
],
|
|
||||||
availability_state=json_object["availability-state"],
|
availability_state=json_object["availability-state"],
|
||||||
created_at=json_object["created-at"],
|
created_at=json_object["created-at"],
|
||||||
updated_at=json_object["updated-at"],
|
updated_at=json_object["updated-at"],
|
||||||
|
@@ -85,7 +85,6 @@ class DCManagerShowOne(command.ShowOne):
|
|||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class DCManagerShow(DCManagerLister, DCManagerShowOne):
|
class DCManagerShow(DCManagerLister, DCManagerShowOne):
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def should_list(self, parsed_args):
|
def should_list(self, parsed_args):
|
||||||
"""Uses Lister behaviour if True, ShowOne otherwise."""
|
"""Uses Lister behaviour if True, ShowOne otherwise."""
|
||||||
@@ -102,7 +101,5 @@ class DCManagerShow(DCManagerLister, DCManagerShowOne):
|
|||||||
"""Overrides method from cliff.Lister/cliff.ShowOne."""
|
"""Overrides method from cliff.Lister/cliff.ShowOne."""
|
||||||
|
|
||||||
if self.should_list(parsed_args):
|
if self.should_list(parsed_args):
|
||||||
return DCManagerLister.produce_output(
|
return DCManagerLister.produce_output(self, parsed_args, column_names, data)
|
||||||
self, parsed_args, column_names, data
|
|
||||||
)
|
|
||||||
return DCManagerShowOne.produce_output(self, parsed_args, column_names, data)
|
return DCManagerShowOne.produce_output(self, parsed_args, column_names, data)
|
||||||
|
@@ -82,9 +82,7 @@ class AddPeerGroupAssociation(base.DCManagerShowOne):
|
|||||||
"--peer-group-id", required=True, help="Subcloud peer group ID."
|
"--peer-group-id", required=True, help="Subcloud peer group ID."
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("--system-peer-id", required=True, help="System Peer ID.")
|
||||||
"--system-peer-id", required=True, help="System Peer ID."
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--peer-group-priority",
|
"--peer-group-priority",
|
||||||
@@ -186,9 +184,7 @@ class DeletePeerGroupAssociation(command.Command):
|
|||||||
self.app.client_manager.peer_group_association_manager
|
self.app.client_manager.peer_group_association_manager
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
peer_group_association_manager.delete_peer_group_association(
|
peer_group_association_manager.delete_peer_group_association(parsed_args.id)
|
||||||
parsed_args.id
|
|
||||||
)
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print(exc)
|
print(exc)
|
||||||
msg = f"Unable to delete peer group association {parsed_args.id}"
|
msg = f"Unable to delete peer group association {parsed_args.id}"
|
||||||
|
@@ -140,9 +140,7 @@ class PhasedSubcloudDeployResume(base.DCManagerShowOne):
|
|||||||
# Get the deploy config yaml file
|
# Get the deploy config yaml file
|
||||||
if parsed_args.deploy_config:
|
if parsed_args.deploy_config:
|
||||||
if not os.path.isfile(parsed_args.deploy_config):
|
if not os.path.isfile(parsed_args.deploy_config):
|
||||||
error_msg = (
|
error_msg = f"deploy-config does not exist: {parsed_args.deploy_config}"
|
||||||
f"deploy-config does not exist: {parsed_args.deploy_config}"
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(error_msg)
|
raise exceptions.DCManagerClientException(error_msg)
|
||||||
files["deploy_config"] = parsed_args.deploy_config
|
files["deploy_config"] = parsed_args.deploy_config
|
||||||
|
|
||||||
@@ -243,9 +241,7 @@ class CreatePhasedSubcloudDeploy(base.DCManagerShowOne):
|
|||||||
# Get the deploy config yaml file
|
# Get the deploy config yaml file
|
||||||
if parsed_args.deploy_config:
|
if parsed_args.deploy_config:
|
||||||
if not os.path.isfile(parsed_args.deploy_config):
|
if not os.path.isfile(parsed_args.deploy_config):
|
||||||
error_msg = (
|
error_msg = f"deploy-config does not exist: {parsed_args.deploy_config}"
|
||||||
f"deploy-config does not exist: {parsed_args.deploy_config}"
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(error_msg)
|
raise exceptions.DCManagerClientException(error_msg)
|
||||||
files["deploy_config"] = parsed_args.deploy_config
|
files["deploy_config"] = parsed_args.deploy_config
|
||||||
|
|
||||||
@@ -286,9 +282,7 @@ class InstallPhasedSubcloudDeploy(base.DCManagerShowOne):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("subcloud", help="Name or ID of the subcloud to install.")
|
||||||
"subcloud", help="Name or ID of the subcloud to install."
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--install-values",
|
"--install-values",
|
||||||
@@ -369,9 +363,7 @@ class BootstrapPhasedSubcloudDeploy(base.DCManagerShowOne):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("subcloud", help="Name or ID of the subcloud to bootstrap.")
|
||||||
"subcloud", help="Name or ID of the subcloud to bootstrap."
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--bootstrap-address",
|
"--bootstrap-address",
|
||||||
@@ -504,14 +496,10 @@ class CompletePhasedSubcloudDeploy(base.DCManagerShowOne):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return phased_subcloud_deploy_manager.subcloud_deploy_complete(
|
return phased_subcloud_deploy_manager.subcloud_deploy_complete(subcloud_ref)
|
||||||
subcloud_ref
|
|
||||||
)
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print(exc)
|
print(exc)
|
||||||
error_msg = (
|
error_msg = f"Unable to complete the deployment of subcloud {subcloud_ref}"
|
||||||
f"Unable to complete the deployment of subcloud {subcloud_ref}"
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(error_msg)
|
raise exceptions.DCManagerClientException(error_msg)
|
||||||
|
|
||||||
|
|
||||||
@@ -524,22 +512,20 @@ class EnrollPhasedSubcloudDeploy(base.DCManagerShowOne):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("subcloud", help="Name or ID of the subcloud to enroll.")
|
||||||
"subcloud", help="Name or ID of the subcloud to enroll."
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--install-values",
|
"--install-values",
|
||||||
required=False,
|
required=False,
|
||||||
help="YAML file containing parameters required for the "
|
help="YAML file containing parameters required for the "
|
||||||
"enrollment of the subcloud.",
|
"enrollment of the subcloud.",
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--deploy-config",
|
"--deploy-config",
|
||||||
required=False,
|
required=False,
|
||||||
help="YAML file containing parameters required for the initial "
|
help="YAML file containing parameters required for the initial "
|
||||||
"configuration and unlock of the subcloud.",
|
"configuration and unlock of the subcloud.",
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@@ -552,7 +538,7 @@ class EnrollPhasedSubcloudDeploy(base.DCManagerShowOne):
|
|||||||
"--bootstrap-values",
|
"--bootstrap-values",
|
||||||
required=False,
|
required=False,
|
||||||
help="YAML file containing the parameters required for the "
|
help="YAML file containing the parameters required for the "
|
||||||
"subcloud enrollment.",
|
"subcloud enrollment.",
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@@ -372,7 +372,6 @@ class RestoreSubcloudBackup(base.DCManagerShow):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, parsed_args):
|
def _get_resources(self, parsed_args):
|
||||||
|
|
||||||
subcloud_backup_manager = self.app.client_manager.subcloud_backup_manager
|
subcloud_backup_manager = self.app.client_manager.subcloud_backup_manager
|
||||||
data = {}
|
data = {}
|
||||||
files = {}
|
files = {}
|
||||||
@@ -402,9 +401,7 @@ class RestoreSubcloudBackup(base.DCManagerShow):
|
|||||||
raise exceptions.DCManagerClientException(error_msg)
|
raise exceptions.DCManagerClientException(error_msg)
|
||||||
|
|
||||||
if not parsed_args.with_install and parsed_args.release:
|
if not parsed_args.with_install and parsed_args.release:
|
||||||
error_msg = (
|
error_msg = "Option --release cannot be used without --with-install option."
|
||||||
"Option --release cannot be used without --with-install option."
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(error_msg)
|
raise exceptions.DCManagerClientException(error_msg)
|
||||||
|
|
||||||
if parsed_args.with_install:
|
if parsed_args.with_install:
|
||||||
|
@@ -68,34 +68,32 @@ class SubcloudDeployUpload(base.DCManagerShowOne):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--deploy-playbook",
|
"--deploy-playbook",
|
||||||
required=False,
|
required=False,
|
||||||
help="An ansible playbook to be run after the subcloud "
|
help=(
|
||||||
"has been successfully bootstrapped. It will be run with the "
|
"An ansible playbook to be run after the subcloud has been "
|
||||||
"subcloud as the target and authentication is "
|
"successfully bootstrapped. It will be run with the subcloud as the "
|
||||||
"handled automatically. "
|
"target and authentication is handled automatically. Must be a local "
|
||||||
"Must be a local file path",
|
"file path."
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--deploy-overrides",
|
"--deploy-overrides",
|
||||||
required=False,
|
required=False,
|
||||||
help="YAML file containing subcloud variables to be passed to the "
|
help="YAML file containing subcloud variables to be passed to the "
|
||||||
"deploy playbook."
|
"deploy playbook. Must be a local file path",
|
||||||
"Must be a local file path",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--deploy-chart",
|
"--deploy-chart",
|
||||||
required=False,
|
required=False,
|
||||||
help="Deployment Manager helm chart to be passed to the "
|
help="Deployment Manager helm chart to be passed to the "
|
||||||
"deploy playbook."
|
"deploy playbook. Must be a local file path",
|
||||||
"Must be a local file path",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--prestage-images",
|
"--prestage-images",
|
||||||
required=False,
|
required=False,
|
||||||
help="Container image list to be passed to "
|
help="Container image list to be passed to prestage_images playbook. "
|
||||||
"prestage_images playbook. "
|
|
||||||
"Must be a local file path",
|
"Must be a local file path",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -164,14 +162,13 @@ class SubcloudDeployShow(base.DCManagerShowOne):
|
|||||||
|
|
||||||
|
|
||||||
class DeprecatedSubcloudDeployShow(SubcloudDeployShow):
|
class DeprecatedSubcloudDeployShow(SubcloudDeployShow):
|
||||||
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
DEPRECATION_MESSAGE = (
|
||||||
"subcloud deploy show instead.")
|
"This command has been deprecated. Please use subcloud deploy show instead."
|
||||||
|
)
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument_group(
|
parser.add_argument_group(title="Notice", description=self.DEPRECATION_MESSAGE)
|
||||||
title="Notice", description=self.DEPRECATION_MESSAGE
|
|
||||||
)
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, _):
|
def _get_resources(self, _):
|
||||||
@@ -179,14 +176,13 @@ class DeprecatedSubcloudDeployShow(SubcloudDeployShow):
|
|||||||
|
|
||||||
|
|
||||||
class DeprecatedSubcloudDeployUpload(SubcloudDeployUpload):
|
class DeprecatedSubcloudDeployUpload(SubcloudDeployUpload):
|
||||||
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
DEPRECATION_MESSAGE = (
|
||||||
"subcloud deploy upload instead.")
|
"This command has been deprecated. Please use subcloud deploy upload instead."
|
||||||
|
)
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument_group(
|
parser.add_argument_group(title="Notice", description=self.DEPRECATION_MESSAGE)
|
||||||
title="Notice", description=self.DEPRECATION_MESSAGE
|
|
||||||
)
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, _):
|
def _get_resources(self, _):
|
||||||
|
@@ -192,9 +192,7 @@ class DeleteSubcloudGroup(command.Command):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("group", help="Name or ID of the subcloud group to delete.")
|
||||||
"group", help="Name or ID of the subcloud group to delete."
|
|
||||||
)
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@@ -217,9 +215,7 @@ class UpdateSubcloudGroup(base.DCManagerShowOne):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("group", help="Name or ID of the subcloud group to update.")
|
||||||
"group", help="Name or ID of the subcloud group to update."
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument("--name", required=False, help="Name of subcloud group.")
|
parser.add_argument("--name", required=False, help="Name of subcloud group.")
|
||||||
|
|
||||||
|
@@ -24,10 +24,7 @@ from dcmanagerclient import exceptions
|
|||||||
from dcmanagerclient import utils
|
from dcmanagerclient import utils
|
||||||
from dcmanagerclient.commands.v1 import base
|
from dcmanagerclient.commands.v1 import base
|
||||||
|
|
||||||
SET_FIELD_VALUE_DICT = {
|
SET_FIELD_VALUE_DICT = {"region_name": None, "info_message": None}
|
||||||
"region_name": None,
|
|
||||||
"info_message": None
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def basic_format(subcloud=None):
|
def basic_format(subcloud=None):
|
||||||
@@ -304,9 +301,7 @@ class AddSubcloud(base.DCManagerShowOne):
|
|||||||
raise exceptions.DCManagerClientException(error_msg)
|
raise exceptions.DCManagerClientException(error_msg)
|
||||||
|
|
||||||
if not os.path.isfile(parsed_args.deploy_config):
|
if not os.path.isfile(parsed_args.deploy_config):
|
||||||
error_msg = (
|
error_msg = f"deploy-config does not exist: {parsed_args.deploy_config}"
|
||||||
f"deploy-config does not exist: {parsed_args.deploy_config}"
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(error_msg)
|
raise exceptions.DCManagerClientException(error_msg)
|
||||||
files["deploy_config"] = parsed_args.deploy_config
|
files["deploy_config"] = parsed_args.deploy_config
|
||||||
|
|
||||||
@@ -488,9 +483,7 @@ class UnmanageSubcloud(base.DCManagerShowOne):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("subcloud", help="Name or ID of the subcloud to unmanage.")
|
||||||
"subcloud", help="Name or ID of the subcloud to unmanage."
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--migrate",
|
"--migrate",
|
||||||
@@ -564,6 +557,7 @@ class ManageSubcloud(base.DCManagerShowOne):
|
|||||||
|
|
||||||
class UpdateSubcloud(base.DCManagerShowOne):
|
class UpdateSubcloud(base.DCManagerShowOne):
|
||||||
"""Update attributes of a subcloud."""
|
"""Update attributes of a subcloud."""
|
||||||
|
|
||||||
_info_message = None
|
_info_message = None
|
||||||
|
|
||||||
def produce_output(self, parsed_args, column_names, data):
|
def produce_output(self, parsed_args, column_names, data):
|
||||||
@@ -590,9 +584,7 @@ class UpdateSubcloud(base.DCManagerShowOne):
|
|||||||
"--description", required=False, help="Description of subcloud."
|
"--description", required=False, help="Description of subcloud."
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("--location", required=False, help="Location of subcloud.")
|
||||||
"--location", required=False, help="Location of subcloud."
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--group", required=False, help="Name or ID of subcloud group."
|
"--group", required=False, help="Name or ID of subcloud group."
|
||||||
@@ -702,9 +694,7 @@ class UpdateSubcloud(base.DCManagerShowOne):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
password = utils.prompt_for_password()
|
password = utils.prompt_for_password()
|
||||||
data["sysadmin_password"] = base64.b64encode(
|
data["sysadmin_password"] = base64.b64encode(password.encode("utf-8"))
|
||||||
password.encode("utf-8")
|
|
||||||
)
|
|
||||||
# For subcloud network reconfiguration
|
# For subcloud network reconfiguration
|
||||||
# If any management_* presents, need all
|
# If any management_* presents, need all
|
||||||
# management_subnet/management_gateway_ip/
|
# management_subnet/management_gateway_ip/
|
||||||
@@ -756,7 +746,7 @@ class UpdateSubcloud(base.DCManagerShowOne):
|
|||||||
result = subcloud_manager.update_subcloud(
|
result = subcloud_manager.update_subcloud(
|
||||||
subcloud_ref, files=files, data=data
|
subcloud_ref, files=files, data=data
|
||||||
)
|
)
|
||||||
self._info_message = getattr(result[0], 'info_message')
|
self._info_message = getattr(result[0], "info_message")
|
||||||
update_fields_values(result)
|
update_fields_values(result)
|
||||||
return result
|
return result
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
@@ -768,17 +758,16 @@ class UpdateSubcloud(base.DCManagerShowOne):
|
|||||||
class ReconfigSubcloud(base.DCManagerShowOne):
|
class ReconfigSubcloud(base.DCManagerShowOne):
|
||||||
"""Reconfigure a subcloud."""
|
"""Reconfigure a subcloud."""
|
||||||
|
|
||||||
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
DEPRECATION_MESSAGE = (
|
||||||
"'subcloud deploy config' instead.")
|
"This command has been deprecated. Please use 'subcloud deploy config' instead."
|
||||||
|
)
|
||||||
|
|
||||||
def _get_format_function(self):
|
def _get_format_function(self):
|
||||||
return detail_format
|
return detail_format
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument_group(
|
parser.add_argument_group(title="Notice", description=self.DEPRECATION_MESSAGE)
|
||||||
title="Notice", description=self.DEPRECATION_MESSAGE
|
|
||||||
)
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, parsed_args):
|
def _get_resources(self, parsed_args):
|
||||||
@@ -788,17 +777,16 @@ class ReconfigSubcloud(base.DCManagerShowOne):
|
|||||||
class ReinstallSubcloud(base.DCManagerShowOne):
|
class ReinstallSubcloud(base.DCManagerShowOne):
|
||||||
"""Reinstall a subcloud."""
|
"""Reinstall a subcloud."""
|
||||||
|
|
||||||
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
DEPRECATION_MESSAGE = (
|
||||||
"'subcloud redeploy' instead.")
|
"This command has been deprecated. Please use 'subcloud redeploy' instead."
|
||||||
|
)
|
||||||
|
|
||||||
def _get_format_function(self):
|
def _get_format_function(self):
|
||||||
return detail_format
|
return detail_format
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument_group(
|
parser.add_argument_group(title="Notice", description=self.DEPRECATION_MESSAGE)
|
||||||
title="Notice", description=self.DEPRECATION_MESSAGE
|
|
||||||
)
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, parsed_args):
|
def _get_resources(self, parsed_args):
|
||||||
@@ -814,9 +802,7 @@ class RedeploySubcloud(base.DCManagerShowOne):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("subcloud", help="Name or ID of the subcloud to redeploy.")
|
||||||
"subcloud", help="Name or ID of the subcloud to redeploy."
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--install-values",
|
"--install-values",
|
||||||
@@ -891,9 +877,7 @@ class RedeploySubcloud(base.DCManagerShowOne):
|
|||||||
# Get the deploy config yaml file
|
# Get the deploy config yaml file
|
||||||
if parsed_args.deploy_config is not None:
|
if parsed_args.deploy_config is not None:
|
||||||
if not os.path.isfile(parsed_args.deploy_config):
|
if not os.path.isfile(parsed_args.deploy_config):
|
||||||
error_msg = (
|
error_msg = f"deploy-config does not exist: {parsed_args.deploy_config}"
|
||||||
f"deploy-config does not exist: {parsed_args.deploy_config}"
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(error_msg)
|
raise exceptions.DCManagerClientException(error_msg)
|
||||||
files["deploy_config"] = parsed_args.deploy_config
|
files["deploy_config"] = parsed_args.deploy_config
|
||||||
|
|
||||||
@@ -923,9 +907,7 @@ class RedeploySubcloud(base.DCManagerShowOne):
|
|||||||
"WARNING: This will redeploy the subcloud. "
|
"WARNING: This will redeploy the subcloud. "
|
||||||
"All applications and data on the subcloud will be lost."
|
"All applications and data on the subcloud will be lost."
|
||||||
)
|
)
|
||||||
confirm = (
|
confirm = six.moves.input('Please type "redeploy" to confirm: ').strip().lower()
|
||||||
six.moves.input('Please type "redeploy" to confirm: ').strip().lower()
|
|
||||||
)
|
|
||||||
if confirm == "redeploy":
|
if confirm == "redeploy":
|
||||||
try:
|
try:
|
||||||
return subcloud_manager.redeploy_subcloud(
|
return subcloud_manager.redeploy_subcloud(
|
||||||
@@ -943,17 +925,17 @@ class RedeploySubcloud(base.DCManagerShowOne):
|
|||||||
class RestoreSubcloud(base.DCManagerShowOne):
|
class RestoreSubcloud(base.DCManagerShowOne):
|
||||||
"""Restore a subcloud."""
|
"""Restore a subcloud."""
|
||||||
|
|
||||||
DEPRECATION_MESSAGE = ("This command has been deprecated. Please use "
|
DEPRECATION_MESSAGE = (
|
||||||
"subcloud-backup restore instead.")
|
"This command has been deprecated. Please use "
|
||||||
|
"subcloud-backup restore instead."
|
||||||
|
)
|
||||||
|
|
||||||
def _get_format_function(self):
|
def _get_format_function(self):
|
||||||
return detail_format
|
return detail_format
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument_group(
|
parser.add_argument_group(title="Notice", description=self.DEPRECATION_MESSAGE)
|
||||||
title="Notice", description=self.DEPRECATION_MESSAGE
|
|
||||||
)
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def _get_resources(self, parsed_args):
|
def _get_resources(self, parsed_args):
|
||||||
@@ -976,9 +958,7 @@ class PrestageSubcloud(base.DCManagerShowOne):
|
|||||||
"if not provided you will be prompted.",
|
"if not provided you will be prompted.",
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument("subcloud", help="Name or ID of the subcloud to prestage.")
|
||||||
"subcloud", help="Name or ID of the subcloud to prestage."
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--force",
|
"--force",
|
||||||
@@ -1000,9 +980,7 @@ class PrestageSubcloud(base.DCManagerShowOne):
|
|||||||
"--for-install",
|
"--for-install",
|
||||||
required=False,
|
required=False,
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help=(
|
help=("Prestage for installation. This is the default prestaging option."),
|
||||||
"Prestage for installation. This is the default prestaging option."
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
# Prestaging for deployment means prestaging for upgrade
|
# Prestaging for deployment means prestaging for upgrade
|
||||||
# With USM there is no install phase for upgrades. This operation
|
# With USM there is no install phase for upgrades. This operation
|
||||||
|
@@ -218,8 +218,7 @@ class ListSubcloudPeerGroupSubclouds(base.DCManagerLister):
|
|||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"group",
|
"group",
|
||||||
help="Name or ID of subcloud peer group to list "
|
help="Name or ID of subcloud peer group to list " "associated subclouds.",
|
||||||
"associated subclouds.",
|
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
@@ -38,9 +38,7 @@ class SwPrestageManagerMixin:
|
|||||||
if prestage_software_version:
|
if prestage_software_version:
|
||||||
# Insert the 'software version' field before the 'state',
|
# Insert the 'software version' field before the 'state',
|
||||||
# 'created_at' and 'updated_at' fields if it's present
|
# 'created_at' and 'updated_at' fields if it's present
|
||||||
columns = (
|
columns = columns[:-3] + ("prestage software version",) + columns[-3:]
|
||||||
columns[:-3] + ("prestage software version",) + columns[-3:]
|
|
||||||
)
|
|
||||||
data = data[:-3] + (prestage_software_version,) + data[-3:]
|
data = data[:-3] + (prestage_software_version,) + data[-3:]
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
@@ -83,9 +81,7 @@ class CreateSwPrestageStrategy(
|
|||||||
"--for-install",
|
"--for-install",
|
||||||
required=False,
|
required=False,
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help=(
|
help=("Prestage for installation. This is the default prestaging option."),
|
||||||
"Prestage for installation. This is the default prestaging option."
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
# Prestaging for deployment means prestaging for upgrade
|
# Prestaging for deployment means prestaging for upgrade
|
||||||
# For this operation, there is NO INSTALL phase anymore with USM
|
# For this operation, there is NO INSTALL phase anymore with USM
|
||||||
|
@@ -180,9 +180,7 @@ class CreateSwUpdateStrategy(base.DCManagerShowOne):
|
|||||||
"""When specifying a group, other inputs are considered invalid"""
|
"""When specifying a group, other inputs are considered invalid"""
|
||||||
if parsed_args.group:
|
if parsed_args.group:
|
||||||
if parsed_args.cloud_name:
|
if parsed_args.cloud_name:
|
||||||
error_msg = (
|
error_msg = "The cloud_name and group options are mutually exclusive."
|
||||||
"The cloud_name and group options are mutually exclusive."
|
|
||||||
)
|
|
||||||
raise exceptions.DCManagerClientException(error_msg)
|
raise exceptions.DCManagerClientException(error_msg)
|
||||||
if parsed_args.subcloud_apply_type:
|
if parsed_args.subcloud_apply_type:
|
||||||
error_msg = (
|
error_msg = (
|
||||||
|
@@ -23,7 +23,6 @@ DEFAULT_REGION_NAME = "RegionOne"
|
|||||||
|
|
||||||
|
|
||||||
def options_detail_format(sw_update_options=None):
|
def options_detail_format(sw_update_options=None):
|
||||||
|
|
||||||
columns = (
|
columns = (
|
||||||
"cloud",
|
"cloud",
|
||||||
"storage apply type",
|
"storage apply type",
|
||||||
|
@@ -162,16 +162,14 @@ class AddSystemPeer(base.DCManagerShowOne):
|
|||||||
"--heartbeat-interval",
|
"--heartbeat-interval",
|
||||||
required=False,
|
required=False,
|
||||||
default=60,
|
default=60,
|
||||||
help="Interval between heartbeat messages (in seconds) (default \
|
help="Interval between heartbeat messages (in seconds) (default 60).",
|
||||||
60).",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--heartbeat-failure-threshold",
|
"--heartbeat-failure-threshold",
|
||||||
required=False,
|
required=False,
|
||||||
default=3,
|
default=3,
|
||||||
help="Consecutive heartbeat failures before failure declared \
|
help="Consecutive heartbeat failures before failure declared (default 3).",
|
||||||
(default 3).",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@@ -186,8 +184,10 @@ class AddSystemPeer(base.DCManagerShowOne):
|
|||||||
"--heartbeat-maintenance-timeout",
|
"--heartbeat-maintenance-timeout",
|
||||||
required=False,
|
required=False,
|
||||||
default=600,
|
default=600,
|
||||||
help="Overall failure timeout during maintenance state (in \
|
help=(
|
||||||
seconds) (default 600).",
|
"Overall failure timeout during maintenance state (in seconds) "
|
||||||
|
"(default 600)."
|
||||||
|
),
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@@ -272,8 +272,8 @@ class ListSystemPeerSubcloudPeerGroups(base.DCManagerLister):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"peer",
|
"peer",
|
||||||
help=(
|
help=(
|
||||||
"Name or ID or UUID of system peer to list "
|
"Name or ID or UUID of system peer to list associated subcloud peer "
|
||||||
"associated subcloud peer groups."
|
"groups."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
@@ -380,16 +380,13 @@ class UpdateSystemPeer(base.DCManagerShowOne):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--heartbeat-interval",
|
"--heartbeat-interval",
|
||||||
required=False,
|
required=False,
|
||||||
help=("Interval between heartbeat messages (in seconds) (default 60)."),
|
help="Interval between heartbeat messages (in seconds) (default 60).",
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--heartbeat-failure-threshold",
|
"--heartbeat-failure-threshold",
|
||||||
required=False,
|
required=False,
|
||||||
help=(
|
help="Consecutive heartbeat failures before failure declared (default 3).",
|
||||||
"Consecutive heartbeat failures before failure declared "
|
|
||||||
"(default 3)."
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2017, 2019, 2021 Wind River Systems, Inc.
|
# Copyright (c) 2017, 2019, 2021, 2024 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -21,31 +21,26 @@ from osc_lib import utils
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_DCMANAGER_API_VERSION = '1'
|
DEFAULT_DCMANAGER_API_VERSION = "1"
|
||||||
API_VERSION_OPTION = 'os_dcmanager_api_version'
|
API_VERSION_OPTION = "os_dcmanager_api_version"
|
||||||
API_NAME = 'dcmanager'
|
API_NAME = "dcmanager"
|
||||||
API_VERSIONS = {
|
API_VERSIONS = {
|
||||||
'1': 'dcmanagerclient.api.v1.client.Client',
|
"1": "dcmanagerclient.api.v1.client.Client",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def make_client(instance):
|
def make_client(instance):
|
||||||
"""Return a dcmanager client."""
|
"""Return a dcmanager client."""
|
||||||
version = instance._api_version[API_NAME]
|
version = instance._api_version[API_NAME]
|
||||||
dcmanager_client = utils.get_client_class(
|
dcmanager_client = utils.get_client_class(API_NAME, version, API_VERSIONS)
|
||||||
API_NAME,
|
|
||||||
version,
|
|
||||||
API_VERSIONS)
|
|
||||||
|
|
||||||
LOG.debug('Instantiating dcmanager client: %s', dcmanager_client)
|
LOG.debug("Instantiating dcmanager client: %s", dcmanager_client)
|
||||||
|
|
||||||
dcmanager_url = instance.get_endpoint_for_service_type(
|
dcmanager_url = instance.get_endpoint_for_service_type(
|
||||||
'dcmanager',
|
"dcmanager", interface="publicURL"
|
||||||
interface='publicURL'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
client = dcmanager_client(dcmanager_url=dcmanager_url,
|
client = dcmanager_client(dcmanager_url=dcmanager_url, session=instance.session)
|
||||||
session=instance.session)
|
|
||||||
|
|
||||||
return client
|
return client
|
||||||
|
|
||||||
@@ -53,13 +48,14 @@ def make_client(instance):
|
|||||||
def build_option_parser(parser):
|
def build_option_parser(parser):
|
||||||
"""Hook to add global options."""
|
"""Hook to add global options."""
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--os-dcmanager-api-version',
|
"--os-dcmanager-api-version",
|
||||||
metavar='<dcmanager-api-version>',
|
metavar="<dcmanager-api-version>",
|
||||||
default=utils.env(
|
default=utils.env(
|
||||||
'OS_DCMANAGER_API_VERSION',
|
"OS_DCMANAGER_API_VERSION", default=DEFAULT_DCMANAGER_API_VERSION
|
||||||
default=DEFAULT_DCMANAGER_API_VERSION),
|
),
|
||||||
help='DCMANAGER API version, default=' +
|
help="DCMANAGER API version, default="
|
||||||
DEFAULT_DCMANAGER_API_VERSION +
|
+ DEFAULT_DCMANAGER_API_VERSION
|
||||||
' (Env: OS_DCMANAGER_API_VERSION)')
|
+ " (Env: OS_DCMANAGER_API_VERSION)",
|
||||||
|
)
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
@@ -23,7 +23,8 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from cliff import app, commandmanager
|
from cliff import app
|
||||||
|
from cliff import commandmanager
|
||||||
from cliff import help as cliff_help
|
from cliff import help as cliff_help
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
|
|
||||||
@@ -146,7 +147,6 @@ class BashCompletionCommand(command.Command):
|
|||||||
|
|
||||||
|
|
||||||
class DCManagerShell(app.App):
|
class DCManagerShell(app.App):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
description=__doc__.strip(),
|
description=__doc__.strip(),
|
||||||
|
@@ -201,12 +201,10 @@ DEPLOY_STATUS_IDX = SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID.index(DEPLOY_STATUS)
|
|||||||
SUBCLOUD_ALL_FIELDS_RESULT_LIST = (
|
SUBCLOUD_ALL_FIELDS_RESULT_LIST = (
|
||||||
SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID[: DEPLOY_STATUS_IDX + 1]
|
SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID[: DEPLOY_STATUS_IDX + 1]
|
||||||
+ (SYNC,)
|
+ (SYNC,)
|
||||||
+ SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID[DEPLOY_STATUS_IDX + 1:]
|
+ SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID[DEPLOY_STATUS_IDX + 1 :]
|
||||||
)
|
)
|
||||||
|
|
||||||
EMPTY_SUBCLOUD_ALL_FIELDS_RESULT = (
|
EMPTY_SUBCLOUD_ALL_FIELDS_RESULT = (("<none>",) * len(SUBCLOUD_ALL_FIELDS_RESULT_LIST),)
|
||||||
("<none>",) * len(SUBCLOUD_ALL_FIELDS_RESULT_LIST),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Subcloud result values returned from subcloud list command
|
# Subcloud result values returned from subcloud list command
|
||||||
SUBCLOUD_LIST_RESULT = (
|
SUBCLOUD_LIST_RESULT = (
|
||||||
|
@@ -25,7 +25,6 @@ from dcmanagerclient import shell
|
|||||||
|
|
||||||
|
|
||||||
class BaseShellTests(testtools.TestCase):
|
class BaseShellTests(testtools.TestCase):
|
||||||
|
|
||||||
def shell(self, argstr):
|
def shell(self, argstr):
|
||||||
orig = (sys.stdout, sys.stderr)
|
orig = (sys.stdout, sys.stderr)
|
||||||
clean_env = {}
|
clean_env = {}
|
||||||
|
@@ -48,9 +48,7 @@ class BaseClientTests(testtools.TestCase):
|
|||||||
project_id = keystone_session_instance.get_project_id.return_value = str(
|
project_id = keystone_session_instance.get_project_id.return_value = str(
|
||||||
uuid.uuid4()
|
uuid.uuid4()
|
||||||
)
|
)
|
||||||
user_id = keystone_session_instance.get_user_id.return_value = str(
|
user_id = keystone_session_instance.get_user_id.return_value = str(uuid.uuid4())
|
||||||
uuid.uuid4()
|
|
||||||
)
|
|
||||||
keystone_session_instance.get_endpoint.return_value = DCMANAGER_HTTP_URL
|
keystone_session_instance.get_endpoint.return_value = DCMANAGER_HTTP_URL
|
||||||
|
|
||||||
expected_args = (DCMANAGER_HTTP_URL, token, project_id, user_id)
|
expected_args = (DCMANAGER_HTTP_URL, token, project_id, user_id)
|
||||||
@@ -78,9 +76,7 @@ class BaseClientTests(testtools.TestCase):
|
|||||||
project_id = keystone_session_instance.get_project_id.return_value = str(
|
project_id = keystone_session_instance.get_project_id.return_value = str(
|
||||||
uuid.uuid4()
|
uuid.uuid4()
|
||||||
)
|
)
|
||||||
user_id = keystone_session_instance.get_user_id.return_value = str(
|
user_id = keystone_session_instance.get_user_id.return_value = str(uuid.uuid4())
|
||||||
uuid.uuid4()
|
|
||||||
)
|
|
||||||
keystone_session_instance.get_endpoint.return_value = DCMANAGER_HTTP_URL
|
keystone_session_instance.get_endpoint.return_value = DCMANAGER_HTTP_URL
|
||||||
|
|
||||||
expected_args = (DCMANAGER_HTTPS_URL, token, project_id, user_id)
|
expected_args = (DCMANAGER_HTTPS_URL, token, project_id, user_id)
|
||||||
@@ -104,18 +100,14 @@ class BaseClientTests(testtools.TestCase):
|
|||||||
|
|
||||||
@mock.patch("keystoneauth1.session.Session")
|
@mock.patch("keystoneauth1.session.Session")
|
||||||
@mock.patch("dcmanagerclient.api.httpclient.HTTPClient")
|
@mock.patch("dcmanagerclient.api.httpclient.HTTPClient")
|
||||||
def test_dcmanager_url_https_secure(
|
def test_dcmanager_url_https_secure(self, mock_client, mock_keystone_auth_session):
|
||||||
self, mock_client, mock_keystone_auth_session
|
|
||||||
):
|
|
||||||
fd, path = tempfile.mkstemp(suffix=".pem")
|
fd, path = tempfile.mkstemp(suffix=".pem")
|
||||||
keystone_session_instance = mock_keystone_auth_session.return_value
|
keystone_session_instance = mock_keystone_auth_session.return_value
|
||||||
token = keystone_session_instance.get_token.return_value = str(uuid.uuid4())
|
token = keystone_session_instance.get_token.return_value = str(uuid.uuid4())
|
||||||
project_id = keystone_session_instance.get_project_id.return_value = str(
|
project_id = keystone_session_instance.get_project_id.return_value = str(
|
||||||
uuid.uuid4()
|
uuid.uuid4()
|
||||||
)
|
)
|
||||||
user_id = keystone_session_instance.get_user_id.return_value = str(
|
user_id = keystone_session_instance.get_user_id.return_value = str(uuid.uuid4())
|
||||||
uuid.uuid4()
|
|
||||||
)
|
|
||||||
keystone_session_instance.get_endpoint.return_value = DCMANAGER_HTTPS_URL
|
keystone_session_instance.get_endpoint.return_value = DCMANAGER_HTTPS_URL
|
||||||
|
|
||||||
expected_args = (DCMANAGER_HTTPS_URL, token, project_id, user_id)
|
expected_args = (DCMANAGER_HTTPS_URL, token, project_id, user_id)
|
||||||
@@ -182,17 +174,13 @@ class BaseClientTests(testtools.TestCase):
|
|||||||
|
|
||||||
@mock.patch("keystoneauth1.session.Session")
|
@mock.patch("keystoneauth1.session.Session")
|
||||||
@mock.patch("dcmanagerclient.api.httpclient.HTTPClient")
|
@mock.patch("dcmanagerclient.api.httpclient.HTTPClient")
|
||||||
def test_dcmanager_profile_enabled(
|
def test_dcmanager_profile_enabled(self, mock_client, mock_keystone_auth_session):
|
||||||
self, mock_client, mock_keystone_auth_session
|
|
||||||
):
|
|
||||||
keystone_session_instance = mock_keystone_auth_session.return_value
|
keystone_session_instance = mock_keystone_auth_session.return_value
|
||||||
token = keystone_session_instance.get_token.return_value = str(uuid.uuid4())
|
token = keystone_session_instance.get_token.return_value = str(uuid.uuid4())
|
||||||
project_id = keystone_session_instance.get_project_id.return_value = str(
|
project_id = keystone_session_instance.get_project_id.return_value = str(
|
||||||
uuid.uuid4()
|
uuid.uuid4()
|
||||||
)
|
)
|
||||||
user_id = keystone_session_instance.get_user_id.return_value = str(
|
user_id = keystone_session_instance.get_user_id.return_value = str(uuid.uuid4())
|
||||||
uuid.uuid4()
|
|
||||||
)
|
|
||||||
keystone_session_instance.get_endpoint.return_value = DCMANAGER_HTTP_URL
|
keystone_session_instance.get_endpoint.return_value = DCMANAGER_HTTP_URL
|
||||||
|
|
||||||
expected_args = (DCMANAGER_HTTP_URL, token, project_id, user_id)
|
expected_args = (DCMANAGER_HTTP_URL, token, project_id, user_id)
|
||||||
|
@@ -19,7 +19,6 @@ from dcmanagerclient.tests import base_shell_test as base
|
|||||||
|
|
||||||
|
|
||||||
class TestShell(base.BaseShellTests):
|
class TestShell(base.BaseShellTests):
|
||||||
|
|
||||||
@mock.patch("dcmanagerclient.api.client.determine_client_version")
|
@mock.patch("dcmanagerclient.api.client.determine_client_version")
|
||||||
def test_dcmanager_version(self, mock_client_version):
|
def test_dcmanager_version(self, mock_client_version):
|
||||||
self.shell("--os-dcmanager-version=v1 quota-defaults")
|
self.shell("--os-dcmanager-version=v1 quota-defaults")
|
||||||
|
@@ -27,7 +27,6 @@ ENV_YAML = yaml.safe_dump(ENV_DICT, default_flow_style=False)
|
|||||||
|
|
||||||
|
|
||||||
class UtilityTest(testtools.TestCase):
|
class UtilityTest(testtools.TestCase):
|
||||||
|
|
||||||
def test_load_empty(self):
|
def test_load_empty(self):
|
||||||
self.assertDictEqual({}, utils.load_content(None))
|
self.assertDictEqual({}, utils.load_content(None))
|
||||||
self.assertDictEqual({}, utils.load_content(""))
|
self.assertDictEqual({}, utils.load_content(""))
|
||||||
|
@@ -28,7 +28,6 @@ ALARM_SUMMARY = AlarmSummary(
|
|||||||
|
|
||||||
|
|
||||||
class TestCLIAlarmSummaryV1(base.BaseCommandTest):
|
class TestCLIAlarmSummaryV1(base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
# The client is the alarm_manager
|
# The client is the alarm_manager
|
||||||
|
@@ -10,7 +10,6 @@ from dcmanagerclient.tests.v1.mixins import UpdateStrategyMixin
|
|||||||
|
|
||||||
|
|
||||||
class TestFwUpdateStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
class TestFwUpdateStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.sw_update_manager = self.app.client_manager.fw_update_manager
|
self.sw_update_manager = self.app.client_manager.fw_update_manager
|
||||||
|
@@ -10,7 +10,6 @@ from dcmanagerclient.tests.v1.mixins import UpdateStrategyMixin
|
|||||||
|
|
||||||
|
|
||||||
class TestKubeRootcaUpdateStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
class TestKubeRootcaUpdateStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.sw_update_manager = self.app.client_manager.kube_rootca_update_manager
|
self.sw_update_manager = self.app.client_manager.kube_rootca_update_manager
|
||||||
|
@@ -10,7 +10,6 @@ from dcmanagerclient.tests.v1.mixins import UpdateStrategyMixin
|
|||||||
|
|
||||||
|
|
||||||
class TestKubeUpgradeStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
class TestKubeUpgradeStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.sw_update_manager = self.app.client_manager.kube_upgrade_manager
|
self.sw_update_manager = self.app.client_manager.kube_upgrade_manager
|
||||||
|
@@ -12,7 +12,6 @@ from dcmanagerclient.tests.v1.mixins import UpdateStrategyMixin
|
|||||||
|
|
||||||
|
|
||||||
class TestPatchUpdateStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
class TestPatchUpdateStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|
||||||
@@ -35,9 +34,7 @@ class TestPatchUpdateStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
|||||||
|
|
||||||
# mock the result of the API call
|
# mock the result of the API call
|
||||||
strategy = utils.make_strategy(
|
strategy = utils.make_strategy(
|
||||||
strategy_type=self.expected_strategy_type, extra_args={
|
strategy_type=self.expected_strategy_type, extra_args={"upload-only": True}
|
||||||
"upload-only": True
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# mock that there is no pre-existing strategy
|
# mock that there is no pre-existing strategy
|
||||||
|
@@ -77,9 +77,7 @@ class TestCLIPeerGroupAssociationV1(base.BaseCommandTest):
|
|||||||
self.client = self.app.client_manager.peer_group_association_manager
|
self.client = self.app.client_manager.peer_group_association_manager
|
||||||
|
|
||||||
def test_list_peer_group_association(self):
|
def test_list_peer_group_association(self):
|
||||||
self.client.list_peer_group_associations.return_value = [
|
self.client.list_peer_group_associations.return_value = [PEER_GROUP_ASSOCIATION]
|
||||||
PEER_GROUP_ASSOCIATION
|
|
||||||
]
|
|
||||||
actual_call = self.call(peer_group_association_cmd.ListPeerGroupAssociation)
|
actual_call = self.call(peer_group_association_cmd.ListPeerGroupAssociation)
|
||||||
self.assertEqual([PEER_GROUP_ASSOCIATION_TUPLE], actual_call[1])
|
self.assertEqual([PEER_GROUP_ASSOCIATION_TUPLE], actual_call[1])
|
||||||
|
|
||||||
@@ -92,9 +90,7 @@ class TestCLIPeerGroupAssociationV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_add_peer_group_association(self):
|
def test_add_peer_group_association(self):
|
||||||
self.client.add_peer_group_association.return_value = [
|
self.client.add_peer_group_association.return_value = [PEER_GROUP_ASSOCIATION]
|
||||||
PEER_GROUP_ASSOCIATION
|
|
||||||
]
|
|
||||||
actual_call = self.call(
|
actual_call = self.call(
|
||||||
peer_group_association_cmd.AddPeerGroupAssociation,
|
peer_group_association_cmd.AddPeerGroupAssociation,
|
||||||
app_args=[
|
app_args=[
|
||||||
@@ -159,9 +155,7 @@ class TestCLIPeerGroupAssociationV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
def test_update_peer_group_association(self):
|
def test_update_peer_group_association(self):
|
||||||
updated_peed_group_association = copy.copy(PEER_GROUP_ASSOCIATION)
|
updated_peed_group_association = copy.copy(PEER_GROUP_ASSOCIATION)
|
||||||
updated_peed_group_association.peer_group_priority = (
|
updated_peed_group_association.peer_group_priority = PG_GROUP_PRIORITY_UPDATED
|
||||||
PG_GROUP_PRIORITY_UPDATED
|
|
||||||
)
|
|
||||||
self.client.update_peer_group_association.return_value = [
|
self.client.update_peer_group_association.return_value = [
|
||||||
updated_peed_group_association
|
updated_peed_group_association
|
||||||
]
|
]
|
||||||
@@ -187,9 +181,7 @@ class TestCLIPeerGroupAssociationV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_sync_peer_group_association(self):
|
def test_sync_peer_group_association(self):
|
||||||
self.client.sync_peer_group_association.return_value = [
|
self.client.sync_peer_group_association.return_value = [PEER_GROUP_ASSOCIATION]
|
||||||
PEER_GROUP_ASSOCIATION
|
|
||||||
]
|
|
||||||
actual_call = self.call(
|
actual_call = self.call(
|
||||||
peer_group_association_cmd.SyncPeerGroupAssociation,
|
peer_group_association_cmd.SyncPeerGroupAssociation,
|
||||||
app_args=[PEER_GROUP_ASSOCIATION_ID],
|
app_args=[PEER_GROUP_ASSOCIATION_ID],
|
||||||
|
@@ -17,7 +17,6 @@ from dcmanagerclient.tests import base
|
|||||||
|
|
||||||
@mock.patch("getpass.getpass", new=mock.Mock(return_value="testpassword"))
|
@mock.patch("getpass.getpass", new=mock.Mock(return_value="testpassword"))
|
||||||
class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
# The client is the subcloud_deploy_manager
|
# The client is the subcloud_deploy_manager
|
||||||
@@ -33,7 +32,6 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
) as config_file, tempfile.NamedTemporaryFile(
|
) as config_file, tempfile.NamedTemporaryFile(
|
||||||
mode="w"
|
mode="w"
|
||||||
) as install_file:
|
) as install_file:
|
||||||
|
|
||||||
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
||||||
config_file_path = os.path.abspath(config_file.name)
|
config_file_path = os.path.abspath(config_file.name)
|
||||||
install_file_path = os.path.abspath(install_file.name)
|
install_file_path = os.path.abspath(install_file.name)
|
||||||
@@ -110,9 +108,7 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
def test_install_subcloud_without_install_values(self):
|
def test_install_subcloud_without_install_values(self):
|
||||||
self.client.subcloud_deploy_install.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.subcloud_deploy_install.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
|
|
||||||
actual_call = self.call(
|
actual_call = self.call(cmd.InstallPhasedSubcloudDeploy, app_args=[base.NAME])
|
||||||
cmd.InstallPhasedSubcloudDeploy, app_args=[base.NAME]
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
|
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
|
||||||
|
|
||||||
@@ -156,9 +152,7 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
def test_complete_subcloud_deployment(self):
|
def test_complete_subcloud_deployment(self):
|
||||||
self.client.subcloud_deploy_complete.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.subcloud_deploy_complete.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
actual_call = self.call(
|
actual_call = self.call(cmd.CompletePhasedSubcloudDeploy, app_args=[base.NAME])
|
||||||
cmd.CompletePhasedSubcloudDeploy, app_args=[base.NAME]
|
|
||||||
)
|
|
||||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
|
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
|
||||||
|
|
||||||
def test_abort_subcloud(self):
|
def test_abort_subcloud(self):
|
||||||
@@ -176,7 +170,6 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
) as config_file, tempfile.NamedTemporaryFile(
|
) as config_file, tempfile.NamedTemporaryFile(
|
||||||
mode="w"
|
mode="w"
|
||||||
) as install_file:
|
) as install_file:
|
||||||
|
|
||||||
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
||||||
config_file_path = os.path.abspath(config_file.name)
|
config_file_path = os.path.abspath(config_file.name)
|
||||||
install_file_path = os.path.abspath(install_file.name)
|
install_file_path = os.path.abspath(install_file.name)
|
||||||
@@ -209,7 +202,6 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
) as config_file, tempfile.NamedTemporaryFile(
|
) as config_file, tempfile.NamedTemporaryFile(
|
||||||
mode="w"
|
mode="w"
|
||||||
) as install_file:
|
) as install_file:
|
||||||
|
|
||||||
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
||||||
config_file_path = os.path.abspath(config_file.name)
|
config_file_path = os.path.abspath(config_file.name)
|
||||||
install_file_path = os.path.abspath(install_file.name)
|
install_file_path = os.path.abspath(install_file.name)
|
||||||
@@ -276,7 +268,7 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
self.client.subcloud_deploy_enroll.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.subcloud_deploy_enroll.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile(
|
with tempfile.NamedTemporaryFile(
|
||||||
mode="w"
|
mode="w"
|
||||||
) as bootstrap_file, tempfile.NamedTemporaryFile(
|
) as bootstrap_file, tempfile.NamedTemporaryFile(
|
||||||
mode="w"
|
mode="w"
|
||||||
) as config_file, tempfile.NamedTemporaryFile(
|
) as config_file, tempfile.NamedTemporaryFile(
|
||||||
@@ -297,7 +289,7 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
"--install-values",
|
"--install-values",
|
||||||
install_file_path,
|
install_file_path,
|
||||||
"--deploy-config",
|
"--deploy-config",
|
||||||
config_file_path
|
config_file_path,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
|
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
|
||||||
@@ -307,9 +299,7 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
actual_call = self.call(
|
actual_call = self.call(
|
||||||
cmd.EnrollPhasedSubcloudDeploy,
|
cmd.EnrollPhasedSubcloudDeploy,
|
||||||
app_args=[
|
app_args=[base.NAME],
|
||||||
base.NAME
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
|
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call[1])
|
||||||
|
|
||||||
@@ -318,10 +308,7 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
DCManagerClientException,
|
DCManagerClientException,
|
||||||
self.call, cmd.EnrollPhasedSubcloudDeploy,
|
self.call,
|
||||||
app_args=[
|
cmd.EnrollPhasedSubcloudDeploy,
|
||||||
base.ID,
|
app_args=[base.ID, "--bootstrap-values", "missing_path"],
|
||||||
"--bootstrap-values",
|
|
||||||
"missing_path"
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
@@ -33,7 +33,6 @@ TEST_UPDATED_AT = TIME_NOW
|
|||||||
|
|
||||||
|
|
||||||
class TestCLI(base.BaseCommandTest):
|
class TestCLI(base.BaseCommandTest):
|
||||||
|
|
||||||
def test_list_strategy_steps(self):
|
def test_list_strategy_steps(self):
|
||||||
sample_step = StrategyStep(
|
sample_step = StrategyStep(
|
||||||
mock,
|
mock,
|
||||||
|
@@ -23,13 +23,11 @@ OVERRIDE_VALUES = """---
|
|||||||
|
|
||||||
|
|
||||||
class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.client = self.app.client_manager.subcloud_backup_manager
|
self.client = self.app.client_manager.subcloud_backup_manager
|
||||||
|
|
||||||
def test_backup_create_subcloud(self):
|
def test_backup_create_subcloud(self):
|
||||||
|
|
||||||
self.client.backup_subcloud_create.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.backup_subcloud_create.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
|
|
||||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||||
@@ -52,7 +50,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
||||||
|
|
||||||
def test_backup_create_group(self):
|
def test_backup_create_group(self):
|
||||||
|
|
||||||
self.client.backup_subcloud_create.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.backup_subcloud_create.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
|
|
||||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||||
@@ -97,8 +94,8 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
(
|
(
|
||||||
"The command only applies to a single subcloud or a"
|
"The command only applies to a single subcloud or a subcloud group, "
|
||||||
" subcloud group, not both."
|
"not both."
|
||||||
)
|
)
|
||||||
in str(e)
|
in str(e)
|
||||||
)
|
)
|
||||||
@@ -124,8 +121,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
("Please provide the subcloud or subcloud group name" " or id.")
|
("Please provide the subcloud or subcloud group name or id.") in str(e)
|
||||||
in str(e)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_backup_create_backup_value_not_a_file(self):
|
def test_backup_create_backup_value_not_a_file(self):
|
||||||
@@ -150,7 +146,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
@mock.patch("getpass.getpass", return_value="testpassword")
|
@mock.patch("getpass.getpass", return_value="testpassword")
|
||||||
def test_backup_create_prompt_ask_for_password(self, _mock_getpass):
|
def test_backup_create_prompt_ask_for_password(self, _mock_getpass):
|
||||||
|
|
||||||
self.client.backup_subcloud_create.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.backup_subcloud_create.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
|
|
||||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||||
@@ -170,7 +165,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST], actual_call[1])
|
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST], actual_call[1])
|
||||||
|
|
||||||
def test_backup_create_local_only_registry_images(self):
|
def test_backup_create_local_only_registry_images(self):
|
||||||
|
|
||||||
self.client.subcloud_backup_manager.backup_subcloud_create.return_value = []
|
self.client.subcloud_backup_manager.backup_subcloud_create.return_value = []
|
||||||
|
|
||||||
e = self.assertRaises(
|
e = self.assertRaises(
|
||||||
@@ -189,10 +183,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
(
|
("Option --registry-images can not be used without --local-only option.")
|
||||||
"Option --registry-images can not be used without "
|
|
||||||
"--local-only option."
|
|
||||||
)
|
|
||||||
in str(e)
|
in str(e)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -212,8 +203,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
("Please provide the subcloud or subcloud group" " name or id.")
|
("Please provide the subcloud or subcloud group name or id.") in str(e)
|
||||||
in str(e)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_backup_delete_group_subcloud(self):
|
def test_backup_delete_group_subcloud(self):
|
||||||
@@ -237,14 +227,13 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
(
|
(
|
||||||
"This command only applies to a single subcloud "
|
"This command only applies to a single subcloud or a subcloud group, "
|
||||||
"or a subcloud group, not both."
|
"not both."
|
||||||
)
|
)
|
||||||
in str(e)
|
in str(e)
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_backup_delete_group(self):
|
def test_backup_delete_group(self):
|
||||||
|
|
||||||
group_name = "test_group_1"
|
group_name = "test_group_1"
|
||||||
release_version = "release_version_2"
|
release_version = "release_version_2"
|
||||||
password = "testpassword"
|
password = "testpassword"
|
||||||
@@ -273,7 +262,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_backup_delete_subcloud(self):
|
def test_backup_delete_subcloud(self):
|
||||||
|
|
||||||
subcloud_name = "subcloud1"
|
subcloud_name = "subcloud1"
|
||||||
release_version = "release_version_2"
|
release_version = "release_version_2"
|
||||||
password = "testpassword"
|
password = "testpassword"
|
||||||
@@ -302,7 +290,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_backup_delete_no_local_only(self):
|
def test_backup_delete_no_local_only(self):
|
||||||
|
|
||||||
group_name = "test_group_1"
|
group_name = "test_group_1"
|
||||||
release_version = "release_version_2"
|
release_version = "release_version_2"
|
||||||
password = "testpassword"
|
password = "testpassword"
|
||||||
@@ -331,7 +318,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
@mock.patch("getpass.getpass", return_value="testpassword")
|
@mock.patch("getpass.getpass", return_value="testpassword")
|
||||||
def test_backup_delete_prompt_ask_for_password(self, _mock_getpass):
|
def test_backup_delete_prompt_ask_for_password(self, _mock_getpass):
|
||||||
|
|
||||||
group_name = "test_group_1"
|
group_name = "test_group_1"
|
||||||
release_version = "release_version_2"
|
release_version = "release_version_2"
|
||||||
password = "testpassword"
|
password = "testpassword"
|
||||||
@@ -353,7 +339,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_backup_delete_subcloud_no_release_version(self):
|
def test_backup_delete_subcloud_no_release_version(self):
|
||||||
|
|
||||||
subcloud_name = "subcloud1"
|
subcloud_name = "subcloud1"
|
||||||
password = "testpassword"
|
password = "testpassword"
|
||||||
|
|
||||||
@@ -373,7 +358,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_backup_restore(self):
|
def test_backup_restore(self):
|
||||||
|
|
||||||
self.client.backup_subcloud_restore.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.backup_subcloud_restore.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
|
|
||||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||||
@@ -397,7 +381,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
||||||
|
|
||||||
def test_backup_restore_no_restore_values(self):
|
def test_backup_restore_no_restore_values(self):
|
||||||
|
|
||||||
self.client.backup_subcloud_restore.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.backup_subcloud_restore.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
|
|
||||||
actual_call = self.call(
|
actual_call = self.call(
|
||||||
@@ -414,7 +397,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
||||||
|
|
||||||
def test_backup_restore_with_group(self):
|
def test_backup_restore_with_group(self):
|
||||||
|
|
||||||
self.client.backup_subcloud_restore.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.backup_subcloud_restore.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
|
|
||||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||||
@@ -461,8 +443,8 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
(
|
(
|
||||||
"The command only applies to a single subcloud or a"
|
"The command only applies to a single subcloud or a subcloud group, "
|
||||||
" subcloud group, not both."
|
"not both."
|
||||||
)
|
)
|
||||||
in str(e)
|
in str(e)
|
||||||
)
|
)
|
||||||
@@ -489,8 +471,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
("Please provide the subcloud or subcloud group name" " or id.")
|
("Please provide the subcloud or subcloud group name or id.") in str(e)
|
||||||
in str(e)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_backup_restore_backup_value_not_a_file(self):
|
def test_backup_restore_backup_value_not_a_file(self):
|
||||||
@@ -515,7 +496,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
@mock.patch("getpass.getpass", return_value="testpassword")
|
@mock.patch("getpass.getpass", return_value="testpassword")
|
||||||
def test_backup_restore_prompt_ask_for_password(self, _mock_getpass):
|
def test_backup_restore_prompt_ask_for_password(self, _mock_getpass):
|
||||||
|
|
||||||
self.client.backup_subcloud_restore.return_value = [base.SUBCLOUD_RESOURCE]
|
self.client.backup_subcloud_restore.return_value = [base.SUBCLOUD_RESOURCE]
|
||||||
|
|
||||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||||
@@ -536,7 +516,6 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST], actual_call[1])
|
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST], actual_call[1])
|
||||||
|
|
||||||
def test_backup_restore_local_only_registry_images(self):
|
def test_backup_restore_local_only_registry_images(self):
|
||||||
|
|
||||||
e = self.assertRaises(
|
e = self.assertRaises(
|
||||||
DCManagerClientException,
|
DCManagerClientException,
|
||||||
self.call,
|
self.call,
|
||||||
@@ -553,10 +532,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
(
|
("Option --registry-images cannot be used without --local-only option.")
|
||||||
"Option --registry-images cannot be used without "
|
|
||||||
"--local-only option."
|
|
||||||
)
|
|
||||||
in str(e)
|
in str(e)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -636,6 +612,5 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
("Option --release cannot be used without " "--with-install option.")
|
("Option --release cannot be used without --with-install option.") in str(e)
|
||||||
in str(e)
|
|
||||||
)
|
)
|
||||||
|
@@ -76,7 +76,6 @@ SUBCLOUD_DEPLOY_NO_OVERRIDES_CHART = sdm.SubcloudDeploy(
|
|||||||
|
|
||||||
|
|
||||||
class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
# The client is the subcloud_deploy_manager
|
# The client is the subcloud_deploy_manager
|
||||||
@@ -155,9 +154,7 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_subcloud_deploy_upload_no_prestage(self):
|
def test_subcloud_deploy_upload_no_prestage(self):
|
||||||
self.client.subcloud_deploy_upload.return_value = [
|
self.client.subcloud_deploy_upload.return_value = [SUBCLOUD_DEPLOY_NO_PRESTAGE]
|
||||||
SUBCLOUD_DEPLOY_NO_PRESTAGE
|
|
||||||
]
|
|
||||||
|
|
||||||
f1 = tempfile.NamedTemporaryFile()
|
f1 = tempfile.NamedTemporaryFile()
|
||||||
f2 = tempfile.NamedTemporaryFile()
|
f2 = tempfile.NamedTemporaryFile()
|
||||||
@@ -205,9 +202,7 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_subcloud_deploy_upload_no_playbook(self):
|
def test_subcloud_deploy_upload_no_playbook(self):
|
||||||
self.client.subcloud_deploy_upload.return_value = [
|
self.client.subcloud_deploy_upload.return_value = [SUBCLOUD_DEPLOY_NO_PLAYBOOK]
|
||||||
SUBCLOUD_DEPLOY_NO_PLAYBOOK
|
|
||||||
]
|
|
||||||
|
|
||||||
f1 = tempfile.NamedTemporaryFile()
|
f1 = tempfile.NamedTemporaryFile()
|
||||||
f2 = tempfile.NamedTemporaryFile()
|
f2 = tempfile.NamedTemporaryFile()
|
||||||
@@ -305,9 +300,7 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
@mock.patch("builtins.print")
|
@mock.patch("builtins.print")
|
||||||
def test_subcloud_deploy_upload_invalid_path(self, mock_print):
|
def test_subcloud_deploy_upload_invalid_path(self, mock_print):
|
||||||
self.client.subcloud_deploy_upload.return_value = [
|
self.client.subcloud_deploy_upload.return_value = [SUBCLOUD_DEPLOY_NO_PRESTAGE]
|
||||||
SUBCLOUD_DEPLOY_NO_PRESTAGE
|
|
||||||
]
|
|
||||||
mock_print.return_value = mock.ANY
|
mock_print.return_value = mock.ANY
|
||||||
file_path_1 = "not_a_valid_path"
|
file_path_1 = "not_a_valid_path"
|
||||||
|
|
||||||
@@ -337,7 +330,6 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_subcloud_deploy_delete_with_release(self):
|
def test_subcloud_deploy_delete_with_release(self):
|
||||||
|
|
||||||
release_version = base.SOFTWARE_VERSION
|
release_version = base.SOFTWARE_VERSION
|
||||||
data = {"prestage_images": "False", "deployment_files": "False"}
|
data = {"prestage_images": "False", "deployment_files": "False"}
|
||||||
app_args = ["--release", release_version]
|
app_args = ["--release", release_version]
|
||||||
@@ -349,7 +341,6 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_subcloud_deploy_delete_without_release(self):
|
def test_subcloud_deploy_delete_without_release(self):
|
||||||
|
|
||||||
self.call(subcloud_deploy_manager.SubcloudDeployDelete)
|
self.call(subcloud_deploy_manager.SubcloudDeployDelete)
|
||||||
data = {"prestage_images": "False", "deployment_files": "False"}
|
data = {"prestage_images": "False", "deployment_files": "False"}
|
||||||
self.client.subcloud_deploy_delete.assert_called_once_with(None, data=data)
|
self.client.subcloud_deploy_delete.assert_called_once_with(None, data=data)
|
||||||
|
@@ -54,7 +54,6 @@ SUBCLOUD_GROUP = zm.SubcloudGroup(
|
|||||||
|
|
||||||
|
|
||||||
class TestCLISubcloudGroupManagerV1(base.BaseCommandTest):
|
class TestCLISubcloudGroupManagerV1(base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
# The client is the subcloud_group_manager
|
# The client is the subcloud_group_manager
|
||||||
@@ -78,9 +77,7 @@ class TestCLISubcloudGroupManagerV1(base.BaseCommandTest):
|
|||||||
subcloud_group_cmd.ListSubcloudGroupSubclouds, app_args=[ID]
|
subcloud_group_cmd.ListSubcloudGroupSubclouds, app_args=[ID]
|
||||||
)
|
)
|
||||||
self.client.subcloud_group_list_subclouds.assert_called_once_with(ID)
|
self.client.subcloud_group_list_subclouds.assert_called_once_with(ID)
|
||||||
self.assertEqual(
|
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID], actual_call[1])
|
||||||
[base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID], actual_call[1]
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_delete_subcloud_group_by_id(self):
|
def test_delete_subcloud_group_by_id(self):
|
||||||
self.call(subcloud_group_cmd.DeleteSubcloudGroup, app_args=[ID])
|
self.call(subcloud_group_cmd.DeleteSubcloudGroup, app_args=[ID])
|
||||||
|
@@ -27,7 +27,6 @@ from dcmanagerclient.tests import base
|
|||||||
|
|
||||||
|
|
||||||
class TestCLISubcloudManagerV1(base.BaseCommandTest):
|
class TestCLISubcloudManagerV1(base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.subcloud_resource = copy.copy(base.SUBCLOUD_RESOURCE)
|
self.subcloud_resource = copy.copy(base.SUBCLOUD_RESOURCE)
|
||||||
@@ -159,12 +158,8 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
|
|||||||
base.SOFTWARE_VERSION,
|
base.SOFTWARE_VERSION,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call1[1])
|
||||||
base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call1[1]
|
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call2[1])
|
||||||
)
|
|
||||||
self.assertEqual(
|
|
||||||
base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, actual_call2[1]
|
|
||||||
)
|
|
||||||
|
|
||||||
@mock.patch("getpass.getpass", return_value="testpassword")
|
@mock.patch("getpass.getpass", return_value="testpassword")
|
||||||
def test_add_migrate_subcloud(self, _mock_getpass):
|
def test_add_migrate_subcloud(self, _mock_getpass):
|
||||||
@@ -281,16 +276,14 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
|
|||||||
"--bootstrap-values",
|
"--bootstrap-values",
|
||||||
file_path,
|
file_path,
|
||||||
"--enroll",
|
"--enroll",
|
||||||
"--migrate"
|
"--migrate",
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_rename_subcloud(self):
|
def test_rename_subcloud(self):
|
||||||
subcloud_renamed = copy.copy(base.SUBCLOUD_RESOURCE_WITH_PEERID)
|
subcloud_renamed = copy.copy(base.SUBCLOUD_RESOURCE_WITH_PEERID)
|
||||||
subcloud_renamed.name = base.NAME_SC2
|
subcloud_renamed.name = base.NAME_SC2
|
||||||
self.client.subcloud_manager.update_subcloud.return_value = [
|
self.client.subcloud_manager.update_subcloud.return_value = [subcloud_renamed]
|
||||||
subcloud_renamed
|
|
||||||
]
|
|
||||||
|
|
||||||
# Rename by id
|
# Rename by id
|
||||||
actual_call1 = self.call(
|
actual_call1 = self.call(
|
||||||
@@ -407,7 +400,6 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
|
|||||||
) as config_file, tempfile.NamedTemporaryFile(
|
) as config_file, tempfile.NamedTemporaryFile(
|
||||||
mode="w"
|
mode="w"
|
||||||
) as install_file:
|
) as install_file:
|
||||||
|
|
||||||
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
||||||
config_file_path = os.path.abspath(config_file.name)
|
config_file_path = os.path.abspath(config_file.name)
|
||||||
install_file_path = os.path.abspath(install_file.name)
|
install_file_path = os.path.abspath(install_file.name)
|
||||||
@@ -439,9 +431,7 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
@mock.patch("getpass.getpass", return_value="testpassword")
|
@mock.patch("getpass.getpass", return_value="testpassword")
|
||||||
@mock.patch("six.moves.input", return_value="redeploy")
|
@mock.patch("six.moves.input", return_value="redeploy")
|
||||||
def test_redeploy_bootstrap_files_does_not_exists(
|
def test_redeploy_bootstrap_files_does_not_exists(self, _mock_input, _mock_getpass):
|
||||||
self, _mock_input, _mock_getpass
|
|
||||||
):
|
|
||||||
self.client.subcloud_manager.redeploy_subcloud.return_value = [
|
self.client.subcloud_manager.redeploy_subcloud.return_value = [
|
||||||
self.subcloud_resource
|
self.subcloud_resource
|
||||||
]
|
]
|
||||||
|
@@ -77,9 +77,7 @@ class TestCLISubcloudPeerGroupManager(base.BaseCommandTest):
|
|||||||
subcloud_peer_group_cmd.ListSubcloudPeerGroupSubclouds,
|
subcloud_peer_group_cmd.ListSubcloudPeerGroupSubclouds,
|
||||||
app_args=[base.ID],
|
app_args=[base.ID],
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID], actual_call[1])
|
||||||
[base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID], actual_call[1]
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_add_subcloud_peer_group(self):
|
def test_add_subcloud_peer_group(self):
|
||||||
self.client.add_subcloud_peer_group.return_value = [SubcloudPeerGroup]
|
self.client.add_subcloud_peer_group.return_value = [SubcloudPeerGroup]
|
||||||
|
@@ -11,7 +11,6 @@ from dcmanagerclient.tests.v1 import utils
|
|||||||
|
|
||||||
|
|
||||||
class TestSwDeployStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
class TestSwDeployStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|
||||||
@@ -43,9 +42,7 @@ class TestSwDeployStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
|||||||
|
|
||||||
# invoke the backend method for the CLI.
|
# invoke the backend method for the CLI.
|
||||||
# Returns a tuple of field descriptions, and a second tuple of values
|
# Returns a tuple of field descriptions, and a second tuple of values
|
||||||
fields, results = self.call(
|
fields, results = self.call(self.create_command, ["stx-24.09.1"])
|
||||||
self.create_command, ["stx-24.09.1"]
|
|
||||||
)
|
|
||||||
|
|
||||||
# results is a tuple of expected length
|
# results is a tuple of expected length
|
||||||
self.assertEqual(len(results), self.results_length)
|
self.assertEqual(len(results), self.results_length)
|
||||||
|
@@ -17,7 +17,6 @@ FAKE_RELEASE = "21.12"
|
|||||||
|
|
||||||
|
|
||||||
class TestSwPrestageStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
class TestSwPrestageStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.sw_update_manager = self.app.client_manager.sw_prestage_manager
|
self.sw_update_manager = self.app.client_manager.sw_prestage_manager
|
||||||
|
@@ -47,7 +47,6 @@ UPDATED_SW_UPDATE_OPTION = SwUpdateOptions(
|
|||||||
|
|
||||||
|
|
||||||
class TestCLISWUpdateOptionsManagerV1(base.BaseCommandTest):
|
class TestCLISWUpdateOptionsManagerV1(base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
# The client is the subcloud_group_manager
|
# The client is the subcloud_group_manager
|
||||||
@@ -115,9 +114,7 @@ class TestCLISWUpdateOptionsManagerV1(base.BaseCommandTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_update_sw_update_options(self):
|
def test_update_sw_update_options(self):
|
||||||
self.client.sw_update_options_update.return_value = [
|
self.client.sw_update_options_update.return_value = [UPDATED_SW_UPDATE_OPTION]
|
||||||
UPDATED_SW_UPDATE_OPTION
|
|
||||||
]
|
|
||||||
actual_call = self.call(
|
actual_call = self.call(
|
||||||
sw_update_options_cmd.UpdateSwUpdateOptions,
|
sw_update_options_cmd.UpdateSwUpdateOptions,
|
||||||
app_args=[
|
app_args=[
|
||||||
|
@@ -10,7 +10,6 @@ from dcmanagerclient.tests.v1.mixins import UpdateStrategyMixin
|
|||||||
|
|
||||||
|
|
||||||
class TestSwUpgradeStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
class TestSwUpgradeStrategy(UpdateStrategyMixin, base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.sw_update_manager = self.app.client_manager.sw_upgrade_manager
|
self.sw_update_manager = self.app.client_manager.sw_upgrade_manager
|
||||||
|
@@ -105,7 +105,6 @@ PG_TUPLE = (
|
|||||||
|
|
||||||
|
|
||||||
class TestCLISystemPeerManagerV1(base.BaseCommandTest):
|
class TestCLISystemPeerManagerV1(base.BaseCommandTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
# The client is the system_peer_manager
|
# The client is the system_peer_manager
|
||||||
@@ -228,9 +227,7 @@ class TestCLISystemPeerManagerV1(base.BaseCommandTest):
|
|||||||
|
|
||||||
def test_update_system_peer(self):
|
def test_update_system_peer(self):
|
||||||
updated_system_peer = copy.copy(SYSTEM_PEER)
|
updated_system_peer = copy.copy(SYSTEM_PEER)
|
||||||
updated_system_peer.peer_controller_gateway_ip = (
|
updated_system_peer.peer_controller_gateway_ip = NEW_PEER_CONTROLLER_GATEWAY_IP
|
||||||
NEW_PEER_CONTROLLER_GATEWAY_IP
|
|
||||||
)
|
|
||||||
self.client.update_system_peer.return_value = [updated_system_peer]
|
self.client.update_system_peer.return_value = [updated_system_peer]
|
||||||
actual_call = self.call(
|
actual_call = self.call(
|
||||||
system_peer_cmd.UpdateSystemPeer,
|
system_peer_cmd.UpdateSystemPeer,
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
# Copyright (c) 2020-2024 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
@@ -11,29 +11,33 @@ from oslo_utils import timeutils
|
|||||||
from dcmanagerclient.api.v1.sw_update_manager import SwUpdateStrategy
|
from dcmanagerclient.api.v1.sw_update_manager import SwUpdateStrategy
|
||||||
|
|
||||||
TIME_NOW = timeutils.utcnow().isoformat()
|
TIME_NOW = timeutils.utcnow().isoformat()
|
||||||
DEFAULT_APPLY_TYPE = 'serial'
|
DEFAULT_APPLY_TYPE = "serial"
|
||||||
DEFAULT_MAX_PARALLEL = 2
|
DEFAULT_MAX_PARALLEL = 2
|
||||||
DEFAULT_STATE = 'initial'
|
DEFAULT_STATE = "initial"
|
||||||
DEFAULT_STRATEGY_TYPE = 'patch'
|
DEFAULT_STRATEGY_TYPE = "patch"
|
||||||
|
|
||||||
|
|
||||||
def make_strategy(manager=None,
|
def make_strategy(
|
||||||
strategy_type=DEFAULT_STRATEGY_TYPE,
|
manager=None,
|
||||||
subcloud_apply_type=DEFAULT_APPLY_TYPE,
|
strategy_type=DEFAULT_STRATEGY_TYPE,
|
||||||
max_parallel_subclouds=DEFAULT_MAX_PARALLEL,
|
subcloud_apply_type=DEFAULT_APPLY_TYPE,
|
||||||
stop_on_failure=False,
|
max_parallel_subclouds=DEFAULT_MAX_PARALLEL,
|
||||||
state=DEFAULT_STATE,
|
stop_on_failure=False,
|
||||||
created_at=TIME_NOW,
|
state=DEFAULT_STATE,
|
||||||
updated_at=None,
|
created_at=TIME_NOW,
|
||||||
extra_args=None):
|
updated_at=None,
|
||||||
|
extra_args=None,
|
||||||
|
):
|
||||||
if manager is None:
|
if manager is None:
|
||||||
manager = mock.MagicMock()
|
manager = mock.MagicMock()
|
||||||
return SwUpdateStrategy(manager,
|
return SwUpdateStrategy(
|
||||||
strategy_type,
|
manager,
|
||||||
subcloud_apply_type,
|
strategy_type,
|
||||||
max_parallel_subclouds,
|
subcloud_apply_type,
|
||||||
stop_on_failure,
|
max_parallel_subclouds,
|
||||||
state,
|
stop_on_failure,
|
||||||
created_at,
|
state,
|
||||||
updated_at,
|
created_at,
|
||||||
extra_args)
|
updated_at,
|
||||||
|
extra_args,
|
||||||
|
)
|
||||||
|
@@ -90,9 +90,7 @@ def prompt_for_password(password_type="sysadmin", item_type="subcloud"):
|
|||||||
print("Password cannot be empty")
|
print("Password cannot be empty")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
confirm = getpass.getpass(
|
confirm = getpass.getpass(f"Re-enter {password_type} password to confirm: ")
|
||||||
f"Re-enter {password_type} password to confirm: "
|
|
||||||
)
|
|
||||||
if password != confirm:
|
if password != confirm:
|
||||||
print("Passwords did not match")
|
print("Passwords did not match")
|
||||||
continue
|
continue
|
||||||
@@ -170,7 +168,6 @@ def subcloud_detail_format(subcloud=None):
|
|||||||
|
|
||||||
|
|
||||||
def set_sysadmin_password(parsed_args, data):
|
def set_sysadmin_password(parsed_args, data):
|
||||||
|
|
||||||
if parsed_args.sysadmin_password:
|
if parsed_args.sysadmin_password:
|
||||||
data["sysadmin_password"] = base64.b64encode(
|
data["sysadmin_password"] = base64.b64encode(
|
||||||
parsed_args.sysadmin_password.encode("utf-8")
|
parsed_args.sysadmin_password.encode("utf-8")
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -25,6 +26,4 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# Danger - pbr requirement >= 2.0.0 not satisfied...
|
# Danger - pbr requirement >= 2.0.0 not satisfied...
|
||||||
setuptools.setup(
|
setuptools.setup(setup_requires=["pbr>=1.8.0"], pbr=True)
|
||||||
setup_requires=['pbr>=1.8.0'],
|
|
||||||
pbr=True)
|
|
||||||
|
@@ -6,6 +6,5 @@ coverage!=4.4,>=4.0 # Apache-2.0
|
|||||||
flake8 # MIT
|
flake8 # MIT
|
||||||
mock>=2.0 # BSD
|
mock>=2.0 # BSD
|
||||||
pylint==2.14.1 # GPLv2
|
pylint==2.14.1 # GPLv2
|
||||||
python-dev-tools # Apache-2.0
|
|
||||||
tempest>=14.0.0 # Apache-2.0
|
tempest>=14.0.0 # Apache-2.0
|
||||||
testtools>=1.4.0 # MIT
|
testtools>=1.4.0 # MIT
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py39,pep8,pylint
|
envlist = py39,pep8,pylint,black_check
|
||||||
minversion = 2.3
|
minversion = 4.4.0
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
toxworkdir = /tmp/{env:USER}_dc_client_tox
|
toxworkdir = /tmp/{env:USER}_dc_client_tox
|
||||||
|
|
||||||
[dcclient]
|
[dcclient]
|
||||||
@@ -10,17 +9,16 @@ client_base_dir = .
|
|||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
basepython = python3.9
|
basepython = python3.9
|
||||||
install_command = pip install \
|
|
||||||
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
|
|
||||||
{opts} {packages}
|
|
||||||
setenv =
|
setenv =
|
||||||
VIRTUAL_ENV={envdir}
|
VIRTUAL_ENV={envdir}
|
||||||
OS_STDOUT_CAPTURE=1
|
OS_STDOUT_CAPTURE=1
|
||||||
OS_STDERR_CAPTURE=1
|
OS_STDERR_CAPTURE=1
|
||||||
OS_TEST_TIMEOUT=60
|
OS_TEST_TIMEOUT=60
|
||||||
|
|
||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps =
|
||||||
-r{toxinidir}/requirements.txt
|
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt}
|
||||||
|
-r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
allowlist_externals =
|
allowlist_externals =
|
||||||
rm
|
rm
|
||||||
@@ -51,6 +49,22 @@ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
|||||||
commands =
|
commands =
|
||||||
pylint {posargs} dcmanagerclient --rcfile=./.pylintrc
|
pylint {posargs} dcmanagerclient --rcfile=./.pylintrc
|
||||||
|
|
||||||
|
[testenv:black]
|
||||||
|
# This environment automatically applies the Black formatter to all Python files in
|
||||||
|
# the project.
|
||||||
|
deps =
|
||||||
|
black>=23.11.0 # MIT
|
||||||
|
commands =
|
||||||
|
black {posargs} .
|
||||||
|
|
||||||
|
[testenv:black_check]
|
||||||
|
# This environment checks and displays the recommended changes by Black for formatting
|
||||||
|
# Python files.
|
||||||
|
deps =
|
||||||
|
black>=23.11.0 # MIT
|
||||||
|
commands =
|
||||||
|
black --check --diff .
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
setenv =
|
setenv =
|
||||||
PYTHON=coverage run --parallel-mode
|
PYTHON=coverage run --parallel-mode
|
||||||
|
6
tox.ini
6
tox.ini
@@ -27,6 +27,12 @@ description = Dummy environment to allow pep8 to be run in subdir tox
|
|||||||
[testenv:pylint]
|
[testenv:pylint]
|
||||||
description = Dummy environment to allow pylint to be run in subdir tox
|
description = Dummy environment to allow pylint to be run in subdir tox
|
||||||
|
|
||||||
|
[testenv:black]
|
||||||
|
description = Dummy environment to allow black to be run in subdir tox
|
||||||
|
|
||||||
|
[testenv:black_check]
|
||||||
|
description = Dummy environment to allow black_check to be run in subdir tox
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
deps = -r{toxinidir}/doc/requirements.txt
|
deps = -r{toxinidir}/doc/requirements.txt
|
||||||
commands =
|
commands =
|
||||||
|
Reference in New Issue
Block a user