Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47306018ba | ||
| 3d77b33bb0 | |||
| e0b8d6b647 | |||
|
|
db7a5e4bc9 | ||
|
|
825e5cb081 | ||
|
|
a8185c7067 | ||
|
|
4a0b0e76b4 | ||
|
|
1918d3f26b | ||
|
|
2ca6b6b421 | ||
|
|
1086b23454 | ||
|
|
535b9da7d2 | ||
|
|
34a4ad3041 | ||
|
|
39d4c1e944 | ||
|
|
c1fd569b76 | ||
|
|
eed22ea2bb | ||
|
|
47241e0462 | ||
|
|
88d122a21f | ||
|
|
5e928b80be | ||
|
|
723ad12afa | ||
|
|
3926dcc541 | ||
|
|
c557e45ae2 | ||
|
|
0b8dba2cb9 | ||
|
|
496f4c1365 | ||
|
|
2551ff0934 | ||
|
|
adc812746c |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -26,7 +26,7 @@ pip-log.txt
|
||||
.coverage
|
||||
.tox
|
||||
nosetests.xml
|
||||
.testrepository
|
||||
.stestr/
|
||||
.venv
|
||||
|
||||
# Translations
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
host=review.opendev.org
|
||||
port=29418
|
||||
project=openstack/python-watcherclient.git
|
||||
defaultbranch=stable/stein
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[DEFAULT]
|
||||
test_path=${OS_TEST_PATH:-./watcherclient/tests/functional}
|
||||
top_dir=./
|
||||
test_path=./watcherclient/tests/functional
|
||||
top_dir=./
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \
|
||||
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./watcherclient/tests} $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
||||
12
.zuul.yaml
12
.zuul.yaml
@@ -1,9 +1,13 @@
|
||||
- project:
|
||||
templates:
|
||||
- openstack-lower-constraints-jobs
|
||||
- openstack-python-jobs
|
||||
- openstack-python35-jobs
|
||||
- openstack-python36-jobs
|
||||
- publish-openstack-docs-pti
|
||||
- check-requirements
|
||||
- openstackclient-plugin-jobs
|
||||
check:
|
||||
jobs:
|
||||
- watcherclient-tempest-functional:
|
||||
voting: false
|
||||
- openstack-tox-lower-constraints
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-lower-constraints
|
||||
|
||||
@@ -157,7 +157,7 @@ watcher action list
|
||||
[--quote {all,minimal,none,nonnumeric}]
|
||||
[--action-plan <action-plan>] [--audit <audit>]
|
||||
[--detail] [--limit <limit>] [--sort-key <field>]
|
||||
[--sort-dir <direction>]
|
||||
[--sort-dir <direction>] [--marker <marker>]
|
||||
|
||||
List information on retrieved actions.
|
||||
|
||||
@@ -186,6 +186,10 @@ List information on retrieved actions.
|
||||
``--sort-dir <direction>``
|
||||
Sort direction: "asc" (the default) or "desc".
|
||||
|
||||
``--marker <marker>``
|
||||
UUID of the last action in the previous page; displays
|
||||
list of actions after "marker".
|
||||
|
||||
.. _watcher_action_show:
|
||||
|
||||
watcher action show
|
||||
@@ -295,7 +299,8 @@ watcher actionplan list
|
||||
[--fit-width] [--print-empty] [--noindent]
|
||||
[--quote {all,minimal,none,nonnumeric}]
|
||||
[--audit <audit>] [--detail] [--limit <limit>]
|
||||
[--sort-key <field>] [--sort-dir <direction>]
|
||||
[--marker <actionplan>] [--sort-key <field>]
|
||||
[--sort-dir <direction>]
|
||||
|
||||
List information on retrieved action plans.
|
||||
|
||||
@@ -315,6 +320,10 @@ List information on retrieved action plans.
|
||||
0 for no limit. Default is the maximum number used by
|
||||
the Watcher API Service.
|
||||
|
||||
``--marker <actionplan>``
|
||||
The last actionplan UUID of the previous page;
|
||||
displays list of actionplans after "marker".
|
||||
|
||||
``--sort-key <field>``
|
||||
Action Plan field that will be used for sorting.
|
||||
|
||||
@@ -466,7 +475,7 @@ Delete audit command.
|
||||
**Positional arguments:**
|
||||
|
||||
``<audit>``
|
||||
UUID of the audit
|
||||
UUID or name of the audit
|
||||
|
||||
**Optional arguments:**
|
||||
|
||||
@@ -532,7 +541,7 @@ Show detailed information about a given audit.
|
||||
**Positional arguments:**
|
||||
|
||||
``<audit>``
|
||||
UUID of the audit
|
||||
UUID or name of the audit
|
||||
|
||||
**Optional arguments:**
|
||||
|
||||
@@ -556,7 +565,7 @@ Update audit command.
|
||||
**Positional arguments:**
|
||||
|
||||
``<audit>``
|
||||
UUID of the audit.
|
||||
UUID or name of the audit.
|
||||
|
||||
``<op>``
|
||||
Operation: 'add', 'replace', or 'remove'.
|
||||
@@ -680,7 +689,7 @@ watcher audittemplate list
|
||||
[--detail] [--goal <goal>]
|
||||
[--strategy <strategy>] [--limit <limit>]
|
||||
[--sort-key <field>]
|
||||
[--sort-dir <direction>]
|
||||
[--sort-dir <direction>][--marker <marker>]
|
||||
|
||||
List information on retrieved audit templates.
|
||||
|
||||
@@ -709,6 +718,10 @@ List information on retrieved audit templates.
|
||||
``--sort-dir <direction>``
|
||||
Sort direction: "asc" (the default) or "desc".
|
||||
|
||||
``--marker <marker>``
|
||||
UUID of the last audittemplate in the previous page; displays
|
||||
list of audittemplates after "marker".
|
||||
|
||||
.. _watcher_audittemplate_show:
|
||||
|
||||
watcher audittemplate show
|
||||
@@ -781,7 +794,7 @@ watcher goal list
|
||||
[--print-empty] [--noindent]
|
||||
[--quote {all,minimal,none,nonnumeric}] [--detail]
|
||||
[--limit <limit>] [--sort-key <field>]
|
||||
[--sort-dir <direction>]
|
||||
[--sort-dir <direction>][--marker <marker>]
|
||||
|
||||
List information on retrieved goals.
|
||||
|
||||
@@ -804,6 +817,10 @@ List information on retrieved goals.
|
||||
``--sort-dir <direction>``
|
||||
Sort direction: "asc" (the default) or "desc".
|
||||
|
||||
``--marker <marker>``
|
||||
UUID of the last goal in the previous page; displays
|
||||
list of goals after "marker".
|
||||
|
||||
.. _watcher_goal_show:
|
||||
|
||||
watcher goal show
|
||||
@@ -841,7 +858,7 @@ watcher scoringengine list
|
||||
[--quote {all,minimal,none,nonnumeric}]
|
||||
[--detail] [--limit <limit>]
|
||||
[--sort-key <field>]
|
||||
[--sort-dir <direction>]
|
||||
[--sort-dir <direction>][--marker <marker>]
|
||||
|
||||
List information on retrieved scoring engines.
|
||||
|
||||
@@ -864,6 +881,10 @@ List information on retrieved scoring engines.
|
||||
``--sort-dir <direction>``
|
||||
Sort direction: "asc" (the default) or "desc".
|
||||
|
||||
``--marker <marker>``
|
||||
UUID of the last scoringengine in the previous page; displays
|
||||
list of scoringengines after "marker".
|
||||
|
||||
.. _watcher_scoringengine_show:
|
||||
|
||||
watcher scoringengine show
|
||||
@@ -961,6 +982,7 @@ watcher strategy list
|
||||
[--quote {all,minimal,none,nonnumeric}]
|
||||
[--goal <goal>] [--detail] [--limit <limit>]
|
||||
[--sort-key <field>] [--sort-dir <direction>]
|
||||
[--marker <marker>]
|
||||
|
||||
List information on retrieved strategies.
|
||||
|
||||
@@ -986,6 +1008,10 @@ List information on retrieved strategies.
|
||||
``--sort-dir <direction>``
|
||||
Sort direction: "asc" (the default) or "desc".
|
||||
|
||||
``--marker <marker>``
|
||||
UUID of the last strategy in the previous page; displays
|
||||
list of strategies after "marker".
|
||||
|
||||
.. _watcher_strategy_show:
|
||||
|
||||
watcher strategy show
|
||||
@@ -1010,3 +1036,28 @@ Show detailed information about a given strategy.
|
||||
``-h, --help``
|
||||
show this help message and exit
|
||||
|
||||
.. _watcher_strategy_state:
|
||||
|
||||
watcher strategy state
|
||||
----------------------
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
usage: watcher strategy state [-h] [-f {csv,html,json,table,value,yaml}]
|
||||
[-c COLUMN] [--max-width <integer>]
|
||||
[--fit-width] [--print-empty] [--noindent]
|
||||
[--quote {all,minimal,none,nonnumeric}]
|
||||
[--sort-column SORT_COLUMN]
|
||||
<strategy>
|
||||
|
||||
Retrieve information about strategy requirements.
|
||||
|
||||
**Positional arguments:**
|
||||
|
||||
``<strategy>``
|
||||
Name of the strategy
|
||||
|
||||
**Optional arguments:**
|
||||
|
||||
``-h, --help``
|
||||
show this help message and exit
|
||||
|
||||
@@ -69,7 +69,6 @@ pyperclip==1.6.0
|
||||
python-dateutil==2.5.3
|
||||
python-mimeparse==1.6.0
|
||||
python-subunit==1.0.0
|
||||
-e git://git.openstack.org/openstack/python-watcherclient@104894958882a4877dad6f469361d2adb41d0b59#egg=python_watcherclient
|
||||
pytz==2018.3
|
||||
PyYAML==3.12
|
||||
requests==2.18.4
|
||||
@@ -80,10 +79,9 @@ six==1.11.0
|
||||
snowballstemmer==1.2.1
|
||||
Sphinx==1.6.5
|
||||
sphinxcontrib-websupport==1.0.1
|
||||
stestr==1.0.0
|
||||
stestr==2.0.0
|
||||
stevedore==1.28.0
|
||||
tempest==17.1.0
|
||||
testrepository==0.0.18
|
||||
testscenarios==0.4
|
||||
testtools==2.2.0
|
||||
traceback2==1.4.0
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
Babel!=2.4.0,>=2.3.4 # BSD
|
||||
cliff!=2.9.0,>=2.8.0 # Apache-2.0
|
||||
osc-lib>=1.8.0 # Apache-2.0
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
oslo.utils>=3.33.0 # Apache-2.0
|
||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
PrettyTable<0.8,>=0.7.1 # BSD
|
||||
Babel!=2.4.0,>=2.5.3 # BSD
|
||||
cliff!=2.9.0,>=2.11.0 # Apache-2.0
|
||||
osc-lib>=1.10.0 # Apache-2.0
|
||||
oslo.i18n>=3.20.0 # Apache-2.0
|
||||
oslo.utils>=3.36.0 # Apache-2.0
|
||||
pbr!=2.1.0,>=3.1.1 # Apache-2.0
|
||||
PrettyTable<0.8,>=0.7.2 # BSD
|
||||
keystoneauth1>=3.4.0 # Apache-2.0
|
||||
six>=1.10.0 # MIT
|
||||
six>=1.11.0 # MIT
|
||||
PyYAML>=3.12 # MIT
|
||||
|
||||
@@ -9,11 +9,8 @@ mock>=2.0.0 # BSD
|
||||
openstackdocstheme>=1.18.1 # Apache-2.0
|
||||
oslotest>=3.2.0 # Apache-2.0
|
||||
python-subunit>=1.0.0 # Apache-2.0/BSD
|
||||
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
|
||||
testrepository>=0.0.18 # Apache-2.0/BSD
|
||||
sphinx!=1.6.6,!=1.6.7,>=1.6.5 # BSD
|
||||
stestr>=2.0.0 # Apache-2.0
|
||||
testscenarios>=0.4 # Apache-2.0/BSD
|
||||
testtools>=2.2.0 # MIT
|
||||
tempest>=17.1.0 # Apache-2.0
|
||||
|
||||
# Needed for pypi packaging
|
||||
wheel>=0.24.0 # MIT
|
||||
|
||||
20
tox.ini
20
tox.ini
@@ -6,14 +6,14 @@ skipsdist = True
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command =
|
||||
constraints: pip install -U --force-reinstall -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||
constraints: pip install -U --force-reinstall -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/stein} {opts} {packages}
|
||||
pip install -U {opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
OS_TEST_PATH=./watcherclient/tests/unit
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = rm -f .testrepository/times.dbm
|
||||
python setup.py testr --slowest --testr-args='{posargs}'
|
||||
stestr --test-path=./watcherclient/tests/unit run {posargs}
|
||||
stestr slowest
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python3
|
||||
@@ -25,9 +25,14 @@ commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
basepython = python3
|
||||
setenv =
|
||||
PYTHON=coverage run --source watcherclient --parallel-mode
|
||||
commands =
|
||||
python setup.py testr --coverage --testr-args='{posargs}'
|
||||
coverage report
|
||||
stestr run {posargs}
|
||||
coverage combine
|
||||
coverage html -d cover
|
||||
coverage xml -o cover/coverage.xml
|
||||
coverage report
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
@@ -48,9 +53,8 @@ passenv =
|
||||
OS_AUTH_URL
|
||||
OS_IDENTITY_API_VERSION
|
||||
OS_IMAGE_API_VERSION
|
||||
setenv =
|
||||
OS_TEST_PATH = ./watcherclient/tests/functional
|
||||
commands = python setup.py testr --slowest --testr-args='--concurrency=1 {posargs}'
|
||||
commands = stestr --test-path=./watcherclient/tests/functional run --concurrency=1 {posargs}
|
||||
stestr slowest
|
||||
|
||||
[flake8]
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
|
||||
@@ -354,7 +354,15 @@ class HTTPClient(VersionNegotiationMixin):
|
||||
# Read body into string if it isn't obviously image data
|
||||
body_str = None
|
||||
if resp.headers.get('Content-Type') != 'application/octet-stream':
|
||||
body_str = ''.join([chunk for chunk in body_iter])
|
||||
# decoding byte to string is necessary for Python 3 compatibility
|
||||
# this issues has not been found with Python 3 unit tests
|
||||
# because the test creates a fake http response of type str
|
||||
# the if statement satisfies test (str) and real (bytes) behavior
|
||||
body_list = [
|
||||
chunk.decode("utf-8") if isinstance(chunk, bytes)
|
||||
else chunk for chunk in body_iter
|
||||
]
|
||||
body_str = ''.join(body_list)
|
||||
self.log_http_response(resp, body_str)
|
||||
body_iter = six.StringIO(body_str)
|
||||
else:
|
||||
|
||||
@@ -47,8 +47,6 @@ _IDENTITY_API_VERSION_3 = ['3']
|
||||
class WatcherShell(app.App):
|
||||
"""Watcher command line interface."""
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.client = None
|
||||
|
||||
@@ -194,12 +192,12 @@ class WatcherShell(app.App):
|
||||
except Exception as e:
|
||||
if not logging.getLogger('').handlers:
|
||||
logging.basicConfig()
|
||||
self.log.error('Exception raised: %s', str(e))
|
||||
LOG.error('Exception raised: %s', str(e))
|
||||
|
||||
return ret_val
|
||||
|
||||
finally:
|
||||
self.log.info("END return value: %s", ret_val)
|
||||
LOG.info("END return value: %s", ret_val)
|
||||
|
||||
|
||||
def main(argv=sys.argv[1:]):
|
||||
|
||||
@@ -70,7 +70,7 @@ class ShowActionPlan(command.ShowOne):
|
||||
yaml_format.YAMLFormatter().emit_one(
|
||||
column_names=list(resource.capitalize()
|
||||
for resource in formatted_global_efficacy),
|
||||
data=[value for value in formatted_global_efficacy.itervalues()],
|
||||
data=[value for value in formatted_global_efficacy.values()],
|
||||
stdout=out,
|
||||
parsed_args=parsed_args,
|
||||
)
|
||||
|
||||
@@ -200,19 +200,10 @@ class CreateAudit(command.ShowOne):
|
||||
if k in field_list and v is not None)
|
||||
fields = common_utils.args_array_to_dict(fields, 'parameters')
|
||||
|
||||
if fields.get('goal'):
|
||||
if not uuidutils.is_uuid_like(fields['goal']):
|
||||
fields['goal'] = client.goal.get(fields['goal']).uuid
|
||||
|
||||
if fields.get('audit_template_uuid'):
|
||||
if not uuidutils.is_uuid_like(fields['audit_template_uuid']):
|
||||
fields['audit_template_uuid'] = client.audit_template.get(
|
||||
fields['audit_template_uuid']).uuid
|
||||
# optional
|
||||
if fields.get('strategy'):
|
||||
if not uuidutils.is_uuid_like(fields['strategy']):
|
||||
fields['strategy'] = client.strategy.get(
|
||||
fields['strategy']).uuid
|
||||
|
||||
audit = client.audit.create(**fields)
|
||||
if audit.strategy_name is None:
|
||||
|
||||
Reference in New Issue
Block a user