Update tox config for Distributed Cloud Client
Cleanup the tox configuration and requirements. Test Plan: Verify that all Tox tests pass without errors. 1. Successfully executed on the distributedcloud dir - tox -e docs,releasenotes,api-ref,bandit,linters - tox -e newnote -- new-note 2. Successfully executed on the distributedcloud/distributedcloud dir - tox -e py39,pylint,pep8 Closes-Bug: 2053023 Change-Id: Ib25f31f8607e46e51dfbda0a6b3a36e9e11151df Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit is contained in:
parent
eb4e7eeeb0
commit
205860da9a
|
@ -1,6 +1,6 @@
|
|||
[MASTER]
|
||||
# Specify a configuration file.
|
||||
rcfile=pylint.rc
|
||||
rcfile=.pylintrc
|
||||
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||
|
@ -10,8 +10,8 @@ extension-pkg-whitelist=greenlet
|
|||
# Python code to execute, usually for sys.path manipulation such as pygtk.require().
|
||||
#init-hook=
|
||||
|
||||
# Add files or directories to the blacklist. They should be base names, not paths.
|
||||
ignore=tests
|
||||
; # Add files or directories to the blacklist. They should be base names, not paths.
|
||||
; ignore=tests
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
@ -20,136 +20,58 @@ persistent=yes
|
|||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
|
||||
# TODO: Bo remove the following once we no longer use python2
|
||||
# Remove option files-output, bad-functions, max-branches
|
||||
# Remove E1606, E1607, E1608, E1610, E1611, E1641, W0403, W1112, W1641
|
||||
# Remove enable section since python3 checker will then by default
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time.
|
||||
#
|
||||
# Python3 checker:
|
||||
#
|
||||
# E1601: print-statement
|
||||
# E1602: parameter-unpacking
|
||||
# E1603: unpacking-in-except
|
||||
# E1604: old-raise-syntax
|
||||
# E1605: backtick
|
||||
# E1606: long-suffix
|
||||
# E1607: old-ne-operator
|
||||
# E1608: old-octal-literal
|
||||
# E1609: import-star-module-level
|
||||
# E1610: non-ascii-bytes-literal
|
||||
# E1611: invalid-unicode-literal
|
||||
# W1601: apply-builtin
|
||||
# W1602: basestring-builtin
|
||||
# W1603: buffer-builtin
|
||||
# W1604: cmp-builtin
|
||||
# W1605: coerce-builtin
|
||||
# W1606: execfile-builtin
|
||||
# W1607: file-builtin
|
||||
# W1608: long-builtin
|
||||
# W1609: raw_input-builtin
|
||||
# W1610: reduce-builtin
|
||||
# W1611: standarderror-builtin
|
||||
# W1612: unicode-builtin
|
||||
# W1613: xrange-builtin
|
||||
# W1614: coerce-method
|
||||
# W1615: delslice-method
|
||||
# W1616: getslice-method
|
||||
# W1617: setslice-method
|
||||
# W1618: no-absolute-import
|
||||
# W1619: old-division
|
||||
# W1620: dict-iter-method
|
||||
# W1621: dict-view-method
|
||||
# W1622: next-method-called
|
||||
# W1623: metaclass-assignment
|
||||
# W1624: indexing-exception
|
||||
# W1625: raising-string
|
||||
# W1626: reload-builtin
|
||||
# W1627: oct-method
|
||||
# W1628: hex-method
|
||||
# W1629: nonzero-method
|
||||
# W1630: cmp-method
|
||||
# W1632: input-builtin
|
||||
# W1633: round-builtin
|
||||
# W1634: intern-builtin
|
||||
# W1635: unichr-builtin
|
||||
# W1636: map-builtin-not-iterating
|
||||
# W1637: zip-builtin-not-iterating
|
||||
# W1638: range-builtin-not-iterating
|
||||
# W1639: filter-builtin-not-iterating
|
||||
# W1640: using-cmp-argument
|
||||
# W1641: eq-without-hash
|
||||
# W1642: div-method
|
||||
# W1643: idiv-method
|
||||
# W1644: rdiv-method
|
||||
# W1645: exception-message-attribute
|
||||
# W1646: invalid-str-codec
|
||||
# W1647: sys-max-int
|
||||
# W1648: bad-python3-import
|
||||
# W1649: deprecated-string-function
|
||||
# W1650: deprecated-str-translate-call
|
||||
# W1651: deprecated-itertools-function
|
||||
# W1652: deprecated-types-field
|
||||
# W1653: next-method-defined
|
||||
# W1654: dict-items-not-iterating
|
||||
# W1655: dict-keys-not-iterating
|
||||
# W1656: dict-values-not-iterating
|
||||
# W1657: deprecated-operator-function
|
||||
# W1658: deprecated-urllib-function
|
||||
# W1659: xreadlines-attribute
|
||||
# W1660: deprecated-sys-function
|
||||
# W1661: exception-escape
|
||||
# W1662: comprehension-escape
|
||||
enable=E1601,E1602,E1603,E1604,E1605,E1606,E1607,E1608,E1609,E1610,E1611,W1601,
|
||||
W1602,W1603,W1604,W1605,W1606,W1607,W1608,W1609,W1610,W1611,W1612,W1613,
|
||||
W1614,W1615,W1616,W1617,W1618,W1619,W1620,W1621,W1622,W1623,W1624,W1625,
|
||||
W1626,W1627,W1628,W1629,W1630,W1632,W1633,W1634,W1635,W1636,W1637,W1638,
|
||||
W1639,W1640,W1641,W1642,W1643,W1644,W1645,W1646,W1647,W1648,W1649,W1650,
|
||||
W1651,W1652,W1653,W1654,W1655,W1656,W1657,W1658,W1659,W1660,W1661,W1662
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once).
|
||||
# http://pylint.pycqa.org/en/latest/technical_reference/features.html
|
||||
#
|
||||
# https://pylint.readthedocs.io/en/latest/user_guide/output.html#source-code-analysis-section
|
||||
# R detect Refactor for a "good practice" metric violation
|
||||
# C detect Convention for coding standard violation
|
||||
# E1102: not-callable
|
||||
# W0107: unnecessary-pass
|
||||
# W0212: protected-access
|
||||
# W0403: relative-import (typically caused by six)
|
||||
# W0603: global-statement
|
||||
# W0613: unused-argument
|
||||
# W0622: redefined-builtin
|
||||
# W0703: broad-except
|
||||
# W1113: keyword-arg-before-vararg
|
||||
# W1505: deprecated-method
|
||||
# W1618: no-absolute-import
|
||||
#
|
||||
# Following alarms are suppressed because python2 does not support the new pylint
|
||||
# suggested syntax change. Need to unsuppress once we move away from python2
|
||||
# W0707: raise-missing-from
|
||||
# W1514: unspecified-encoding
|
||||
#
|
||||
disable=C,R,
|
||||
E1102,W0107,W0212,W0403,W0612,W0613,W0603,
|
||||
W0622,W0703,W0707,W1112,W1505,W1514,W1618
|
||||
# W detect Warning for stylistic problems, or minor programming issues
|
||||
disable=R,
|
||||
dangerous-default-value,
|
||||
pointless-string-statement,
|
||||
unnecessary-pass,
|
||||
eval-used,
|
||||
attribute-defined-outside-init,
|
||||
bad-staticmethod-argument,
|
||||
protected-access,
|
||||
arguments-differ,
|
||||
abstract-method,
|
||||
super-init-not-called,
|
||||
useless-super-delegation,
|
||||
deprecated-module,
|
||||
global-statement,
|
||||
unused-variable,
|
||||
unused-argument,
|
||||
redefined-outer-name,
|
||||
redefined-builtin,
|
||||
undefined-loop-variable,
|
||||
broad-except,
|
||||
try-except-raise,
|
||||
raise-missing-from,
|
||||
keyword-arg-before-vararg,
|
||||
logging-not-lazy,
|
||||
anomalous-backslash-in-string,
|
||||
redundant-u-string-prefix,
|
||||
unspecified-encoding,
|
||||
no-absolute-import,
|
||||
missing-class-docstring,
|
||||
missing-function-docstring,
|
||||
missing-module-docstring,
|
||||
consider-using-f-string,
|
||||
invalid-name,
|
||||
import-outside-toplevel,
|
||||
too-many-lines,
|
||||
consider-iterating-dictionary,
|
||||
unnecessary-lambda-assignment
|
||||
|
||||
[REPORTS]
|
||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||
# (visual studio) and html
|
||||
output-format=text
|
||||
|
||||
# Put messages in a separate file for each module / package specified on the
|
||||
# command line instead of printing them on stdout. Reports (if any) will be
|
||||
# written in a file name "pylint_global.[txt|html]".
|
||||
files-output=no
|
||||
|
||||
# Tells whether to display a full report or only the messages
|
||||
reports=no
|
||||
|
||||
|
@ -205,9 +127,6 @@ generated-members=REQUEST,acl_users,aq_parent
|
|||
|
||||
|
||||
[BASIC]
|
||||
# List of builtins function names that should not be used, separated by a comma
|
||||
bad-functions=map,filter,apply,input
|
||||
|
||||
# Regular expression which should only match correct module names
|
||||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
|
@ -297,7 +216,7 @@ max-locals=15
|
|||
max-returns=6
|
||||
|
||||
# Maximum number of branch for function / method body
|
||||
max-branchs=12
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of statements in function / method body
|
||||
max-statements=50
|
|
@ -14,9 +14,10 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
import json
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from dcmanagerclient import exceptions
|
||||
|
||||
|
||||
|
@ -56,7 +57,7 @@ class Subcloud(Resource):
|
|||
'prestage-status': 'prestage_status',
|
||||
'prestage-versions': 'prestage_versions',
|
||||
'region-name': 'region_name'
|
||||
}
|
||||
}
|
||||
|
||||
def __init__(self, manager, subcloud_id, name, description, location,
|
||||
software_version, management_state, availability_status,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright 2013 - Mirantis, Inc.
|
||||
# Copyright 2016 - StackStorm, Inc.
|
||||
# Copyright 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 not use this file except in compliance with the License.
|
||||
|
@ -17,11 +17,9 @@
|
|||
#
|
||||
|
||||
import copy
|
||||
import os
|
||||
|
||||
import requests
|
||||
|
||||
import logging
|
||||
import os
|
||||
import requests
|
||||
|
||||
import osprofiler.web
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2024 Wind River Systems, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -14,9 +14,10 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
from requests_toolbelt import MultipartEncoder
|
||||
|
||||
from dcmanagerclient.api import base
|
||||
from dcmanagerclient.api.base import get_json
|
||||
from requests_toolbelt import MultipartEncoder
|
||||
|
||||
|
||||
class SubcloudDeploy(base.Resource):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2024 Wind River Systems, Inc.
|
||||
# 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 a copy of the License at
|
||||
|
@ -15,9 +15,10 @@
|
|||
|
||||
import os
|
||||
|
||||
from osc_lib.command import command
|
||||
|
||||
from dcmanagerclient.commands.v1 import base
|
||||
from dcmanagerclient import exceptions
|
||||
from osc_lib.command import command
|
||||
|
||||
|
||||
def _format(subcloud_deploy=None):
|
||||
|
|
|
@ -176,14 +176,13 @@ def detail_list_format(subcloud=None):
|
|||
# The other commands do not required it, since the output should
|
||||
# not show that field
|
||||
def update_fields_values(result):
|
||||
|
||||
if len(result) == 0:
|
||||
return
|
||||
|
||||
for i in range(len(result)):
|
||||
for item in result:
|
||||
for field, value in SET_FIELD_VALUE_DICT.items():
|
||||
if field in dir(result[i]):
|
||||
setattr(result[i], field, value)
|
||||
if field in dir(item):
|
||||
setattr(item, field, value)
|
||||
|
||||
|
||||
class AddSubcloud(base.DCManagerShowOne):
|
||||
|
|
|
@ -18,20 +18,18 @@
|
|||
Command-line interface to the DC Manager APIs
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from dcmanagerclient import __version__ as dcmanager_version
|
||||
from dcmanagerclient.api import client
|
||||
from dcmanagerclient import exceptions
|
||||
|
||||
from cliff import app
|
||||
from cliff import commandmanager
|
||||
from cliff import help
|
||||
from cliff import help as cliff_help
|
||||
from osc_lib.command import command
|
||||
|
||||
import argparse
|
||||
from dcmanagerclient import __version__ as dcmanager_version
|
||||
from dcmanagerclient.api import client
|
||||
from dcmanagerclient.commands.v1 import alarm_manager as am
|
||||
from dcmanagerclient.commands.v1 import fw_update_manager as fum
|
||||
from dcmanagerclient.commands.v1 import kube_rootca_update_manager as krum
|
||||
|
@ -45,10 +43,11 @@ from dcmanagerclient.commands.v1 import subcloud_manager as sm
|
|||
from dcmanagerclient.commands.v1 import subcloud_peer_group_manager as pm
|
||||
from dcmanagerclient.commands.v1 import sw_patch_manager as spm
|
||||
from dcmanagerclient.commands.v1 import sw_prestage_manager as spr
|
||||
from dcmanagerclient.commands.v1 import sw_update_manager as sum
|
||||
from dcmanagerclient.commands.v1 import sw_update_manager as swum
|
||||
from dcmanagerclient.commands.v1 import sw_update_options_manager as suom
|
||||
from dcmanagerclient.commands.v1 import sw_upgrade_manager as supm
|
||||
from dcmanagerclient.commands.v1 import system_peer_manager as sp
|
||||
from dcmanagerclient import exceptions
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -81,7 +80,7 @@ class OpenStackHelpFormatter(argparse.HelpFormatter):
|
|||
super(OpenStackHelpFormatter, self).start_section(heading)
|
||||
|
||||
|
||||
class HelpCommand(help.HelpCommand):
|
||||
class HelpCommand(cliff_help.HelpCommand):
|
||||
"""print detailed help for another command
|
||||
|
||||
Provide a custom action so the help command without
|
||||
|
@ -528,109 +527,105 @@ class DCManagerShell(app.App):
|
|||
@staticmethod
|
||||
def _get_commands_v1():
|
||||
return {
|
||||
'bash-completion': BashCompletionCommand,
|
||||
'subcloud add': sm.AddSubcloud,
|
||||
'subcloud delete': sm.DeleteSubcloud,
|
||||
'subcloud list': sm.ListSubcloud,
|
||||
'subcloud show': sm.ShowSubcloud,
|
||||
'subcloud errors': sm.ShowSubcloudError,
|
||||
'subcloud unmanage': sm.UnmanageSubcloud,
|
||||
'subcloud manage': sm.ManageSubcloud,
|
||||
'subcloud update': sm.UpdateSubcloud,
|
||||
'subcloud reconfig': sm.ReconfigSubcloud,
|
||||
'subcloud reinstall': sm.ReinstallSubcloud,
|
||||
'subcloud redeploy': sm.RedeploySubcloud,
|
||||
'subcloud restore': sm.RestoreSubcloud,
|
||||
'subcloud prestage': sm.PrestageSubcloud,
|
||||
'subcloud-backup create': sbm.CreateSubcloudBackup,
|
||||
'subcloud-backup delete': sbm.DeleteSubcloudBackup,
|
||||
'subcloud-backup restore': sbm.RestoreSubcloudBackup,
|
||||
'subcloud-group add': gm.AddSubcloudGroup,
|
||||
'subcloud-group delete': gm.DeleteSubcloudGroup,
|
||||
'subcloud-group list': gm.ListSubcloudGroup,
|
||||
'subcloud-group list-subclouds': gm.ListSubcloudGroupSubclouds,
|
||||
'subcloud-group show': gm.ShowSubcloudGroup,
|
||||
'subcloud-group update': gm.UpdateSubcloudGroup,
|
||||
'subcloud deploy abort': psdm.AbortPhasedSubcloudDeploy,
|
||||
'subcloud deploy create': psdm.CreatePhasedSubcloudDeploy,
|
||||
'subcloud deploy bootstrap': psdm.BootstrapPhasedSubcloudDeploy,
|
||||
'subcloud deploy config': psdm.ConfigPhasedSubcloudDeploy,
|
||||
'subcloud deploy install': psdm.InstallPhasedSubcloudDeploy,
|
||||
'subcloud deploy complete': psdm.CompletePhasedSubcloudDeploy,
|
||||
'subcloud deploy resume': psdm.PhasedSubcloudDeployResume,
|
||||
'subcloud deploy upload': sdm.SubcloudDeployUpload,
|
||||
'subcloud deploy show': sdm.SubcloudDeployShow,
|
||||
'subcloud deploy delete': sdm.SubcloudDeployDelete,
|
||||
'subcloud-deploy upload': sdm.DeprecatedSubcloudDeployUpload,
|
||||
'subcloud-deploy show': sdm.DeprecatedSubcloudDeployShow,
|
||||
'subcloud-peer-group add': pm.AddSubcloudPeerGroup,
|
||||
'subcloud-peer-group list': pm.ListSubcloudPeerGroup,
|
||||
'subcloud-peer-group list-subclouds':
|
||||
pm.ListSubcloudPeerGroupSubclouds,
|
||||
'subcloud-peer-group show': pm.ShowSubcloudPeerGroup,
|
||||
'subcloud-peer-group update': pm.UpdateSubcloudPeerGroup,
|
||||
'subcloud-peer-group delete': pm.DeleteSubcloudPeerGroup,
|
||||
'subcloud-peer-group migrate': pm.MigrateSubcloudPeerGroup,
|
||||
'subcloud-peer-group status': pm.StatusSubcloudPeerGroup,
|
||||
'system-peer add': sp.AddSystemPeer,
|
||||
'system-peer list': sp.ListSystemPeer,
|
||||
'system-peer show': sp.ShowSystemPeer,
|
||||
'system-peer update': sp.UpdateSystemPeer,
|
||||
'system-peer delete': sp.DeleteSystemPeer,
|
||||
'system-peer list-subcloud-peer-groups':
|
||||
sp.ListSystemPeerSubcloudPeerGroups,
|
||||
'peer-group-association add': pgam.AddPeerGroupAssociation,
|
||||
'peer-group-association list': pgam.ListPeerGroupAssociation,
|
||||
'peer-group-association show': pgam.ShowPeerGroupAssociation,
|
||||
'peer-group-association sync': pgam.SyncPeerGroupAssociation,
|
||||
'peer-group-association update': pgam.UpdatePeerGroupAssociation,
|
||||
'peer-group-association delete': pgam.DeletePeerGroupAssociation,
|
||||
'alarm summary': am.ListAlarmSummary,
|
||||
'fw-update-strategy create': fum.CreateFwUpdateStrategy,
|
||||
'fw-update-strategy delete': fum.DeleteFwUpdateStrategy,
|
||||
'fw-update-strategy apply': fum.ApplyFwUpdateStrategy,
|
||||
'fw-update-strategy abort': fum.AbortFwUpdateStrategy,
|
||||
'fw-update-strategy show': fum.ShowFwUpdateStrategy,
|
||||
'kube-rootca-update-strategy create':
|
||||
"bash-completion": BashCompletionCommand,
|
||||
"subcloud add": sm.AddSubcloud,
|
||||
"subcloud delete": sm.DeleteSubcloud,
|
||||
"subcloud list": sm.ListSubcloud,
|
||||
"subcloud show": sm.ShowSubcloud,
|
||||
"subcloud errors": sm.ShowSubcloudError,
|
||||
"subcloud unmanage": sm.UnmanageSubcloud,
|
||||
"subcloud manage": sm.ManageSubcloud,
|
||||
"subcloud update": sm.UpdateSubcloud,
|
||||
"subcloud reconfig": sm.ReconfigSubcloud,
|
||||
"subcloud reinstall": sm.ReinstallSubcloud,
|
||||
"subcloud redeploy": sm.RedeploySubcloud,
|
||||
"subcloud restore": sm.RestoreSubcloud,
|
||||
"subcloud prestage": sm.PrestageSubcloud,
|
||||
"subcloud-backup create": sbm.CreateSubcloudBackup,
|
||||
"subcloud-backup delete": sbm.DeleteSubcloudBackup,
|
||||
"subcloud-backup restore": sbm.RestoreSubcloudBackup,
|
||||
"subcloud-group add": gm.AddSubcloudGroup,
|
||||
"subcloud-group delete": gm.DeleteSubcloudGroup,
|
||||
"subcloud-group list": gm.ListSubcloudGroup,
|
||||
"subcloud-group list-subclouds": gm.ListSubcloudGroupSubclouds,
|
||||
"subcloud-group show": gm.ShowSubcloudGroup,
|
||||
"subcloud-group update": gm.UpdateSubcloudGroup,
|
||||
"subcloud deploy abort": psdm.AbortPhasedSubcloudDeploy,
|
||||
"subcloud deploy create": psdm.CreatePhasedSubcloudDeploy,
|
||||
"subcloud deploy bootstrap": psdm.BootstrapPhasedSubcloudDeploy,
|
||||
"subcloud deploy config": psdm.ConfigPhasedSubcloudDeploy,
|
||||
"subcloud deploy install": psdm.InstallPhasedSubcloudDeploy,
|
||||
"subcloud deploy complete": psdm.CompletePhasedSubcloudDeploy,
|
||||
"subcloud deploy resume": psdm.PhasedSubcloudDeployResume,
|
||||
"subcloud deploy upload": sdm.SubcloudDeployUpload,
|
||||
"subcloud deploy show": sdm.SubcloudDeployShow,
|
||||
"subcloud deploy delete": sdm.SubcloudDeployDelete,
|
||||
"subcloud-deploy upload": sdm.DeprecatedSubcloudDeployUpload,
|
||||
"subcloud-deploy show": sdm.DeprecatedSubcloudDeployShow,
|
||||
"subcloud-peer-group add": pm.AddSubcloudPeerGroup,
|
||||
"subcloud-peer-group list": pm.ListSubcloudPeerGroup,
|
||||
"subcloud-peer-group list-subclouds": pm.ListSubcloudPeerGroupSubclouds,
|
||||
"subcloud-peer-group show": pm.ShowSubcloudPeerGroup,
|
||||
"subcloud-peer-group update": pm.UpdateSubcloudPeerGroup,
|
||||
"subcloud-peer-group delete": pm.DeleteSubcloudPeerGroup,
|
||||
"subcloud-peer-group migrate": pm.MigrateSubcloudPeerGroup,
|
||||
"subcloud-peer-group status": pm.StatusSubcloudPeerGroup,
|
||||
"system-peer add": sp.AddSystemPeer,
|
||||
"system-peer list": sp.ListSystemPeer,
|
||||
"system-peer show": sp.ShowSystemPeer,
|
||||
"system-peer update": sp.UpdateSystemPeer,
|
||||
"system-peer delete": sp.DeleteSystemPeer,
|
||||
"system-peer list-subcloud-peer-groups":
|
||||
sp.ListSystemPeerSubcloudPeerGroups,
|
||||
"peer-group-association add": pgam.AddPeerGroupAssociation,
|
||||
"peer-group-association list": pgam.ListPeerGroupAssociation,
|
||||
"peer-group-association show": pgam.ShowPeerGroupAssociation,
|
||||
"peer-group-association sync": pgam.SyncPeerGroupAssociation,
|
||||
"peer-group-association update": pgam.UpdatePeerGroupAssociation,
|
||||
"peer-group-association delete": pgam.DeletePeerGroupAssociation,
|
||||
"alarm summary": am.ListAlarmSummary,
|
||||
"fw-update-strategy create": fum.CreateFwUpdateStrategy,
|
||||
"fw-update-strategy delete": fum.DeleteFwUpdateStrategy,
|
||||
"fw-update-strategy apply": fum.ApplyFwUpdateStrategy,
|
||||
"fw-update-strategy abort": fum.AbortFwUpdateStrategy,
|
||||
"fw-update-strategy show": fum.ShowFwUpdateStrategy,
|
||||
"kube-rootca-update-strategy create":
|
||||
krum.CreateKubeRootcaUpdateStrategy,
|
||||
'kube-rootca-update-strategy delete':
|
||||
"kube-rootca-update-strategy delete":
|
||||
krum.DeleteKubeRootcaUpdateStrategy,
|
||||
'kube-rootca-update-strategy apply':
|
||||
krum.ApplyKubeRootcaUpdateStrategy,
|
||||
'kube-rootca-update-strategy abort':
|
||||
krum.AbortKubeRootcaUpdateStrategy,
|
||||
'kube-rootca-update-strategy show':
|
||||
krum.ShowKubeRootcaUpdateStrategy,
|
||||
'kube-upgrade-strategy create': kupm.CreateKubeUpgradeStrategy,
|
||||
'kube-upgrade-strategy delete': kupm.DeleteKubeUpgradeStrategy,
|
||||
'kube-upgrade-strategy apply': kupm.ApplyKubeUpgradeStrategy,
|
||||
'kube-upgrade-strategy abort': kupm.AbortKubeUpgradeStrategy,
|
||||
'kube-upgrade-strategy show': kupm.ShowKubeUpgradeStrategy,
|
||||
'patch-strategy create': spm.CreatePatchUpdateStrategy,
|
||||
'patch-strategy delete': spm.DeletePatchUpdateStrategy,
|
||||
'patch-strategy apply': spm.ApplyPatchUpdateStrategy,
|
||||
'patch-strategy abort': spm.AbortPatchUpdateStrategy,
|
||||
'patch-strategy show': spm.ShowPatchUpdateStrategy,
|
||||
'prestage-strategy create': spr.CreateSwPrestageStrategy,
|
||||
'prestage-strategy delete': spr.DeleteSwPrestageStrategy,
|
||||
'prestage-strategy apply': spr.ApplySwPrestageStrategy,
|
||||
'prestage-strategy abort': spr.AbortSwPrestageStrategy,
|
||||
'prestage-strategy show': spr.ShowSwPrestageStrategy,
|
||||
'strategy-step list': sum.ListSwUpdateStrategyStep,
|
||||
'strategy-step show': sum.ShowSwUpdateStrategyStep,
|
||||
'patch-strategy-config update': suom.UpdateSwUpdateOptions,
|
||||
'patch-strategy-config list': suom.ListSwUpdateOptions,
|
||||
'patch-strategy-config show': suom.ShowSwUpdateOptions,
|
||||
'patch-strategy-config delete': suom.DeleteSwUpdateOptions,
|
||||
'strategy-config update': suom.UpdateSwUpdateOptions,
|
||||
'strategy-config list': suom.ListSwUpdateOptions,
|
||||
'strategy-config show': suom.ShowSwUpdateOptions,
|
||||
'strategy-config delete': suom.DeleteSwUpdateOptions,
|
||||
'upgrade-strategy create': supm.CreateSwUpgradeStrategy,
|
||||
'upgrade-strategy delete': supm.DeleteSwUpgradeStrategy,
|
||||
'upgrade-strategy apply': supm.ApplySwUpgradeStrategy,
|
||||
'upgrade-strategy abort': supm.AbortSwUpgradeStrategy,
|
||||
'upgrade-strategy show': supm.ShowSwUpgradeStrategy,
|
||||
"kube-rootca-update-strategy apply": krum.ApplyKubeRootcaUpdateStrategy,
|
||||
"kube-rootca-update-strategy abort": krum.AbortKubeRootcaUpdateStrategy,
|
||||
"kube-rootca-update-strategy show": krum.ShowKubeRootcaUpdateStrategy,
|
||||
"kube-upgrade-strategy create": kupm.CreateKubeUpgradeStrategy,
|
||||
"kube-upgrade-strategy delete": kupm.DeleteKubeUpgradeStrategy,
|
||||
"kube-upgrade-strategy apply": kupm.ApplyKubeUpgradeStrategy,
|
||||
"kube-upgrade-strategy abort": kupm.AbortKubeUpgradeStrategy,
|
||||
"kube-upgrade-strategy show": kupm.ShowKubeUpgradeStrategy,
|
||||
"patch-strategy create": spm.CreatePatchUpdateStrategy,
|
||||
"patch-strategy delete": spm.DeletePatchUpdateStrategy,
|
||||
"patch-strategy apply": spm.ApplyPatchUpdateStrategy,
|
||||
"patch-strategy abort": spm.AbortPatchUpdateStrategy,
|
||||
"patch-strategy show": spm.ShowPatchUpdateStrategy,
|
||||
"prestage-strategy create": spr.CreateSwPrestageStrategy,
|
||||
"prestage-strategy delete": spr.DeleteSwPrestageStrategy,
|
||||
"prestage-strategy apply": spr.ApplySwPrestageStrategy,
|
||||
"prestage-strategy abort": spr.AbortSwPrestageStrategy,
|
||||
"prestage-strategy show": spr.ShowSwPrestageStrategy,
|
||||
"strategy-step list": swum.ListSwUpdateStrategyStep,
|
||||
"strategy-step show": swum.ShowSwUpdateStrategyStep,
|
||||
"patch-strategy-config update": suom.UpdateSwUpdateOptions,
|
||||
"patch-strategy-config list": suom.ListSwUpdateOptions,
|
||||
"patch-strategy-config show": suom.ShowSwUpdateOptions,
|
||||
"patch-strategy-config delete": suom.DeleteSwUpdateOptions,
|
||||
"strategy-config update": suom.UpdateSwUpdateOptions,
|
||||
"strategy-config list": suom.ListSwUpdateOptions,
|
||||
"strategy-config show": suom.ShowSwUpdateOptions,
|
||||
"strategy-config delete": suom.DeleteSwUpdateOptions,
|
||||
"upgrade-strategy create": supm.CreateSwUpgradeStrategy,
|
||||
"upgrade-strategy delete": supm.DeleteSwUpgradeStrategy,
|
||||
"upgrade-strategy apply": supm.ApplySwUpgradeStrategy,
|
||||
"upgrade-strategy abort": supm.AbortSwUpgradeStrategy,
|
||||
"upgrade-strategy show": supm.ShowSwUpgradeStrategy,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -232,8 +232,6 @@ FAKE_BOOTSTRAP_VALUES = {
|
|||
"external_oam_floating_address": EXTERNAL_OAM_FLOATING_ADDRESS,
|
||||
'backup_status': BACKUP_STATUS,
|
||||
'backup_datetime': BACKUP_DATETIME,
|
||||
'backup_status': BACKUP_STATUS,
|
||||
'backup_datetime': BACKUP_DATETIME,
|
||||
'prestage_status': PRESTAGE_STATUS,
|
||||
'prestage_versions': PRESTAGE_VERSIONS
|
||||
}
|
||||
|
@ -275,7 +273,7 @@ class BaseClientTest(testtools.TestCase):
|
|||
_client = None
|
||||
|
||||
def setUp(self):
|
||||
super(BaseClientTest, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
def mock_http_get(self, content, status_code=200):
|
||||
if isinstance(content, dict):
|
||||
|
|
|
@ -19,40 +19,33 @@ import copy
|
|||
import uuid
|
||||
|
||||
import mock
|
||||
from osprofiler import _utils as osprofiler_utils
|
||||
import osprofiler.profiler
|
||||
import requests
|
||||
import testtools
|
||||
|
||||
from osprofiler import _utils as osprofiler_utils
|
||||
import osprofiler.profiler
|
||||
|
||||
from dcmanagerclient.api import httpclient
|
||||
|
||||
API_BASE_URL = 'http://localhost:8119/v1.0'
|
||||
API_URL = '/os-quota-sets'
|
||||
API_BASE_URL = "http://localhost:8119/v1.0"
|
||||
API_URL = "/os-quota-sets"
|
||||
|
||||
EXPECTED_URL = API_BASE_URL + API_URL
|
||||
|
||||
AUTH_TOKEN = str(uuid.uuid4())
|
||||
PROJECT_ID = str(uuid.uuid4())
|
||||
USER_ID = str(uuid.uuid4())
|
||||
PROFILER_HMAC_KEY = 'SECRET_HMAC_KEY'
|
||||
PROFILER_HMAC_KEY = "SECRET_HMAC_KEY"
|
||||
PROFILER_TRACE_ID = str(uuid.uuid4())
|
||||
|
||||
EXPECTED_AUTH_HEADERS = {
|
||||
'x-auth-token': AUTH_TOKEN,
|
||||
'X-Project-Id': PROJECT_ID,
|
||||
'X-User-Id': USER_ID
|
||||
"x-auth-token": AUTH_TOKEN,
|
||||
"X-Project-Id": PROJECT_ID,
|
||||
"X-User-Id": USER_ID,
|
||||
}
|
||||
|
||||
EXPECTED_REQ_OPTIONS = {
|
||||
'headers': EXPECTED_AUTH_HEADERS
|
||||
}
|
||||
EXPECTED_REQ_OPTIONS = {"headers": EXPECTED_AUTH_HEADERS}
|
||||
|
||||
EXPECTED_BODY = {
|
||||
'k1': 'abc',
|
||||
'k2': 123,
|
||||
'k3': True
|
||||
}
|
||||
EXPECTED_BODY = {"k1": "abc", "k2": 123, "k3": True}
|
||||
|
||||
|
||||
class FakeRequest(object):
|
||||
|
@ -65,7 +58,7 @@ class FakeResponse(object):
|
|||
self.request = FakeRequest(method)
|
||||
self.url = url
|
||||
self.status_code = status_code
|
||||
self.text = ''
|
||||
self.text = ""
|
||||
|
||||
|
||||
class HTTPClientTest(testtools.TestCase):
|
||||
|
@ -73,227 +66,130 @@ class HTTPClientTest(testtools.TestCase):
|
|||
super(HTTPClientTest, self).setUp()
|
||||
osprofiler.profiler.init(None)
|
||||
self.client = httpclient.HTTPClient(
|
||||
API_BASE_URL,
|
||||
AUTH_TOKEN,
|
||||
PROJECT_ID,
|
||||
USER_ID
|
||||
API_BASE_URL, AUTH_TOKEN, PROJECT_ID, USER_ID
|
||||
)
|
||||
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'get',
|
||||
mock.MagicMock(return_value=FakeResponse('get', EXPECTED_URL, 200))
|
||||
)
|
||||
def test_get_request_options(self):
|
||||
@mock.patch.object(requests, "get")
|
||||
def test_get_request_options(self, mock_requests_get):
|
||||
osprofiler.profiler.clean()
|
||||
self.client.get(API_URL)
|
||||
|
||||
requests.get.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
**EXPECTED_REQ_OPTIONS
|
||||
)
|
||||
mock_requests_get.return_value = FakeResponse("get", EXPECTED_URL, 200)
|
||||
mock_requests_get.assert_called_with(EXPECTED_URL, **EXPECTED_REQ_OPTIONS)
|
||||
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'get',
|
||||
mock.MagicMock(return_value=FakeResponse('get', EXPECTED_URL, 200))
|
||||
)
|
||||
def test_get_request_options_with_headers_for_get(self):
|
||||
headers = {'foo': 'bar'}
|
||||
@mock.patch.object(requests, "get")
|
||||
def test_get_request_options_with_headers_for_get(self, mock_requests_get):
|
||||
headers = {"foo": "bar"}
|
||||
|
||||
self.client.get(API_URL, headers=headers)
|
||||
mock_requests_get.return_value = FakeResponse("get", EXPECTED_URL, 200)
|
||||
|
||||
expected_options = copy.deepcopy(EXPECTED_REQ_OPTIONS)
|
||||
expected_options['headers'].update(headers)
|
||||
expected_options["headers"].update(headers)
|
||||
|
||||
requests.get.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
**expected_options
|
||||
)
|
||||
mock_requests_get.assert_called_with(EXPECTED_URL, **expected_options)
|
||||
|
||||
@mock.patch.object(
|
||||
osprofiler.profiler._Profiler,
|
||||
'get_base_id',
|
||||
mock.MagicMock(return_value=PROFILER_TRACE_ID)
|
||||
)
|
||||
@mock.patch.object(
|
||||
osprofiler.profiler._Profiler,
|
||||
'get_id',
|
||||
mock.MagicMock(return_value=PROFILER_TRACE_ID)
|
||||
)
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'get',
|
||||
mock.MagicMock(return_value=FakeResponse('get', EXPECTED_URL, 200))
|
||||
)
|
||||
def test_get_request_options_with_profile_enabled(self):
|
||||
@mock.patch.object(osprofiler.profiler._Profiler, "get_base_id")
|
||||
@mock.patch.object(osprofiler.profiler._Profiler, "get_id")
|
||||
@mock.patch.object(requests, "get")
|
||||
def test_get_request_options_with_profile_enabled(
|
||||
self, mock_requests_get, mock_profiler_get_id, mock_profiler_get_base_id
|
||||
):
|
||||
osprofiler.profiler.clean()
|
||||
osprofiler.profiler.init(PROFILER_HMAC_KEY)
|
||||
|
||||
data = {'base_id': PROFILER_TRACE_ID, 'parent_id': PROFILER_TRACE_ID}
|
||||
mock_requests_get.return_value = FakeResponse("get", EXPECTED_URL, 200)
|
||||
mock_profiler_get_id.return_value = PROFILER_TRACE_ID
|
||||
mock_profiler_get_base_id.return_value = PROFILER_TRACE_ID
|
||||
|
||||
data = {"base_id": PROFILER_TRACE_ID, "parent_id": PROFILER_TRACE_ID}
|
||||
signed_data = osprofiler_utils.signed_pack(data, PROFILER_HMAC_KEY)
|
||||
headers = {
|
||||
'X-Trace-Info': signed_data[0],
|
||||
'X-Trace-HMAC': signed_data[1]
|
||||
}
|
||||
headers = {"X-Trace-Info": signed_data[0], "X-Trace-HMAC": signed_data[1]}
|
||||
self.client.get(API_URL)
|
||||
|
||||
expected_options = copy.deepcopy(EXPECTED_REQ_OPTIONS)
|
||||
expected_options['headers'].update(headers)
|
||||
expected_options["headers"].update(headers)
|
||||
|
||||
requests.get.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
**expected_options
|
||||
)
|
||||
mock_requests_get.assert_called_with(EXPECTED_URL, **expected_options)
|
||||
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'post',
|
||||
mock.MagicMock(return_value=FakeResponse('post', EXPECTED_URL, 201))
|
||||
)
|
||||
def test_get_request_options_with_headers_for_post(self):
|
||||
headers = {'foo': 'bar'}
|
||||
@mock.patch.object(requests, "post")
|
||||
def test_get_request_options_with_headers_for_post(self, mock_requests_post):
|
||||
headers = {"foo": "bar"}
|
||||
|
||||
self.client.post(API_URL, EXPECTED_BODY, headers=headers)
|
||||
mock_requests_post.return_value = FakeResponse("post", EXPECTED_URL, 201)
|
||||
|
||||
expected_options = copy.deepcopy(EXPECTED_REQ_OPTIONS)
|
||||
expected_options['headers'].update(headers)
|
||||
expected_options['headers']['content-type'] = 'application/json'
|
||||
expected_options["headers"].update(headers)
|
||||
expected_options["headers"]["content-type"] = "application/json"
|
||||
|
||||
requests.post.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
EXPECTED_BODY,
|
||||
**expected_options
|
||||
mock_requests_post.assert_called_with(
|
||||
EXPECTED_URL, EXPECTED_BODY, **expected_options
|
||||
)
|
||||
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'put',
|
||||
mock.MagicMock(return_value=FakeResponse('put', EXPECTED_URL, 200))
|
||||
)
|
||||
def test_get_request_options_with_headers_for_put(self):
|
||||
headers = {'foo': 'bar'}
|
||||
@mock.patch.object(requests, "put")
|
||||
def test_get_request_options_with_headers_for_put(self, mock_requests_put):
|
||||
headers = {"foo": "bar"}
|
||||
|
||||
self.client.put(API_URL, EXPECTED_BODY, headers=headers)
|
||||
mock_requests_put.return_value = FakeResponse("put", EXPECTED_URL, 200)
|
||||
|
||||
expected_options = copy.deepcopy(EXPECTED_REQ_OPTIONS)
|
||||
expected_options['headers'].update(headers)
|
||||
expected_options['headers']['content-type'] = 'application/json'
|
||||
expected_options["headers"].update(headers)
|
||||
expected_options["headers"]["content-type"] = "application/json"
|
||||
|
||||
requests.put.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
EXPECTED_BODY,
|
||||
**expected_options
|
||||
mock_requests_put.assert_called_with(
|
||||
EXPECTED_URL, EXPECTED_BODY, **expected_options
|
||||
)
|
||||
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'delete',
|
||||
mock.MagicMock(return_value=FakeResponse('delete', EXPECTED_URL, 200))
|
||||
)
|
||||
def test_get_request_options_with_headers_for_delete(self):
|
||||
headers = {'foo': 'bar'}
|
||||
@mock.patch.object(requests, "delete")
|
||||
def test_get_request_options_with_headers_for_delete(self, mock_requests_delete):
|
||||
headers = {"foo": "bar"}
|
||||
|
||||
self.client.delete(API_URL, headers=headers)
|
||||
mock_requests_delete.return_value = FakeResponse("delete", EXPECTED_URL, 200)
|
||||
|
||||
expected_options = copy.deepcopy(EXPECTED_REQ_OPTIONS)
|
||||
expected_options['headers'].update(headers)
|
||||
expected_options["headers"].update(headers)
|
||||
|
||||
requests.delete.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
**expected_options
|
||||
)
|
||||
mock_requests_delete.assert_called_with(EXPECTED_URL, **expected_options)
|
||||
|
||||
@mock.patch.object(
|
||||
httpclient.HTTPClient,
|
||||
'_get_request_options',
|
||||
mock.MagicMock(return_value=copy.deepcopy(EXPECTED_REQ_OPTIONS))
|
||||
)
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'get',
|
||||
mock.MagicMock(return_value=FakeResponse('get', EXPECTED_URL, 200))
|
||||
)
|
||||
def test_http_get(self):
|
||||
@mock.patch.object(httpclient.HTTPClient, "_get_request_options")
|
||||
@mock.patch.object(requests, "get")
|
||||
def test_http_get(self, mock_requests_get, mock_get_request_options):
|
||||
self.client.get(API_URL)
|
||||
mock_requests_get.return_value = FakeResponse("get", EXPECTED_URL, 200)
|
||||
mock_get_request_options.return_value = copy.deepcopy(EXPECTED_REQ_OPTIONS)
|
||||
|
||||
httpclient.HTTPClient._get_request_options.assert_called_with(
|
||||
'get',
|
||||
None
|
||||
)
|
||||
mock_get_request_options.assert_called_with("get", None)
|
||||
mock_requests_get.assert_called_with(EXPECTED_URL)
|
||||
|
||||
requests.get.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
**EXPECTED_REQ_OPTIONS
|
||||
)
|
||||
|
||||
@mock.patch.object(
|
||||
httpclient.HTTPClient,
|
||||
'_get_request_options',
|
||||
mock.MagicMock(return_value=copy.deepcopy(EXPECTED_REQ_OPTIONS))
|
||||
)
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'post',
|
||||
mock.MagicMock(return_value=FakeResponse('post', EXPECTED_URL, 201))
|
||||
)
|
||||
def test_http_post(self):
|
||||
@mock.patch.object(httpclient.HTTPClient, "_get_request_options")
|
||||
@mock.patch.object(requests, "post")
|
||||
def test_http_post(self, mock_requests_post, mock_get_request_options):
|
||||
self.client.post(API_URL, EXPECTED_BODY)
|
||||
mock_get_request_options.return_value = copy.deepcopy(EXPECTED_REQ_OPTIONS)
|
||||
mock_requests_post.return_value = FakeResponse("post", EXPECTED_URL, 201)
|
||||
|
||||
httpclient.HTTPClient._get_request_options.assert_called_with(
|
||||
'post',
|
||||
None
|
||||
)
|
||||
mock_get_request_options.assert_called_with("post", None)
|
||||
mock_requests_post.assert_called_with(EXPECTED_URL, EXPECTED_BODY)
|
||||
|
||||
requests.post.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
EXPECTED_BODY,
|
||||
**EXPECTED_REQ_OPTIONS
|
||||
)
|
||||
|
||||
@mock.patch.object(
|
||||
httpclient.HTTPClient,
|
||||
'_get_request_options',
|
||||
mock.MagicMock(return_value=copy.deepcopy(EXPECTED_REQ_OPTIONS))
|
||||
)
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'put',
|
||||
mock.MagicMock(return_value=FakeResponse('put', EXPECTED_URL, 200))
|
||||
)
|
||||
def test_http_put(self):
|
||||
@mock.patch.object(httpclient.HTTPClient, "_get_request_options")
|
||||
@mock.patch.object(requests, "put")
|
||||
def test_http_put(self, mock_requests_put, mock_get_request_options):
|
||||
self.client.put(API_URL, EXPECTED_BODY)
|
||||
mock_get_request_options.return_value = copy.deepcopy(EXPECTED_REQ_OPTIONS)
|
||||
mock_requests_put.return_value = FakeResponse("put", EXPECTED_URL, 200)
|
||||
|
||||
httpclient.HTTPClient._get_request_options.assert_called_with(
|
||||
'put',
|
||||
None
|
||||
)
|
||||
mock_get_request_options.assert_called_with("put", None)
|
||||
mock_requests_put.assert_called_with(EXPECTED_URL, EXPECTED_BODY)
|
||||
|
||||
requests.put.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
EXPECTED_BODY,
|
||||
**EXPECTED_REQ_OPTIONS
|
||||
)
|
||||
|
||||
@mock.patch.object(
|
||||
httpclient.HTTPClient,
|
||||
'_get_request_options',
|
||||
mock.MagicMock(return_value=copy.deepcopy(EXPECTED_REQ_OPTIONS))
|
||||
)
|
||||
@mock.patch.object(
|
||||
requests,
|
||||
'delete',
|
||||
mock.MagicMock(return_value=FakeResponse('delete', EXPECTED_URL, 200))
|
||||
)
|
||||
def test_http_delete(self):
|
||||
@mock.patch.object(httpclient.HTTPClient, "_get_request_options")
|
||||
@mock.patch.object(requests, "delete")
|
||||
def test_http_delete(self, mock_requests_delete, mock_get_request_options):
|
||||
self.client.delete(API_URL)
|
||||
mock_get_request_options.return_value = copy.deepcopy(EXPECTED_REQ_OPTIONS)
|
||||
mock_requests_delete.return_value = FakeResponse("delete", EXPECTED_URL, 200)
|
||||
|
||||
httpclient.HTTPClient._get_request_options.assert_called_with(
|
||||
'delete',
|
||||
None
|
||||
)
|
||||
|
||||
requests.delete.assert_called_with(
|
||||
EXPECTED_URL,
|
||||
**EXPECTED_REQ_OPTIONS
|
||||
)
|
||||
mock_get_request_options.assert_called_with("delete", None)
|
||||
mock_requests_delete.assert_called_with(EXPECTED_URL)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2023 Wind River Systems, Inc.
|
||||
# Copyright (c) 2023-2024 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
@ -28,9 +28,9 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_deploy_create.return_value = [
|
||||
base.SUBCLOUD_RESOURCE]
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
|
||||
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
||||
config_file_path = os.path.abspath(config_file.name)
|
||||
|
@ -174,9 +174,9 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_deploy_resume.return_value = [
|
||||
base.SUBCLOUD_RESOURCE]
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
|
||||
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
||||
config_file_path = os.path.abspath(config_file.name)
|
||||
|
@ -199,9 +199,9 @@ class TestCLIPhasedSubcloudDeployManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_deploy_resume.return_value = [
|
||||
base.SUBCLOUD_RESOURCE]
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
|
||||
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
||||
config_file_path = os.path.abspath(config_file.name)
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#
|
||||
# Copyright (c) 2022-2023 Wind River Systems, Inc.
|
||||
# Copyright (c) 2022-2024 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import base64
|
||||
import mock
|
||||
import os
|
||||
|
||||
import mock
|
||||
|
||||
from dcmanagerclient.commands.v1 \
|
||||
import subcloud_backup_manager as subcloud_backup_cmd
|
||||
from dcmanagerclient.exceptions import DCManagerClientException
|
||||
from dcmanagerclient.tests import base
|
||||
|
||||
|
||||
OVERRIDE_VALUES = """---
|
||||
platform_backup_filename_prefix: test
|
||||
openstack_app_name: test
|
||||
|
@ -24,7 +24,7 @@ OVERRIDE_VALUES = """---
|
|||
class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestCLISubcloudBackUpManagerV1, self).setUp()
|
||||
super().setUp()
|
||||
self.client = self.app.client_manager.subcloud_backup_manager
|
||||
|
||||
def test_backup_create_subcloud(self):
|
||||
|
@ -32,8 +32,8 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_create.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w', encoding='UTF-8') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
actual_call = self.call(
|
||||
|
@ -41,7 +41,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
app_args=['--subcloud', 'subcloud1',
|
||||
'--local-only',
|
||||
'--registry-images',
|
||||
'--backup-values', backupPath,
|
||||
'--backup-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
||||
|
||||
|
@ -50,14 +50,14 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_create.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
actual_call = self.call(
|
||||
subcloud_backup_cmd.CreateSubcloudBackup,
|
||||
app_args=['--group', 'test',
|
||||
'--backup-values', backupPath,
|
||||
'--backup-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST], actual_call[1])
|
||||
|
||||
|
@ -65,8 +65,8 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_create.\
|
||||
return_value = []
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
e = self.assertRaises(DCManagerClientException,
|
||||
|
@ -75,7 +75,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
app_args=['--subcloud', 'subcloud1',
|
||||
'--group', 'test',
|
||||
'--local-only',
|
||||
'--backup-values', backupPath,
|
||||
'--backup-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
self.assertTrue(('The command only applies to a single subcloud or a'
|
||||
' subcloud group, not both.') in str(e))
|
||||
|
@ -84,15 +84,15 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_create.\
|
||||
return_value = []
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
e = self.assertRaises(DCManagerClientException,
|
||||
self.call,
|
||||
subcloud_backup_cmd.CreateSubcloudBackup,
|
||||
app_args=['--local-only',
|
||||
'--backup-values', backupPath,
|
||||
'--backup-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
|
||||
self.assertTrue(('Please provide the subcloud or subcloud group name'
|
||||
|
@ -118,15 +118,15 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_create.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
actual_call = self.call(
|
||||
subcloud_backup_cmd.CreateSubcloudBackup,
|
||||
app_args=['--group', 'test',
|
||||
'--local-only',
|
||||
'--backup-values', backupPath])
|
||||
'--backup-values', backup_path])
|
||||
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST], actual_call[1])
|
||||
|
||||
def test_backup_create_local_only_registry_images(self):
|
||||
|
@ -284,8 +284,8 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_restore.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
actual_call = self.call(
|
||||
|
@ -293,7 +293,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
app_args=['--subcloud', 'subcloud1',
|
||||
'--local-only',
|
||||
'--registry-images',
|
||||
'--restore-values', backupPath,
|
||||
'--restore-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
|
||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
||||
|
@ -316,15 +316,15 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_restore.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
actual_call = self.call(
|
||||
subcloud_backup_cmd.RestoreSubcloudBackup,
|
||||
app_args=['--group', 'test',
|
||||
'--with-install',
|
||||
'--restore-values', backupPath,
|
||||
'--restore-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST], actual_call[1])
|
||||
|
||||
|
@ -332,9 +332,9 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_restore.\
|
||||
return_value = []
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
|
||||
with open(backupPath, mode='w') as f:
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
e = self.assertRaises(DCManagerClientException,
|
||||
|
@ -343,7 +343,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
app_args=['--subcloud', 'subcloud1',
|
||||
'--group', 'test',
|
||||
'--local-only',
|
||||
'--restore-values', backupPath,
|
||||
'--restore-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
self.assertTrue(('The command only applies to a single subcloud or a'
|
||||
' subcloud group, not both.') in str(e))
|
||||
|
@ -352,16 +352,16 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_restore.\
|
||||
return_value = []
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
|
||||
with open(backupPath, mode='w') as f:
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
e = self.assertRaises(DCManagerClientException,
|
||||
self.call,
|
||||
subcloud_backup_cmd.RestoreSubcloudBackup,
|
||||
app_args=['--local-only',
|
||||
'--restore-values', backupPath,
|
||||
'--restore-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
|
||||
self.assertTrue(('Please provide the subcloud or subcloud group name'
|
||||
|
@ -387,16 +387,16 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_restore.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
|
||||
with open(backupPath, mode='w') as f:
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
actual_call = self.call(
|
||||
subcloud_backup_cmd.RestoreSubcloudBackup,
|
||||
app_args=['--group', 'test',
|
||||
'--local-only',
|
||||
'--restore-values', backupPath])
|
||||
'--restore-values', backup_path])
|
||||
self.assertEqual([base.SUBCLOUD_FIELD_RESULT_LIST], actual_call[1])
|
||||
|
||||
def test_backup_restore_local_only_registry_images(self):
|
||||
|
@ -416,8 +416,8 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_restore.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
actual_call = self.call(
|
||||
|
@ -426,7 +426,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
'--with-install',
|
||||
'--local-only',
|
||||
'--registry-images',
|
||||
'--restore-values', backupPath,
|
||||
'--restore-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
|
||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
||||
|
@ -435,8 +435,8 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_restore.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
actual_call = self.call(
|
||||
|
@ -446,7 +446,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
'--release', base.SOFTWARE_VERSION,
|
||||
'--local-only',
|
||||
'--registry-images',
|
||||
'--restore-values', backupPath,
|
||||
'--restore-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
|
||||
self.assertEqual(base.SUBCLOUD_FIELD_RESULT_LIST, actual_call[1])
|
||||
|
@ -455,8 +455,8 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_backup_manager.backup_subcloud_restore.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
backupPath = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backupPath, mode='w') as f:
|
||||
backup_path = os.path.normpath(os.path.join(os.getcwd(), "test.yaml"))
|
||||
with open(backup_path, mode='w') as f:
|
||||
f.write(OVERRIDE_VALUES)
|
||||
|
||||
e = self.assertRaises(DCManagerClientException,
|
||||
|
@ -466,7 +466,7 @@ class TestCLISubcloudBackUpManagerV1(base.BaseCommandTest):
|
|||
'--release', base.SOFTWARE_VERSION,
|
||||
'--local-only',
|
||||
'--registry-images',
|
||||
'--restore-values', backupPath,
|
||||
'--restore-values', backup_path,
|
||||
'--sysadmin-password', 'testpassword'])
|
||||
|
||||
self.assertTrue(('Option --release cannot be used without '
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2020-2023 Wind River Systems, Inc.
|
||||
# Copyright (c) 2020-2024 Wind River Systems, Inc.
|
||||
# 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 a copy of the License at
|
||||
|
@ -12,67 +12,67 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
import mock
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
import mock
|
||||
|
||||
from dcmanagerclient.api.v1 import subcloud_deploy_manager as sdm
|
||||
from dcmanagerclient.commands.v1 \
|
||||
import subcloud_deploy_manager as subcloud_deploy_cmd
|
||||
from dcmanagerclient.commands.v1 import subcloud_deploy_manager as \
|
||||
subcloud_deploy_cmd
|
||||
from dcmanagerclient.exceptions import DCManagerClientException
|
||||
from dcmanagerclient.tests import base
|
||||
|
||||
|
||||
DEPLOY_PLAYBOOK = 'deployment-manager-playbook.yaml'
|
||||
DEPLOY_OVERRIDES = 'deployment-manager-overrides-subcloud.yaml'
|
||||
DEPLOY_CHART = 'deployment-manager.tgz'
|
||||
DEPLOY_PRESTAGE_IMAGES = 'prebuilt-images.lst'
|
||||
DEPLOY_PLAYBOOK = "deployment-manager-playbook.yaml"
|
||||
DEPLOY_OVERRIDES = "deployment-manager-overrides-subcloud.yaml"
|
||||
DEPLOY_CHART = "deployment-manager.tgz"
|
||||
DEPLOY_PRESTAGE_IMAGES = "prebuilt-images.lst"
|
||||
|
||||
SUBCLOUD_DEPLOY_DICT = {
|
||||
'DEPLOY_PLAYBOOK': DEPLOY_PLAYBOOK,
|
||||
'DEPLOY_OVERRIDES': DEPLOY_OVERRIDES,
|
||||
'DEPLOY_CHART': DEPLOY_CHART,
|
||||
'DEPLOY_PRESTAGE_IMAGES': DEPLOY_PRESTAGE_IMAGES,
|
||||
'SOFTWARE_VERSION': base.SOFTWARE_VERSION
|
||||
"DEPLOY_PLAYBOOK": DEPLOY_PLAYBOOK,
|
||||
"DEPLOY_OVERRIDES": DEPLOY_OVERRIDES,
|
||||
"DEPLOY_CHART": DEPLOY_CHART,
|
||||
"DEPLOY_PRESTAGE_IMAGES": DEPLOY_PRESTAGE_IMAGES,
|
||||
"SOFTWARE_VERSION": base.SOFTWARE_VERSION,
|
||||
}
|
||||
|
||||
SUBCLOUD_DEPLOY_ALL = sdm.SubcloudDeploy(
|
||||
deploy_playbook=SUBCLOUD_DEPLOY_DICT['DEPLOY_PLAYBOOK'],
|
||||
deploy_overrides=SUBCLOUD_DEPLOY_DICT['DEPLOY_OVERRIDES'],
|
||||
deploy_chart=SUBCLOUD_DEPLOY_DICT['DEPLOY_CHART'],
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT['DEPLOY_PRESTAGE_IMAGES'],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT['SOFTWARE_VERSION']
|
||||
deploy_playbook=SUBCLOUD_DEPLOY_DICT["DEPLOY_PLAYBOOK"],
|
||||
deploy_overrides=SUBCLOUD_DEPLOY_DICT["DEPLOY_OVERRIDES"],
|
||||
deploy_chart=SUBCLOUD_DEPLOY_DICT["DEPLOY_CHART"],
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT["DEPLOY_PRESTAGE_IMAGES"],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT["SOFTWARE_VERSION"],
|
||||
)
|
||||
|
||||
SUBCLOUD_DEPLOY_PRESTAGE = sdm.SubcloudDeploy(
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT['DEPLOY_PRESTAGE_IMAGES'],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT['SOFTWARE_VERSION']
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT["DEPLOY_PRESTAGE_IMAGES"],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT["SOFTWARE_VERSION"],
|
||||
)
|
||||
|
||||
SUBCLOUD_DEPLOY_NO_PRESTAGE = sdm.SubcloudDeploy(
|
||||
deploy_playbook=SUBCLOUD_DEPLOY_DICT['DEPLOY_PLAYBOOK'],
|
||||
deploy_overrides=SUBCLOUD_DEPLOY_DICT['DEPLOY_OVERRIDES'],
|
||||
deploy_chart=SUBCLOUD_DEPLOY_DICT['DEPLOY_CHART'],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT['SOFTWARE_VERSION']
|
||||
deploy_playbook=SUBCLOUD_DEPLOY_DICT["DEPLOY_PLAYBOOK"],
|
||||
deploy_overrides=SUBCLOUD_DEPLOY_DICT["DEPLOY_OVERRIDES"],
|
||||
deploy_chart=SUBCLOUD_DEPLOY_DICT["DEPLOY_CHART"],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT["SOFTWARE_VERSION"],
|
||||
)
|
||||
|
||||
SUBCLOUD_DEPLOY_NO_PLAYBOOK = sdm.SubcloudDeploy(
|
||||
deploy_overrides=SUBCLOUD_DEPLOY_DICT['DEPLOY_OVERRIDES'],
|
||||
deploy_chart=SUBCLOUD_DEPLOY_DICT['DEPLOY_CHART'],
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT['DEPLOY_PRESTAGE_IMAGES'],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT['SOFTWARE_VERSION']
|
||||
deploy_overrides=SUBCLOUD_DEPLOY_DICT["DEPLOY_OVERRIDES"],
|
||||
deploy_chart=SUBCLOUD_DEPLOY_DICT["DEPLOY_CHART"],
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT["DEPLOY_PRESTAGE_IMAGES"],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT["SOFTWARE_VERSION"],
|
||||
)
|
||||
|
||||
SUBCLOUD_DEPLOY_NO_PLAYBOOK_OVERRIDES = sdm.SubcloudDeploy(
|
||||
deploy_chart=SUBCLOUD_DEPLOY_DICT['DEPLOY_CHART'],
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT['DEPLOY_PRESTAGE_IMAGES'],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT['SOFTWARE_VERSION']
|
||||
deploy_chart=SUBCLOUD_DEPLOY_DICT["DEPLOY_CHART"],
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT["DEPLOY_PRESTAGE_IMAGES"],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT["SOFTWARE_VERSION"],
|
||||
)
|
||||
|
||||
SUBCLOUD_DEPLOY_NO_OVERRIDES_CHART = sdm.SubcloudDeploy(
|
||||
deploy_playbook=SUBCLOUD_DEPLOY_DICT['DEPLOY_PLAYBOOK'],
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT['DEPLOY_PRESTAGE_IMAGES'],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT['SOFTWARE_VERSION']
|
||||
deploy_playbook=SUBCLOUD_DEPLOY_DICT["DEPLOY_PLAYBOOK"],
|
||||
prestage_images=SUBCLOUD_DEPLOY_DICT["DEPLOY_PRESTAGE_IMAGES"],
|
||||
software_version=SUBCLOUD_DEPLOY_DICT["SOFTWARE_VERSION"],
|
||||
)
|
||||
|
||||
|
||||
|
@ -84,38 +84,49 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||
self.client = self.app.client_manager.subcloud_deploy_manager
|
||||
|
||||
def test_subcloud_deploy_show(self):
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_show.\
|
||||
return_value = [SUBCLOUD_DEPLOY_ALL]
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_show.return_value = [
|
||||
SUBCLOUD_DEPLOY_ALL
|
||||
]
|
||||
|
||||
# Without "--release" parameter
|
||||
actual_call1 = self.call(subcloud_deploy_cmd.SubcloudDeployShow)
|
||||
|
||||
self.assertEqual((DEPLOY_PLAYBOOK,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION),
|
||||
actual_call1[1])
|
||||
self.assertEqual(
|
||||
(
|
||||
DEPLOY_PLAYBOOK,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION,
|
||||
),
|
||||
actual_call1[1],
|
||||
)
|
||||
|
||||
# With "--release" parameter
|
||||
actual_call2 = self.call(
|
||||
subcloud_deploy_cmd.SubcloudDeployShow,
|
||||
app_args=['--release', base.SOFTWARE_VERSION])
|
||||
app_args=["--release", base.SOFTWARE_VERSION],
|
||||
)
|
||||
|
||||
self.assertEqual((DEPLOY_PLAYBOOK,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION),
|
||||
actual_call2[1])
|
||||
self.assertEqual(
|
||||
(
|
||||
DEPLOY_PLAYBOOK,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION,
|
||||
),
|
||||
actual_call2[1],
|
||||
)
|
||||
|
||||
def test_subcloud_deploy_upload_all(self):
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.\
|
||||
return_value = [SUBCLOUD_DEPLOY_ALL]
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.return_value = [
|
||||
SUBCLOUD_DEPLOY_ALL
|
||||
]
|
||||
|
||||
with tempfile.NamedTemporaryFile() as f1,\
|
||||
tempfile.NamedTemporaryFile() as f2,\
|
||||
tempfile.NamedTemporaryFile() as f3,\
|
||||
with tempfile.NamedTemporaryFile() as f1, \
|
||||
tempfile.NamedTemporaryFile() as f2, \
|
||||
tempfile.NamedTemporaryFile() as f3, \
|
||||
tempfile.NamedTemporaryFile() as f4:
|
||||
file_path_1 = os.path.abspath(f1.name)
|
||||
file_path_2 = os.path.abspath(f2.name)
|
||||
|
@ -124,24 +135,35 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||
actual_call = self.call(
|
||||
subcloud_deploy_cmd.SubcloudDeployUpload,
|
||||
app_args=[
|
||||
'--deploy-playbook', file_path_1,
|
||||
'--deploy-overrides', file_path_2,
|
||||
'--deploy-chart', file_path_3,
|
||||
'--prestage-images', file_path_4])
|
||||
"--deploy-playbook",
|
||||
file_path_1,
|
||||
"--deploy-overrides",
|
||||
file_path_2,
|
||||
"--deploy-chart",
|
||||
file_path_3,
|
||||
"--prestage-images",
|
||||
file_path_4,
|
||||
],
|
||||
)
|
||||
|
||||
self.assertEqual((DEPLOY_PLAYBOOK,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION),
|
||||
actual_call[1])
|
||||
self.assertEqual(
|
||||
(
|
||||
DEPLOY_PLAYBOOK,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION,
|
||||
),
|
||||
actual_call[1],
|
||||
)
|
||||
|
||||
def test_subcloud_deploy_upload_no_prestage(self):
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.\
|
||||
return_value = [SUBCLOUD_DEPLOY_NO_PRESTAGE]
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.return_value = [
|
||||
SUBCLOUD_DEPLOY_NO_PRESTAGE
|
||||
]
|
||||
|
||||
with tempfile.NamedTemporaryFile() as f1,\
|
||||
tempfile.NamedTemporaryFile() as f2,\
|
||||
with tempfile.NamedTemporaryFile() as f1, \
|
||||
tempfile.NamedTemporaryFile() as f2, \
|
||||
tempfile.NamedTemporaryFile() as f3:
|
||||
file_path_1 = os.path.abspath(f1.name)
|
||||
file_path_2 = os.path.abspath(f2.name)
|
||||
|
@ -149,40 +171,49 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||
actual_call = self.call(
|
||||
subcloud_deploy_cmd.SubcloudDeployUpload,
|
||||
app_args=[
|
||||
'--deploy-playbook', file_path_1,
|
||||
'--deploy-overrides', file_path_2,
|
||||
'--deploy-chart', file_path_3])
|
||||
"--deploy-playbook",
|
||||
file_path_1,
|
||||
"--deploy-overrides",
|
||||
file_path_2,
|
||||
"--deploy-chart",
|
||||
file_path_3,
|
||||
],
|
||||
)
|
||||
|
||||
self.assertEqual((DEPLOY_PLAYBOOK,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
None,
|
||||
base.SOFTWARE_VERSION),
|
||||
actual_call[1])
|
||||
self.assertEqual(
|
||||
(
|
||||
DEPLOY_PLAYBOOK,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
None,
|
||||
base.SOFTWARE_VERSION,
|
||||
),
|
||||
actual_call[1],
|
||||
)
|
||||
|
||||
def test_subcloud_deploy_upload_prestage(self):
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.\
|
||||
return_value = [SUBCLOUD_DEPLOY_PRESTAGE]
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.return_value = [
|
||||
SUBCLOUD_DEPLOY_PRESTAGE
|
||||
]
|
||||
|
||||
with tempfile.NamedTemporaryFile() as f1:
|
||||
file_path_1 = os.path.abspath(f1.name)
|
||||
actual_call = self.call(
|
||||
subcloud_deploy_cmd.SubcloudDeployUpload,
|
||||
app_args=[
|
||||
'--prestage-images', file_path_1])
|
||||
self.assertEqual((None,
|
||||
None,
|
||||
None,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION),
|
||||
actual_call[1])
|
||||
app_args=["--prestage-images", file_path_1],
|
||||
)
|
||||
self.assertEqual(
|
||||
(None, None, None, DEPLOY_PRESTAGE_IMAGES, base.SOFTWARE_VERSION),
|
||||
actual_call[1],
|
||||
)
|
||||
|
||||
def test_subcloud_deploy_upload_no_playbook(self):
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.\
|
||||
return_value = [SUBCLOUD_DEPLOY_NO_PLAYBOOK]
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.return_value = [
|
||||
SUBCLOUD_DEPLOY_NO_PLAYBOOK
|
||||
]
|
||||
|
||||
with tempfile.NamedTemporaryFile() as f1,\
|
||||
tempfile.NamedTemporaryFile() as f2,\
|
||||
with tempfile.NamedTemporaryFile() as f1, \
|
||||
tempfile.NamedTemporaryFile() as f2, \
|
||||
tempfile.NamedTemporaryFile() as f3:
|
||||
file_path_1 = os.path.abspath(f1.name)
|
||||
file_path_2 = os.path.abspath(f2.name)
|
||||
|
@ -190,82 +221,116 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||
actual_call = self.call(
|
||||
subcloud_deploy_cmd.SubcloudDeployUpload,
|
||||
app_args=[
|
||||
'--deploy-overrides', file_path_1,
|
||||
'--deploy-chart', file_path_2,
|
||||
'--prestage-images', file_path_3])
|
||||
self.assertEqual((None,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION),
|
||||
actual_call[1])
|
||||
"--deploy-overrides",
|
||||
file_path_1,
|
||||
"--deploy-chart",
|
||||
file_path_2,
|
||||
"--prestage-images",
|
||||
file_path_3,
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
(
|
||||
None,
|
||||
DEPLOY_OVERRIDES,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION,
|
||||
),
|
||||
actual_call[1],
|
||||
)
|
||||
|
||||
def test_subcloud_deploy_upload_no_playbook_overrides(self):
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.\
|
||||
return_value = [SUBCLOUD_DEPLOY_NO_PLAYBOOK_OVERRIDES]
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.return_value = [
|
||||
SUBCLOUD_DEPLOY_NO_PLAYBOOK_OVERRIDES
|
||||
]
|
||||
|
||||
with tempfile.NamedTemporaryFile() as f1,\
|
||||
with tempfile.NamedTemporaryFile() as f1, \
|
||||
tempfile.NamedTemporaryFile() as f2:
|
||||
file_path_1 = os.path.abspath(f1.name)
|
||||
file_path_2 = os.path.abspath(f2.name)
|
||||
actual_call = self.call(
|
||||
subcloud_deploy_cmd.SubcloudDeployUpload,
|
||||
app_args=[
|
||||
'--deploy-chart', file_path_1,
|
||||
'--prestage-images', file_path_2])
|
||||
self.assertEqual((None,
|
||||
None,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION),
|
||||
actual_call[1])
|
||||
"--deploy-chart",
|
||||
file_path_1,
|
||||
"--prestage-images",
|
||||
file_path_2,
|
||||
],
|
||||
)
|
||||
self.assertEqual((
|
||||
None, None,
|
||||
DEPLOY_CHART,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION
|
||||
), actual_call[1],)
|
||||
|
||||
def test_subcloud_deploy_upload_no_overrides_chart(self):
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.\
|
||||
return_value = [SUBCLOUD_DEPLOY_NO_OVERRIDES_CHART]
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.return_value = [
|
||||
SUBCLOUD_DEPLOY_NO_OVERRIDES_CHART
|
||||
]
|
||||
|
||||
with tempfile.NamedTemporaryFile() as f1,\
|
||||
with tempfile.NamedTemporaryFile() as f1, \
|
||||
tempfile.NamedTemporaryFile() as f2:
|
||||
file_path_1 = os.path.abspath(f1.name)
|
||||
file_path_2 = os.path.abspath(f2.name)
|
||||
actual_call = self.call(
|
||||
subcloud_deploy_cmd.SubcloudDeployUpload,
|
||||
app_args=[
|
||||
'--deploy-playbook', file_path_1,
|
||||
'--prestage-images', file_path_2,
|
||||
'--release', base.SOFTWARE_VERSION])
|
||||
self.assertEqual((DEPLOY_PLAYBOOK,
|
||||
None,
|
||||
None,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION),
|
||||
actual_call[1])
|
||||
"--deploy-playbook",
|
||||
file_path_1,
|
||||
"--prestage-images",
|
||||
file_path_2,
|
||||
"--release",
|
||||
base.SOFTWARE_VERSION,
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
(
|
||||
DEPLOY_PLAYBOOK,
|
||||
None,
|
||||
None,
|
||||
DEPLOY_PRESTAGE_IMAGES,
|
||||
base.SOFTWARE_VERSION,
|
||||
),
|
||||
actual_call[1],
|
||||
)
|
||||
|
||||
@mock.patch('builtins.print')
|
||||
@mock.patch("builtins.print")
|
||||
def test_subcloud_deploy_upload_invalid_path(self, mock_print):
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.\
|
||||
return_value = [SUBCLOUD_DEPLOY_NO_PRESTAGE]
|
||||
file_path_1 = 'not_a_valid_path'
|
||||
with tempfile.NamedTemporaryFile() as f2,\
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_upload.return_value = [
|
||||
SUBCLOUD_DEPLOY_NO_PRESTAGE
|
||||
]
|
||||
mock_print.return_value = mock.ANY
|
||||
file_path_1 = "not_a_valid_path"
|
||||
with tempfile.NamedTemporaryFile() as f2, \
|
||||
tempfile.NamedTemporaryFile() as f3:
|
||||
file_path_2 = os.path.abspath(f2.name)
|
||||
file_path_3 = os.path.abspath(f3.name)
|
||||
|
||||
e = self.assertRaises(DCManagerClientException,
|
||||
self.call,
|
||||
subcloud_deploy_cmd.SubcloudDeployUpload,
|
||||
app_args=['--deploy-playbook', file_path_1,
|
||||
'--deploy-overrides', file_path_2,
|
||||
'--deploy-chart', file_path_3])
|
||||
e = self.assertRaises(
|
||||
DCManagerClientException,
|
||||
self.call,
|
||||
subcloud_deploy_cmd.SubcloudDeployUpload,
|
||||
app_args=[
|
||||
"--deploy-playbook",
|
||||
file_path_1,
|
||||
"--deploy-overrides",
|
||||
file_path_2,
|
||||
"--deploy-chart",
|
||||
file_path_3,
|
||||
],
|
||||
)
|
||||
|
||||
self.assertTrue('deploy_playbook file does not exist: not_a_valid_path'
|
||||
in str(e))
|
||||
self.assertTrue(
|
||||
"deploy_playbook file does not exist: not_a_valid_path" in str(e)
|
||||
)
|
||||
|
||||
def test_subcloud_deploy_delete_with_release(self):
|
||||
|
||||
release_version = base.SOFTWARE_VERSION
|
||||
data = {'prestage_images': 'False', 'deployment_files': 'False'}
|
||||
app_args = ['--release', release_version]
|
||||
data = {"prestage_images": "False", "deployment_files": "False"}
|
||||
app_args = ["--release", release_version]
|
||||
|
||||
self.call(subcloud_deploy_cmd.SubcloudDeployDelete, app_args=app_args)
|
||||
|
||||
|
@ -275,6 +340,6 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
|
|||
def test_subcloud_deploy_delete_without_release(self):
|
||||
|
||||
self.call(subcloud_deploy_cmd.SubcloudDeployDelete)
|
||||
data = {'prestage_images': 'False', 'deployment_files': 'False'}
|
||||
data = {"prestage_images": "False", "deployment_files": "False"}
|
||||
self.client.subcloud_deploy_manager.subcloud_deploy_delete.\
|
||||
assert_called_once_with(None, data=data)
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
#
|
||||
|
||||
import copy
|
||||
import mock
|
||||
import os
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
import mock
|
||||
import yaml
|
||||
|
||||
from dcmanagerclient.commands.v1 import subcloud_manager as subcloud_cmd
|
||||
|
@ -300,9 +301,9 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
|
|||
self.client.subcloud_manager.redeploy_subcloud. \
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
|
||||
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
||||
config_file_path = os.path.abspath(config_file.name)
|
||||
|
@ -334,13 +335,12 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
|
|||
|
||||
@mock.patch('getpass.getpass', return_value='testpassword')
|
||||
@mock.patch('six.moves.input', return_value='redeploy')
|
||||
def test_redeploy_bootstrap_files_does_not_exists(
|
||||
self, mock_input, getpass):
|
||||
def test_redeploy_bootstrap_files_does_not_exists(self, mock_input, getpass):
|
||||
self.client.subcloud_manager.redeploy_subcloud.\
|
||||
return_value = [base.SUBCLOUD_RESOURCE]
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file,\
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
with tempfile.NamedTemporaryFile(mode='w') as bootstrap_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as config_file, \
|
||||
tempfile.NamedTemporaryFile(mode='w') as install_file:
|
||||
|
||||
bootstrap_file_path = os.path.abspath(bootstrap_file.name)
|
||||
config_file_path = os.path.abspath(config_file.name)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
beautifulsoup4 # MIT
|
||||
cliff>=2.3.0 # Apache-2.0
|
||||
osc-lib>=1.2.0 # Apache-2.0
|
||||
osprofiler>=1.4.0 # Apache-2.0
|
||||
|
@ -8,6 +10,5 @@ pbr>=2.0.0 # Apache-2.0
|
|||
python-keystoneclient>=3.8.0 # Apache-2.0
|
||||
PyYAML>=3.10.0 # MIT
|
||||
requests!=2.12.2,!=2.13.0,>=2.10.0 # Apache-2.0
|
||||
requests-toolbelt # Apache-2.0
|
||||
six>=1.9.0 # MIT
|
||||
beautifulsoup4
|
||||
requests-toolbelt
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
hacking>=1.1.0,<=2.0.0 # Apache-2.0
|
||||
astroid==2.11.5;python_version>"3.7" # GPLv2
|
||||
isort<5;python_version>="3.5"
|
||||
pylint==2.14.1;python_version>"3.7" # GPLv2
|
||||
python-openstackclient>=3.3.0 # Apache-2.0
|
||||
sphinx>=1.5.1;python_version<="3.6" # BSD
|
||||
sphinx>=1.6.2;python_version>="3.6" # BSD
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
mock>=2.0 # BSD
|
||||
tempest>=14.0.0 # Apache-2.0
|
||||
testtools>=1.4.0 # MIT
|
||||
PyYAML>=3.1.0
|
||||
yamllint<1.26.1;python_version>="3.0" # GPLv2
|
||||
python-dev-tools;python_version>="3.9"
|
||||
beautifulsoup4;python_version>="3.9"
|
||||
osprofiler;python_version>="3.8"
|
||||
requests_toolbelt;python_version>="3.0"
|
|
@ -1,18 +1,10 @@
|
|||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
hacking!=0.13.0,<0.14,>=0.12.0
|
||||
astroid<= 2.2.5;python_version>="3.0" # GPLv2
|
||||
isort<5;python_version>="3.5"
|
||||
pylint<2.1.0;python_version<"3.0" # GPLv2
|
||||
pylint<2.3.0;python_version>="3.0" # GPLv2
|
||||
python-openstackclient>=3.3.0 # Apache-2.0
|
||||
sphinx>=1.5.1;python_version<="3.6" # BSD
|
||||
sphinx>=1.6.2;python_version>="3.6" # BSD
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
|
||||
flake8 # MIT
|
||||
mock>=2.0 # BSD
|
||||
pylint==2.14.1 # GPLv2
|
||||
python-dev-tools # Apache-2.0
|
||||
tempest>=14.0.0 # Apache-2.0
|
||||
testtools>=1.4.0 # MIT
|
||||
PyYAML>=3.1.0
|
||||
yamllint<1.26.1;python_version>="3.0" # GPLv2
|
||||
python-dev-tools;python_version>="3.9"
|
|
@ -1,6 +1,6 @@
|
|||
[tox]
|
||||
minversion = 2.3
|
||||
envlist = py39,pep8,pylint
|
||||
minversion = 2.3
|
||||
skipsdist = True
|
||||
|
||||
toxworkdir = /tmp/{env:USER}_dc_client_tox
|
||||
|
@ -19,12 +19,12 @@ setenv =
|
|||
OS_STDERR_CAPTURE=1
|
||||
OS_TEST_TIMEOUT=60
|
||||
|
||||
deps = -r{toxinidir}/test-requirements-debian.txt
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/requirements.txt
|
||||
|
||||
allowlist_externals =
|
||||
rm
|
||||
find
|
||||
reno
|
||||
|
||||
[testenv:py39]
|
||||
skipdist = False
|
||||
|
@ -33,24 +33,26 @@ commands =
|
|||
stestr --test-path={[dcclient]client_base_dir}/dcmanagerclient/tests run '{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
deps = -r{toxinidir}/test-requirements-debian.txt
|
||||
commands = flake8
|
||||
|
||||
[testenv:pylint]
|
||||
deps = -r{toxinidir}/test-requirements-debian.txt
|
||||
commands =
|
||||
pylint {posargs} dcmanagerclient --rcfile=./pylint.rc
|
||||
[flake8]
|
||||
# W504 line break after binary operator
|
||||
# W605 invalid escape sequence
|
||||
show-source = True
|
||||
max-line-length = 85
|
||||
ignore = W504, W605
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python3
|
||||
commands = {posargs}
|
||||
[testenv:pylint]
|
||||
commands =
|
||||
pylint {posargs} dcmanagerclient --rcfile=./.pylintrc
|
||||
|
||||
[testenv:cover]
|
||||
setenv =
|
||||
PYTHON=coverage run --parallel-mode
|
||||
PYTHONDONTWRITEBYTECODE=True
|
||||
deps = -r{toxinidir}/test-requirements-debian.txt
|
||||
coverage
|
||||
deps = coverage
|
||||
commands =
|
||||
find {toxinidir} -not -path '{toxinidir}/.tox/*' -name '*.py[c|o]' -delete
|
||||
coverage erase
|
||||
|
@ -61,51 +63,4 @@ commands =
|
|||
coverage report
|
||||
|
||||
[testenv:debug]
|
||||
basepython = python3
|
||||
commands = oslo_debug_helper {posargs}
|
||||
|
||||
[flake8]
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
# W504 line break after binary operator
|
||||
# W605 invalid escape sequence
|
||||
show-source = True
|
||||
ignore = E123,E125,W504,W605,H102
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||
|
||||
[testenv:linters]
|
||||
basepython = python3
|
||||
# bashate ignore:
|
||||
# E006 - accept long lines
|
||||
# E040 - false positive on |& syntax (new in bash 4)
|
||||
allowlist_externals = bash
|
||||
commands =
|
||||
bash -c "find {toxinidir} \
|
||||
\( -name .tox -prune \) \
|
||||
-o -type f -name '*.yaml' \
|
||||
-print0 | xargs -0 yamllint"
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
rm -rf doc/build
|
||||
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
|
||||
allowlist_externals = rm
|
||||
|
||||
[testenv:releasenotes]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
rm -rf releasenotes/build
|
||||
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
allowlist_externals =
|
||||
rm
|
||||
reno
|
||||
|
||||
[testenv:newnote]
|
||||
basepython = python3
|
||||
# Re-use the releasenotes venv
|
||||
envdir = {toxworkdir}/releasenotes
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands = reno new {posargs}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
SQLAlchemy!=1.1.5,!=1.1.6,!=1.1.7,!=1.1.8,>=1.0.10 # MIT
|
||||
stevedore>=1.20.0 # Apache-2.0
|
|
@ -1,5 +0,0 @@
|
|||
PyYAML>=3.1.0
|
||||
yamllint>=0.5.2
|
||||
mock>=2.0 # BSD
|
||||
isort<5;python_version>="3.5"
|
||||
bandit;python_version>="3.5"
|
58
tox.ini
58
tox.ini
|
@ -4,8 +4,9 @@ minversion = 2.3
|
|||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
basepython = python3
|
||||
install_command = pip install \
|
||||
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
|
||||
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
|
||||
{opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
|
@ -15,84 +16,51 @@ setenv =
|
|||
CURRENT_CFG_FILE={toxinidir}/.current.cfg
|
||||
commands = find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -not -path '*/__pycache__/*' -name '*.py[c|o]' -delete
|
||||
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/requirements.txt
|
||||
keyring
|
||||
|
||||
allowlist_externals =
|
||||
rm
|
||||
find
|
||||
reno
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python3
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python3
|
||||
description = Dummy environment to allow flake8 to be run in subdir tox
|
||||
|
||||
[testenv:pep8_Debian]
|
||||
basepython = python3
|
||||
description = Dummy environment to allow pep8 to be run in subdir tox
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python3
|
||||
description = Dummy environment to allow pep8 to be run in subdir tox
|
||||
|
||||
[testenv:pylint]
|
||||
basepython = python3
|
||||
description = Dummy environment to allow pylint to be run in subdir tox
|
||||
|
||||
[testenv:pylint_Debian]
|
||||
basepython = python3
|
||||
description = Dummy environment to allow pylint to be run in subdir tox
|
||||
|
||||
[testenv:linters]
|
||||
basepython = python3
|
||||
allowlist_externals = bash
|
||||
commands =
|
||||
bash -c "find {toxinidir} \
|
||||
\( -name .tox -prune \) \
|
||||
-o -type f -name '*.yaml' \
|
||||
-print0 | xargs -0 yamllint"
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
rm -rf doc/build
|
||||
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
|
||||
allowlist_externals = rm
|
||||
|
||||
[testenv:releasenotes]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
rm -rf releasenotes/build
|
||||
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
allowlist_externals =
|
||||
rm
|
||||
reno
|
||||
|
||||
[testenv:newnote]
|
||||
basepython = python3
|
||||
# Re-use the releasenotes venv
|
||||
envdir = {toxworkdir}/releasenotes
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands = reno --rel-notes-dir {toxinidir}/releasenotes new {posargs}
|
||||
|
||||
[testenv:api-ref]
|
||||
basepython = python3
|
||||
deps =
|
||||
-r{toxinidir}/doc/requirements.txt
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
rm -rf api-ref/build
|
||||
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
|
||||
allowlist_externals = rm
|
||||
|
||||
[testenv:bandit]
|
||||
basepython = python3
|
||||
description = Bandit code scan for *.py files under config folder
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
deps = bandit
|
||||
commands = bandit -r {toxinidir}/ -x '**/.tox/**,**/.eggs/**' -lll
|
||||
|
||||
[testenv:linters]
|
||||
allowlist_externals = bash
|
||||
deps = yamllint
|
||||
commands =
|
||||
bash -c "find {toxinidir} \
|
||||
\( -name .tox -prune \) \
|
||||
-o -type f -name '*.yaml' \
|
||||
-print0 | xargs -0 yamllint"
|
||||
|
|
Loading…
Reference in New Issue