Update tox config for Distributed Cloud Client

Cleanup the tox configuration and requirements.
Fix some files with pylint errors.

Test Plan:
Verify that all Tox tests pass without errors.
1. Successfully executed on the distributedcloud-client dir
- tox -e docs,releasenotes,api-ref,bandit,linters
- tox -e newnote -- new-note
2. Successfully executed on the distributedcloud-client/distributedcloud-client 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:
Hugo Brito 2024-02-13 09:26:07 -03:00 committed by Hugo Nicodemos
parent eb4e7eeeb0
commit b066e15b3e
17 changed files with 211 additions and 407 deletions

View File

@ -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
@ -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

View File

@ -14,9 +14,10 @@
# limitations under the License.
#
from bs4 import BeautifulSoup
import json
from bs4 import BeautifulSoup
from dcmanagerclient import exceptions

View File

@ -17,11 +17,9 @@
#
import copy
import os
import requests
import logging
import os
import requests
import osprofiler.web

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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,
}

View File

@ -28,8 +28,8 @@ 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,\
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)
@ -174,8 +174,8 @@ 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,\
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)
@ -199,8 +199,8 @@ 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,\
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)

View File

@ -113,9 +113,9 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
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)
@ -140,8 +140,8 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
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)
@ -181,8 +181,8 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
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)
@ -204,7 +204,7 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
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)
@ -224,7 +224,7 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
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)
@ -246,7 +246,7 @@ class TestCLISubcloudDeployManagerV1(base.BaseCommandTest):
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,\
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)

View File

@ -300,8 +300,8 @@ 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,\
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)
@ -338,8 +338,8 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest):
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,\
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)

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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,27 @@ 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]
# E123, E125 skipped as they are invalid PEP-8.
# W504 line break after binary operator
# W605 invalid escape sequence
show-source = True
max-line-length = 85
ignore = E123,E125,W504,W605,H102
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 +64,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}

View File

@ -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

View File

@ -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"

56
tox.ini
View File

@ -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
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"