Compare commits

...

49 Commits

Author SHA1 Message Date
Takashi Kajinami
cd49282297 Bump hacking
hacking 3.0.x is quite old. Bump it to the current latest version.

Change-Id: I546d263ff091c47e5e97066499bc3711f4f760c6
2024-09-23 11:56:16 +09:00
Zuul
56e47c38e2 Merge "Remove untested lower-constraints.txt" 2024-03-02 08:33:27 +00:00
Zuul
04b6cc9a04 Merge "Update python classifier in setup.cfg" 2024-03-02 08:33:26 +00:00
Takashi Kajinami
33bcb8b04f Remove six
This library no longer supports python 2 thus usage of six is no longer
needed.

Change-Id: Idb5403b4ce049b4a739489c7bd42fbf694c894dd
2024-01-28 16:59:28 +09:00
Ghanshyam Mann
9aace80a9b Update python classifier in setup.cfg
As per the current release tested runtime, we test
python version from 3.8 to 3.11 so updating the
same in python classifier in setup.cfg

Change-Id: I3a938c4d27f987f4fa1a60d41baf9da74b32a78f
2024-01-09 19:22:07 -08:00
Takashi Kajinami
63d305ca25 Remove untested lower-constraints.txt
The lower constraints job was already removed[1] and the file content
is no longer tested.

[1] 52a3fd062d

Change-Id: Ife61e9de574bc0fd78bd733a33e41ac6cb48d12d
2024-01-08 23:45:26 +09:00
Zuul
a3445ded36 Merge "Switch to 2023.1 Python3 unit tests and generic template name" 2023-02-13 10:08:33 +00:00
chenker
6d6deee2d6 Fix tox error
Change-Id: Id9a8a9693af055ab14d9fcdcfda51d84c7d0d02a
2023-02-07 10:38:34 +00:00
3c6ce105b8 Switch to 2023.1 Python3 unit tests and generic template name
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for antelope. Also,
updating the template name to generic one.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: I8343a54a94d64741325c0cbdd89e01e939bf73ac
2022-09-19 11:20:20 +00:00
Thierry Carrez
e227f82fd6 Update to zed cycle testing runtime
Fix Zed gate for python-watcherclient by updating to Zed testing
runtime.

Change-Id: I49f1156065a9a405691383af755634be7d29af31
2022-09-16 05:26:06 +00:00
765701da39 Add Python3 yoga unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for yoga.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: I5c6406f03a18dc49522bc6caeece0855709a4768
2021-09-10 14:32:22 +00:00
Zuul
dc9b5cb347 Merge "remove unicode from code" 2021-07-13 08:42:38 +00:00
wu.shiming
cf18f56c6f Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: Ie426b70156f777654d78bb3a3dada05f733abdc5
2021-07-06 16:16:01 +08:00
XinxinShen
f2f882e297 Switch testing to Xena testing runtime
Updating the tetsing template to Xena testing runtime:
https://governance.openstack.org/tc/reference/runtimes/xena.html

Change-Id: I7eaad18c98a1850e6d429b52e1e8782d4274ee9b
2021-07-05 15:11:46 +02:00
XinxinShen
add4254a3f Replace deprecated UPPER_CONSTRAINTS_FILE variable
UPPER_CONSTRAINTS_FILE is old name and deprecated

[1] https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file

Change-Id: Ie0cbc9e5e0375b70f28fc9e0b2e64f72f6721717
2021-07-05 15:11:15 +02:00
Zuul
983a347341 Merge "setup.cfg: Replace dashes with underscores" 2021-07-05 13:09:46 +00:00
maaoyu
6a4937d18d setup.cfg: Replace dashes with underscores
Setuptools v54.1.0 introduces a warning that the use of dash-separated
options in 'setup.cfg' will not be supported in a future version [1].
Get ahead of the issue by replacing the dashes with underscores. Without
this, we see 'UserWarning' messages like the following on new enough
versions of setuptools:

  UserWarning: Usage of dash-separated 'description-file' will not be
  supported in future versions. Please use the underscore name
  'description_file' instead

[1] https://github.com/pypa/setuptools/commit/a2e9ae4cb

Change-Id: Ib952d51523684ba21b1247a0cef59ea5552ecdca
2021-07-05 12:05:43 +00:00
zhangboye
d0f41996ff Use py3 as the default runtime for tox
Moving on py3 as the default runtime for tox to avoid to update
this at each new cycle.

Change-Id: I0385351f6bb08b1938568f0a69d7384556c8d78e
2021-07-05 12:04:46 +00:00
Dantali0n
52a3fd062d Drop lower constraints testing
Change-Id: If01998ae7422e5e066241f6fe42d08399cd6478f
2021-07-03 07:01:33 +00:00
zhangboye
c97e16fd01 remove unicode from code
Change-Id: I42166c2db7c305c816bc1934e954d5d4acca659e
2021-01-03 16:31:39 +08:00
Zuul
6a33b44d7f Merge "Remove install unnecessary packages" 2020-10-14 01:52:37 +00:00
maaoyu
41feafc420 Remove install unnecessary packages
The docs requirements migrated to doc/requirements.txt
we need not install things from requirements.txt.

Change-Id: I31972595411d814700b6b51113827f438085170a
2020-09-24 17:28:12 +08:00
e1bcc5f758 Add Python3 wallaby unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for wallaby.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: Iae7748124e2ab374637bc7a30a77433b5981e8b5
2020-09-09 17:40:22 +00:00
Ghanshyam Mann
80f728b14f [goal] Migrate testing to ubuntu focal
As per victoria cycle testing runtime and community goal[1]
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).

Fixing:
- bug#1886298
Bump the lower constraints for required deps which added python3.8 support
in their later version.

Story: #2007865
Task: #40227

Closes-Bug: #1886298

[1] https://governance.openstack.org/tc/goals/selected/victoria/migrate-ci-cd-jobs-to-ubuntu-focal

Change-Id: I56837a6877a22020048b095b9eb528700c786c66
2020-08-16 23:39:29 +00:00
licanwei
2e97950670 remove mox3
Change-Id: I4a1de074db42854871a43ba49dbaa9dc2dfc6621
2020-06-19 09:52:37 +08:00
Andreas Jaeger
21b106dc15 Switch to newer openstackdocstheme version
Switch to openstackdocstheme 2.2.0. Using
the version will allow especially:
* Linking from HTML to PDF document
* Allow parallel building of documents
* Fix some rendering problems

Update Sphinx version as well.

Set openstackdocs_pdf_link to link to PDF file. Note that
the link to the published document only works on docs.openstack.org
where the PDF file is placed in the top-level html directory. The
site-preview places the PDF in a pdf directory.

Remove docs requirements from lower-constraints, they are not needed
during install or test but only for docs building.

openstackdocstheme renames some variables, so follow the renames
before the next release removes them. A couple of variables are also
not needed anymore, remove them.

Change pygments_style to 'native' since old theme version always used
'native' and the theme now respects the setting and using 'sphinx' can
lead to some strange rendering.

See also
http://lists.openstack.org/pipermail/openstack-discuss/2020-May/014971.html

Change-Id: I58edf52ff891328b14edecc9e6e990b34cb730b7
2020-05-21 09:31:12 +02:00
Ghanshyam Mann
7213f7195e Fix hacking min version to 3.0.1
flake8 new release 3.8.0 added new checks and gate pep8
job start failing. hacking 3.0.1 fix the pinning of flake8 to
avoid bringing in a new version with new checks.

Though it is fixed in latest hacking but 2.0 and 3.0 has cap for
flake8 as <4.0.0 which mean flake8 new version 3.9.0 can also
break the pep8 job if new check are added.

To avoid similar gate break in future, we need to bump the hacking min
version.

- http://lists.openstack.org/pipermail/openstack-discuss/2020-May/014828.html

Change-Id: I794bcf026f8c30d81c84b8c26e8b982b0e7b5b17
2020-05-12 21:35:48 -05:00
Zuul
21f42884f1 Merge "Use unittest.mock instead of third party mock" 2020-05-07 06:59:31 +00:00
Zuul
4c57d61f8d Merge "Remove future imports" 2020-05-07 06:58:34 +00:00
qiufossen
e05b498a5f Remove Babel requirement
Babel is not needed as requirement, remove it.

See also
http://lists.openstack.org/pipermail/openstack-discuss/2020-April/014227.html

Change-Id: I3cec266e4326b4f0749d70f6733023c73ca08d80
2020-05-07 10:15:07 +08:00
zhangbailin
8d3ce6c58d Remove future imports
These particular imports are no longer needed in a Python 3-only world.

Change-Id: Ifecdc3c35820977ad561cd2d78471d14b94ee65a
2020-04-30 09:58:27 +00:00
Zuul
bb7af48350 Merge "Bump default tox env from py37 to py38" 2020-04-30 03:10:21 +00:00
jacky06
92c15fa38a Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Idac937dd704ef11dfc33e197f7539e3f7a5feb92
2020-04-29 23:50:12 +08:00
Sean McGinnis
d3cc035ff7 Bump default tox env from py37 to py38
Python 3.8 is now our highest level supported python runtime.
This updates the default tox target environments to swap out
py37 for py38 to make sure local development testing is
covering this version.

This does not impact zuul jobs in any way, nor prevent local
tests against py37. It just changes the default if none is
explicitly provided.

Change-Id: Iac6ba63153af308cd82f3d3a303ce4c3fead0a5f
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-24 10:25:59 -05:00
Sean McGinnis
fb22d3e1f8 Add py38 package metadata
Now that we are running the Victoria tests that include a
voting py38, we can now add the Python 3.8 metadata to the
package information to reflect that support.

Change-Id: Ia0db684e1c03231a93f71cab49cbbd4f23768dda
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-24 08:23:19 -05:00
ac0ccb67a6 Add Python3 victoria unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for victoria.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: I0ec7925e847386f9ea8e2976c0f99dc03904a922
2020-04-11 18:49:26 +00:00
Andreas Jaeger
5946fbb5b1 Cleanup py27 support
Make a few cleanups:
- Remove python 2.7 stanza from setup.py
- Add requires on python >= 3.6 to setup.cfg so that pypi and pip
  know about the requirement
- Remove obsolete sections from setup.cfg: Wheel is not needed for python
  3 only repo
- Update requirements, no need for python_version anymore
- Use modern sphinx-build for docs building, update openstackdocstheme,
  fix api-doc building.

Change-Id: I40b67f330ac850bf45cca742a8b967fd12480ce3
2020-04-04 14:27:51 +02:00
Andreas Jaeger
2830afdc75 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Change-Id: I6bd9fdee0ee275e4d9d3fcaf96c1512933ce35a6
2020-03-31 13:29:10 +02:00
Zuul
1912b9aa82 Merge "Support audit type event" 2020-01-10 01:56:48 +00:00
licanwei
1f9194ced5 Support audit type event
Add a new EVENT type to audit type and change the microversion
to 1.4

Partially Implements: blueprint event-driven-optimization-based

Change-Id: Ia9608534d12f6877f9b93e88fa75fe9457c29347
2020-01-07 15:57:11 +08:00
Zuul
9387369cd7 Merge "Drop python 2.7 support and testing" 2019-12-16 02:42:17 +00:00
licanwei
431319ee4d Watcherclient supports list data model API
Change-Id: I5527414b5e87253d87a4a26398ad5dcce1193e43
Related-Bug: #1854121
2019-12-02 14:41:32 +08:00
Ghanshyam Mann
e3c903cfce Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

python-watcherclient is ready with python 3 and ok to drop the
python 2.7 support.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal - https://review.opendev.org/#/c/691178/

Change-Id: Id66df6c12e7b533381a354937e23e33f992adbfa
2019-10-30 04:34:43 +00:00
Zuul
e3f0a3d2b5 Merge "Fix details doc format error" 2019-10-26 07:23:01 +00:00
chenke
88351df1c2 Fix details doc format error
This error was caused because of rst format.

pls see:
https://github.com/openstack/python-watcherclient/blob/master/doc/source/cli/details.rst

This patch solved this error.

Change-Id: I756d2f6327349c36e4523513a2ac84ad91f7785f
2019-10-26 09:55:34 +08:00
Zuul
df3ec7849e Merge "Switch to Ussuri jobs" 2019-10-25 03:43:15 +00:00
Eric Fried
0c7e306642 Fix python-openstackclient plugin doc build
A help string in a plugin command argument help string contained (a typo
and) some invalid sphinx-isms causing autoprogram-cliff building from
python-openstackclient to fail with:

.../python-openstackclient/doc/source/cli/plugin-commands/watcher.rst:30:Inline emphasis start-string without end-string.
and
<CreateAuditTemplate>:1:Unexpected indentation.

This commit fixes the (typo and) help string formatting.

Change-Id: Ifb668b9ada94b679672f3bab562410bf12f4ca64
2019-10-24 01:34:12 +00:00
kangyufei
db70063cee Switch to Ussuri jobs
Change-Id: I13ae604be95e8b8ddd81a957900199a1113fc3f2
2019-10-22 15:13:55 +08:00
licanwei
1d1f28a256 Build pdf docs
Add a new pdf-docs environment to enable PDF build.

Change-Id: I59bdc7cf339b022458b3b0d1fa3b694b7998c20f
2019-09-17 00:20:25 -07:00
43 changed files with 270 additions and 361 deletions

View File

@@ -1,9 +1,7 @@
- project:
templates:
- openstack-cover-jobs
- openstack-lower-constraints-jobs
- openstack-python-jobs
- openstack-python3-train-jobs
- openstack-python3-jobs
- publish-openstack-docs-pti
- check-requirements
- openstackclient-plugin-jobs

View File

@@ -1,2 +0,0 @@
[python: **.py]

View File

@@ -2,6 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
openstackdocstheme>=1.18.1 # Apache-2.0
sphinx!=1.6.6,!=1.6.7,>=1.6.5,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.5;python_version>='3.4' # BSD
openstackdocstheme>=2.2.1 # Apache-2.0
sphinx>=2.0.0,!=2.1.0 # BSD
sphinxcontrib-apidoc>=0.2.0 # BSD

View File

@@ -620,38 +620,43 @@ Create new audit template.
``--scope <path>``
Part of the cluster on which an audit will be done.
Can be provided either in yaml or json file.
YAML example:
---- host_aggregates:
- id: 1
- id: 2
- id: 3
YAML example:
::
---
- host_aggregates:
- id: 1
- id: 2
- id: 3
- availability_zones:
- name: AZ1
- name: AZ2
- name: AZ1
- name: AZ2
- exclude:
- instances:
- uuid: UUID1
- uuid: UUID2
- compute_nodes:
- name: compute1
JSON example:
[{'host_aggregates': [
{'id': 1},
{'id': 2},
{'id': 3}]},
{'availability_zones': [
{'name': 'AZ1'},
{'name': 'AZ2'}]},
{'exclude': [
{'instances': [
{'uuid': 'UUID1'},
{'uuid': 'UUID2'}
]},
{'compute_nodes': [
{'name': 'compute1'}
]}
]}]
- instances:
- uuid: UUID1
- uuid: UUID2
- compute_nodes:
- name: compute1
JSON example:
::
[
{'host_aggregates': [
{'id': 1},
{'id': 2},
{'id': 3}]},
{'availability_zones': [
{'name': 'AZ1'},
{'name': 'AZ2'}]},
{'exclude': [
{'instances': [
{'uuid': 'UUID1'},
{'uuid': 'UUID2'}]},
{'compute_nodes': [
{'name': 'compute1'}]}]}
]
.. _watcher_audittemplate_delete:

View File

@@ -12,20 +12,26 @@
# limitations under the License.
from watcherclient import version as watcherclient_version
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinxcontrib.apidoc',
'openstackdocstheme',
]
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable
# sphinxcontrib.apidoc options
apidoc_module_dir = '../../watcherclient'
apidoc_output_dir = 'reference/api'
apidoc_excluded_paths = [
'tests/*']
apidoc_separate_modules = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -36,18 +42,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'python-watcherclient'
copyright = u'OpenStack Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
# The full version, including alpha/beta/rc tags.
release = watcherclient_version.version_info.release_string()
# The short X.Y version.
version = watcherclient_version.version_info.version_string()
project = 'python-watcherclient'
copyright = 'OpenStack Foundation'
# A list of ignored prefixes for module index sorting.
modindex_common_prefix = ['watcherclient.']
@@ -60,7 +56,7 @@ add_function_parentheses = True
add_module_names = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = 'native'
# -- Options for HTML output --------------------------------------------------
@@ -83,17 +79,27 @@ latex_documents = [
(
'index',
'%s.tex' % project,
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'
'%s Documentation' % project,
'OpenStack Foundation', 'manual'
),
]
# openstackdocstheme options
repository_name = 'openstack/python-watcherclient'
bug_project = 'python-watcherclient'
bug_tag = ''
# Disable usage of xindy https://bugzilla.redhat.com/show_bug.cgi?id=1643664
latex_use_xindy = False
latex_domain_indices = False
latex_elements = {
'makeindex': '',
'printindex': '',
'preamble': r'\setcounter{tocdepth}{3}',
}
# openstackdocstheme options
openstackdocs_repo_name = 'openstack/python-watcherclient'
openstackdocs_pdf_link = True
openstackdocs_bug_project = 'python-watcherclient'
openstackdocs_bug_tag = ''
# Must set this variable to include year, month, day, hours, and minutes.
html_last_updated_fmt = '%Y-%m-%d %H:%M'
#html_theme_options = {"show_other_versions": "True"}

View File

@@ -1,8 +0,0 @@
======================
Python API Reference
======================
.. toctree::
:maxdepth: 2
autoindex

View File

@@ -10,5 +10,5 @@ done so, you can use the API like so.
.. toctree::
:maxdepth: 2
api/index
api/modules
api_v1

View File

@@ -1,89 +0,0 @@
alabaster==0.7.10
appdirs==1.4.3
asn1crypto==0.23.0
Babel==2.5.3
certifi==2018.1.18
cffi==1.7.0
chardet==3.0.4
cliff==2.11.0
cmd2==0.8.2
coverage==4.0
cryptography==2.1
debtcollector==1.19.0
decorator==4.2.1
deprecation==2.0
docutils==0.11
dogpile.cache==0.6.5
dulwich==0.15.0
extras==1.0.0
fasteners==0.7.0
fixtures==3.0.0
flake8==2.5.5
future==0.16.0
hacking==0.12.0
idna==2.6
imagesize==0.7.1
iso8601==0.1.12
Jinja2==2.10
jmespath==0.9.3
jsonpatch==1.21
jsonpointer==2.0
jsonschema==2.6.0
keystoneauth1==3.4.0
linecache2==1.0.0
MarkupSafe==1.0
mccabe==0.2.1
mock==2.0.0
monotonic==1.4
mox3==0.20.0
msgpack-python==0.4.0
munch==2.2.0
netaddr==0.7.19
netifaces==0.10.6
openstackdocstheme==1.18.1
openstacksdk==0.12.0
os-client-config==1.29.0
os-service-types==1.2.0
os-testr==1.0.0
osc-lib==1.10.0
oslo.concurrency==3.25.0
oslo.config==5.2.0
oslo.context==2.19.2
oslo.i18n==3.20.0
oslo.log==3.36.0
oslo.serialization==2.18.0
oslo.utils==3.36.0
oslotest==3.2.0
packaging==17.1
paramiko==2.0.0
pbr==3.1.1
pep8==1.5.7
pyasn1==0.1.8
pycparser==2.18
pyflakes==0.8.1
Pygments==2.2.0
pyinotify==0.9.6
pyparsing==2.2.0
pyperclip==1.6.0
python-dateutil==2.5.3
python-mimeparse==1.6.0
python-subunit==1.0.0
pytz==2018.3
PyYAML==3.12
requests==2.18.4
requestsexceptions==1.4.0
rfc3986==0.3.1
simplejson==3.13.2
six==1.11.0
snowballstemmer==1.2.1
Sphinx==1.6.5
sphinxcontrib-websupport==1.0.1
stestr==2.0.0
stevedore==1.28.0
tempest==17.1.0
testscenarios==0.4
testtools==2.2.0
traceback2==1.4.0
unittest2==1.1.0
urllib3==1.22
wrapt==1.10.11

View File

@@ -0,0 +1,6 @@
---
upgrade:
- |
Python 2.7 support has been dropped. Last release of python-watcherclient
to support py2.7 is OpenStack Train. The minimum version of Python now
supported by python-watcherclient is Python 3.6.

View File

@@ -1,8 +1,3 @@
# 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.
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
@@ -10,5 +5,4 @@ oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.utils>=3.36.0 # Apache-2.0
pbr!=2.1.0,>=3.1.1 # Apache-2.0
keystoneauth1>=3.4.0 # Apache-2.0
six>=1.11.0 # MIT
PyYAML>=3.12 # MIT
PyYAML>=3.13 # MIT

View File

@@ -1,11 +1,12 @@
[metadata]
name = python-watcherclient
summary = Python client library for Watcher API
description-file =
description_file =
README.rst
author = OpenStack
author-email = openstack-discuss@lists.openstack.org
home-page = https://docs.openstack.org/python-watcherclient/latest/
author_email = openstack-discuss@lists.openstack.org
home_page = https://docs.openstack.org/python-watcherclient/latest/
python_requires = >=3.8
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
@@ -13,11 +14,11 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
[files]
packages =
@@ -113,26 +114,3 @@ autodoc_index_modules = True
autodoc_exclude_modules =
watcherclient.tests.*
api_doc_dir = reference/api
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1
warning-is-error = 1
[bdist_wheel]
universal = 1
[compile_catalog]
directory = watcherclient/locale
domain = watcherclient
[update_catalog]
domain = watcherclient
output_dir = watcherclient/locale
input_file = watcherclient/locale/watcherclient.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext _LI _LW _LE _LC
mapping_file = babel.cfg
output_file = watcherclient/locale/watcherclient.pot

View File

@@ -13,17 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
pbr=True)

View File

@@ -1,11 +1,6 @@
# 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.
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
hacking>=1.1.0,<1.2.0 # Apache-2.0
mock>=2.0.0 # BSD
hacking>=7.0.0,<7.1.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD
stestr>=2.0.0 # Apache-2.0

37
tox.ini
View File

@@ -1,7 +1,6 @@
[tox]
minversion = 2.0
envlist = py36,py37,py27,pep8
skipsdist = True
minversion = 3.18.0
envlist = py3,pep8
[testenv]
usedevelop = True
@@ -11,10 +10,10 @@ install_command = pip install {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
whitelist_externals =
allowlist_externals =
rm
commands = rm -f .testrepository/times.dbm
# The --test-path is defined in .stestr.conf
@@ -43,10 +42,22 @@ commands =
[testenv:docs]
basepython = python3
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands = python setup.py build_sphinx
commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:pdf-docs]
basepython = python3
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
allowlist_externals =
rm
make
commands =
rm -rf doc/build/pdf
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:debug]
basepython = python3
@@ -56,7 +67,7 @@ commands = oslo_debug_helper -t watcherclient/tests/unit {posargs}
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
enable-extensions = H203,H106
ignore = E123,E125
ignore = E123,E125,W504
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
@@ -66,11 +77,3 @@ commands = python setup.py bdist_wheel
[hacking]
import_exceptions = watcherclient._i18n
[testenv:lower-constraints]
basepython = python3
install_command = pip install -U {opts} {packages}
deps =
-c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt

View File

@@ -39,10 +39,9 @@ Base utilities to build API operation managers and objects on top of.
import abc
import copy
from urllib import parse
from oslo_utils import strutils
import six
from six.moves.urllib import parse
from watcherclient._i18n import _
from watcherclient.common.apiclient import exceptions
@@ -224,8 +223,7 @@ class BaseManager(HookableMixin):
return self.client.delete(url)
@six.add_metaclass(abc.ABCMeta)
class ManagerWithFind(BaseManager):
class ManagerWithFind(BaseManager, metaclass=abc.ABCMeta):
"""Manager with additional `find()`/`findall()` methods."""
@abc.abstractmethod

View File

@@ -36,8 +36,6 @@ Exception definitions.
import inspect
import sys
import six
from watcherclient._i18n import _
@@ -457,7 +455,7 @@ def from_response(response, method, url):
kwargs["message"] = (error.get("message") or
error.get("faultstring"))
kwargs["details"] = (error.get("details") or
six.text_type(body))
str(body))
elif content_type.startswith("text/"):
kwargs["details"] = response.text

View File

@@ -19,8 +19,7 @@ Base utilities to build API operation managers and objects on top of.
"""
import copy
import six.moves.urllib.parse as urlparse
from urllib import parse as urlparse
from watcherclient.common.apiclient import base

View File

@@ -18,7 +18,6 @@ import logging
from cliff import command
from cliff import lister
from cliff import show
import six
class CommandMeta(abc.ABCMeta):
@@ -30,8 +29,7 @@ class CommandMeta(abc.ABCMeta):
return super(CommandMeta, mcs).__new__(mcs, name, bases, cls_dict)
@six.add_metaclass(CommandMeta)
class Command(command.Command):
class Command(command.Command, metaclass=CommandMeta):
def run(self, parsed_args):
self.log.debug('run(%s)', parsed_args)

View File

@@ -17,21 +17,21 @@ import copy
from distutils import version
import functools
import hashlib
import http.client
import io
import logging
import os
import socket
import ssl
import textwrap
import time
from urllib import parse as urlparse
from keystoneauth1 import adapter
from keystoneauth1 import exceptions as kexceptions
from oslo_serialization import jsonutils
from oslo_utils import strutils
import requests
import six
from six.moves import http_client
import six.moves.urllib.parse as urlparse
from watcherclient._i18n import _
from watcherclient.common import api_versioning
@@ -40,8 +40,8 @@ from watcherclient import exceptions
# Record the latest version that this client was tested with.
DEFAULT_VER = '1.latest'
# Minor version 2 for adding force option to audit
LAST_KNOWN_API_VERSION = 2
# Minor version 4 for adding webhook API
LAST_KNOWN_API_VERSION = 4
LATEST_VERSION = '1.{}'.format(LAST_KNOWN_API_VERSION)
LOG = logging.getLogger(__name__)
@@ -247,7 +247,7 @@ class HTTPClient(VersionNegotiationMixin):
if not self.session.verify:
curl.append('-k')
elif isinstance(self.session.verify, six.string_types):
elif isinstance(self.session.verify, str):
curl.append('--cacert %s' % self.session.verify)
if self.session.cert:
@@ -325,7 +325,7 @@ class HTTPClient(VersionNegotiationMixin):
# to servers that did not support microversions. Details here:
# http://specs.openstack.org/openstack/watcher-specs/specs/kilo/api-microversions.html#use-case-3b-new-client-communicating-with-a-old-watcher-user-specified # noqa
if resp.status_code == http_client.NOT_ACCEPTABLE:
if resp.status_code == http.client.NOT_ACCEPTABLE:
negotiated_ver = self.negotiate_version(self.session, resp)
kwargs['headers']['OpenStack-API-Version'] = (
' '.join(['infra-optim', negotiated_ver]))
@@ -357,21 +357,21 @@ class HTTPClient(VersionNegotiationMixin):
]
body_str = ''.join(body_list)
self.log_http_response(resp, body_str)
body_iter = six.StringIO(body_str)
body_iter = io.StringIO(body_str)
else:
self.log_http_response(resp)
if resp.status_code >= http_client.BAD_REQUEST:
if resp.status_code >= http.client.BAD_REQUEST:
error_json = _extract_error_json(body_str)
raise exceptions.from_response(
resp, error_json.get('faultstring'),
error_json.get('debuginfo'), method, url)
elif resp.status_code in (http_client.MOVED_PERMANENTLY,
http_client.FOUND,
http_client.USE_PROXY):
elif resp.status_code in (http.client.MOVED_PERMANENTLY,
http.client.FOUND,
http.client.USE_PROXY):
# Redirected. Reissue the request to the new location.
return self._http_request(resp['location'], method, **kwargs)
elif resp.status_code == http_client.MULTIPLE_CHOICES:
elif resp.status_code == http.client.MULTIPLE_CHOICES:
raise exceptions.from_response(resp, method=method, url=url)
return resp, body_iter
@@ -387,8 +387,8 @@ class HTTPClient(VersionNegotiationMixin):
resp, body_iter = self._http_request(url, method, **kwargs)
content_type = resp.headers.get('Content-Type')
if (resp.status_code in (http_client.NO_CONTENT,
http_client.RESET_CONTENT) or
if (resp.status_code in (http.client.NO_CONTENT,
http.client.RESET_CONTENT) or
content_type is None):
return resp, list()
@@ -410,7 +410,7 @@ class HTTPClient(VersionNegotiationMixin):
return self._http_request(url, method, **kwargs)
class VerifiedHTTPSConnection(six.moves.http_client.HTTPSConnection):
class VerifiedHTTPSConnection(http.client.HTTPSConnection):
"""httplib-compatible connection using client-side SSL authentication
:see http://code.activestate.com/recipes/
@@ -419,9 +419,8 @@ class VerifiedHTTPSConnection(six.moves.http_client.HTTPSConnection):
def __init__(self, host, port, key_file=None, cert_file=None,
ca_file=None, timeout=None, insecure=False):
six.moves.http_client.HTTPSConnection.__init__(self, host, port,
key_file=key_file,
cert_file=cert_file)
super(VerifiedHTTPSConnection, self).__init__(
self, host, port, key_file=key_file, cert_file=cert_file)
self.key_file = key_file
self.cert_file = cert_file
if ca_file is not None:
@@ -503,7 +502,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
def _http_request(self, url, method, **kwargs):
kwargs.setdefault('user_agent', USER_AGENT)
kwargs.setdefault('auth', self.auth)
if isinstance(self.endpoint_override, six.string_types):
if isinstance(self.endpoint_override, str):
kwargs.setdefault(
'endpoint_override',
_trim_endpoint_api_version(self.endpoint_override)
@@ -527,22 +526,22 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
resp = self.session.request(url, method,
raise_exc=False, **kwargs)
if resp.status_code == http_client.NOT_ACCEPTABLE:
if resp.status_code == http.client.NOT_ACCEPTABLE:
negotiated_ver = self.negotiate_version(self.session, resp)
kwargs['headers']['OpenStack-API-Version'] = (
' '.join(['infra-optim', negotiated_ver]))
return self._http_request(url, method, **kwargs)
if resp.status_code >= http_client.BAD_REQUEST:
if resp.status_code >= http.client.BAD_REQUEST:
error_json = _extract_error_json(resp.content)
raise exceptions.from_response(
resp, error_json.get('faultstring'),
error_json.get('debuginfo'), method, url)
elif resp.status_code in (http_client.MOVED_PERMANENTLY,
http_client.FOUND, http_client.USE_PROXY):
elif resp.status_code in (http.client.MOVED_PERMANENTLY,
http.client.FOUND, http.client.USE_PROXY):
# Redirected. Reissue the request to the new location.
location = resp.headers.get('location')
resp = self._http_request(location, method, **kwargs)
elif resp.status_code == http_client.MULTIPLE_CHOICES:
elif resp.status_code == http.client.MULTIPLE_CHOICES:
raise exceptions.from_response(resp, method=method, url=url)
return resp
@@ -558,7 +557,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
body = resp.content
content_type = resp.headers.get('content-type', None)
status = resp.status_code
if (status in (http_client.NO_CONTENT, http_client.RESET_CONTENT) or
if (status in (http.client.NO_CONTENT, http.client.RESET_CONTENT) or
content_type is None):
return resp, list()
if 'application/json' in content_type:

View File

@@ -14,8 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import print_function
import argparse
import os
import uuid

View File

@@ -71,6 +71,7 @@ class AmbiguousAuthSystem(exceptions.ClientException):
"""Could not obtain token and endpoint using provided credentials."""
pass
# Alias for backwards compatibility
AmbigiousAuthSystem = AmbiguousAuthSystem

View File

@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from watcherclient.common import api_versioning
from watcherclient import exceptions

View File

@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from keystoneauth1 import loading as kaloading

View File

@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from watcherclient.common.apiclient import exceptions as exc
from watcherclient.common import utils

View File

@@ -14,12 +14,12 @@
# under the License.
import copy
import io
import os
from unittest import mock
import fixtures
import mock
from oslo_utils import strutils
import six
import testtools
@@ -51,7 +51,7 @@ class FakeAPI(object):
def raw_request(self, *args, **kwargs):
response = self._request(*args, **kwargs)
body_iter = iter(six.StringIO(response[1]))
body_iter = iter(io.StringIO(response[1]))
return FakeResponse(response[0]), body_iter
def json_request(self, *args, **kwargs):

View File

@@ -14,8 +14,8 @@
# limitations under the License.
import shlex
from unittest import mock
import mock
from osc_lib import utils as oscutils
from oslo_serialization import jsonutils

View File

@@ -14,7 +14,7 @@
# under the License.
import copy
import mock
from unittest import mock
import testtools
from testtools import matchers

View File

@@ -14,10 +14,11 @@
# limitations under the License.
import datetime
import mock
import six
import io
from unittest import mock
from oslo_utils.uuidutils import generate_uuid
from watcherclient import exceptions
from watcherclient import shell
from watcherclient.tests.unit.v1 import base
@@ -103,7 +104,7 @@ class ActionPlanShellTest(base.CommandTestCase):
self.m_audit_template_mgr_cls.return_value = self.m_audit_template_mgr
self.m_action_plan_mgr_cls.return_value = self.m_action_plan_mgr
self.stdout = six.StringIO()
self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_action_plan_list(self):

View File

@@ -14,8 +14,8 @@
# under the License.
import datetime
import mock
import six
import io
from unittest import mock
from watcherclient import exceptions
from watcherclient import shell
@@ -95,7 +95,7 @@ class ActionShellTest(base.CommandTestCase):
self.m_action_mgr_cls.return_value = self.m_action_mgr
self.m_action_plan_mgr_cls.return_value = self.m_action_plan_mgr
self.stdout = six.StringIO()
self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_action_list(self):

View File

@@ -14,8 +14,8 @@
# under the License.
import datetime
import mock
import six
import io
from unittest import mock
from watcherclient import shell
from watcherclient.tests.unit.v1 import base
@@ -163,7 +163,7 @@ class AuditShellTest(base.CommandTestCase):
self.m_audit_template_mgr_cls.return_value = self.m_audit_template_mgr
# stdout mock
self.stdout = six.StringIO()
self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_audit_list(self):
@@ -426,6 +426,23 @@ class AuditShellTest(base.CommandTestCase):
parameters={'para1': 10, 'para2': 20}
)
def test_do_audit_create_with_type_event(self):
audit = resource.Audit(mock.Mock(), self.AUDIT_1)
self.m_audit_mgr.create.return_value = audit
exit_code, result = self.run_cmd(
'audit create -g fc087747-61be-4aad-8126-b701731ae836 -t EVENT')
self.assertEqual(0, exit_code)
self.assertEqual(
self.resource_as_dict(audit, self.FIELDS, self.FIELD_LABELS),
result)
self.m_audit_mgr.create.assert_called_once_with(
goal='fc087747-61be-4aad-8126-b701731ae836',
auto_trigger=False,
audit_type='EVENT'
)
def test_do_audit_create_with_type_continuous(self):
audit = resource.Audit(mock.Mock(), self.AUDIT_1)
self.m_audit_mgr.create.return_value = audit
@@ -642,6 +659,24 @@ class AuditShellTestv12(AuditShellTest):
force=False
)
def test_do_audit_create_with_type_event(self):
audit = resource.Audit(mock.Mock(), self.AUDIT_1)
self.m_audit_mgr.create.return_value = audit
exit_code, result = self.run_cmd(
'audit create -g fc087747-61be-4aad-8126-b701731ae836 -t EVENT')
self.assertEqual(0, exit_code)
self.assertEqual(
self.resource_as_dict(audit, self.FIELDS, self.FIELD_LABELS),
result)
self.m_audit_mgr.create.assert_called_once_with(
goal='fc087747-61be-4aad-8126-b701731ae836',
auto_trigger=False,
audit_type='EVENT',
force=False
)
def test_do_audit_create_with_name(self):
audit = resource.Audit(mock.Mock(), self.AUDIT_1)
self.m_audit_mgr.create.return_value = audit

View File

@@ -14,8 +14,8 @@
# under the License.
import copy
from urllib import parse as urlparse
from six.moves.urllib import parse as urlparse
from testtools import matchers
from watcherclient.tests.unit import utils

View File

@@ -14,8 +14,8 @@
# under the License.
import datetime
import mock
import six
import io
from unittest import mock
from watcherclient import shell
from watcherclient.tests.unit.v1 import base
@@ -107,7 +107,7 @@ class AuditTemplateShellTest(base.CommandTestCase):
self.m_audit_template_mgr_cls.return_value = self.m_audit_template_mgr
# stdout mock
self.stdout = six.StringIO()
self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_audit_template_list(self):

View File

@@ -12,8 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import six
import io
from unittest import mock
from watcherclient import shell
from watcherclient.tests.unit.v1 import base
@@ -90,7 +91,7 @@ class DataModelShellTest(base.CommandTestCase):
self.m_data_model_mgr_cls.return_value = self.m_data_model_mgr
self.stdout = six.StringIO()
self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_data_model_list(self):

View File

@@ -14,8 +14,8 @@
# limitations under the License.
import datetime
import mock
import six
import io
from unittest import mock
from watcherclient import shell
from watcherclient.tests.unit.v1 import base
@@ -72,7 +72,7 @@ class GoalShellTest(base.CommandTestCase):
self.m_goal_mgr = mock.Mock()
self.m_goal_mgr_cls.return_value = self.m_goal_mgr
self.stdout = six.StringIO()
self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_goal_list(self):

View File

@@ -14,8 +14,8 @@
# limitations under the License.
import datetime
import mock
import six
import io
from unittest import mock
from watcherclient import shell
from watcherclient.tests.unit.v1 import base
@@ -62,7 +62,7 @@ class ScoringEngineShellTest(base.CommandTestCase):
self.m_se_mgr = mock.Mock()
self.m_se_mgr_cls.return_value = self.m_se_mgr
self.stdout = six.StringIO()
self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_scoringengine_list(self):

View File

@@ -14,8 +14,8 @@
# limitations under the License.
import datetime
import mock
import six
import io
from unittest import mock
from watcherclient import shell
from watcherclient.tests.unit.v1 import base
@@ -61,7 +61,7 @@ class ServiceShellTest(base.CommandTestCase):
self.m_service_mgr = mock.Mock()
self.m_service_mgr_cls.return_value = self.m_service_mgr
self.stdout = six.StringIO()
self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_service_list(self):

View File

@@ -14,8 +14,8 @@
# limitations under the License.
import datetime
import mock
import six
import io
from unittest import mock
from oslo_serialization import jsonutils
@@ -69,7 +69,7 @@ class StrategyShellTest(base.CommandTestCase):
self.m_strategy_mgr = mock.Mock()
self.m_strategy_mgr_cls.return_value = self.m_strategy_mgr
self.stdout = six.StringIO()
self.stdout = io.StringIO()
self.cmd = shell.WatcherShell(stdout=self.stdout)
def test_do_strategy_list(self):

View File

@@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import io
from cliff.formatters import yaml_format
from osc_lib import utils
from oslo_utils import uuidutils
import six
from watcherclient._i18n import _
from watcherclient.common import command
@@ -51,7 +52,7 @@ class ShowActionPlan(command.ShowOne):
return parser
def _format_indicators(self, action_plan, parsed_args):
out = six.StringIO()
out = io.StringIO()
efficacy_indicators = action_plan.efficacy_indicators
fields = ['name', 'description', 'value', 'unit']
yaml_format.YAMLFormatter().emit_list(
@@ -66,7 +67,7 @@ class ShowActionPlan(command.ShowOne):
def _format_global_efficacy(self, global_efficacy, parsed_args):
formatted_global_efficacy = format_global_efficacy(global_efficacy)
out = six.StringIO()
out = io.StringIO()
yaml_format.YAMLFormatter().emit_one(
column_names=list(resource.capitalize()
for resource in formatted_global_efficacy),
@@ -143,7 +144,7 @@ class ListActionPlan(command.Lister):
return parser
def _format_indicators(self, action_plan, parsed_args):
out = six.StringIO()
out = io.StringIO()
efficacy_indicators = action_plan.efficacy_indicators
fields = ['name', 'value', 'unit']
yaml_format.YAMLFormatter().emit_list(
@@ -158,7 +159,7 @@ class ListActionPlan(command.Lister):
def _format_global_efficacy(self, global_efficacy, parsed_args):
formatted_global_efficacy = format_global_efficacy(global_efficacy)
out = six.StringIO()
out = io.StringIO()
yaml_format.YAMLFormatter().emit_one(
column_names=list(resource.capitalize()
for resource in formatted_global_efficacy),

View File

@@ -167,8 +167,8 @@ class CreateAudit(command.ShowOne):
dest='audit_type',
metavar='<audit_type>',
default='ONESHOT',
choices=['ONESHOT', 'CONTINUOUS'],
help=_("Audit type. It must be ONESHOT or CONTINUOUS. "
choices=['ONESHOT', 'CONTINUOUS', 'EVENT'],
help=_("Audit type. It must be ONESHOT, CONTINUOUS or EVENT. "
"Default is ONESHOT."))
parser.add_argument(
'-p', '--parameter',
@@ -182,7 +182,7 @@ class CreateAudit(command.ShowOne):
dest='interval',
metavar='<interval>',
help=_('Audit interval (in seconds or cron format). '
'Cron inteval can be used like: "*/5 * * * *". '
'Cron interval can be used like: ``*/5 * * * *``. '
'Only used if the audit is CONTINUOUS.'))
parser.add_argument(
'-g', '--goal',

View File

@@ -167,8 +167,8 @@ class CreateAuditTemplate(command.ShowOne):
metavar='<path>',
help=_("Part of the cluster on which an audit will be done.\n"
"Can be provided either in yaml or json file.\n"
"YAML example:\n"
"---\n"
"YAML example::\n"
"\n"
" - compute:\n"
" - host_aggregates:\n"
" - id: 1\n"
@@ -201,48 +201,49 @@ class CreateAuditTemplate(command.ShowOne):
" - uuid: UUID1\n"
" - uuid: UUID2\n"
"\n"
"JSON example:\n"
"[\n"
" {\"compute\":\n"
" [{\"host_aggregates\": [\n"
" {\"id\": 1},\n"
" {\"id\": 2},\n"
" {\"id\": 3}]},\n"
" {\"availability_zones\": [\n"
" {\"name\": \"AZ1\"},\n"
" {\"name\": \"AZ2\"}]},\n"
" {\"exclude\": [\n"
" {\"instances\": [\n"
" {\"uuid\": \"UUID1\"},\n"
" {\"uuid\": \"UUID2\"}\n"
" ]},\n"
" {\"compute_nodes\": [\n"
" {\"name\": \"compute1\"}\n"
" ]}\n"
" ]}]\n"
" },\n"
" {\"storage\":\n"
" [{\"availability_zones\": [\n"
" {\"name\": \"AZ1\"},\n"
" {\"name\": \"AZ2\"}]},\n"
" {\"volume_types\": [\n"
" {\"name\": \"lvm1\"},\n"
" {\"name\": \"lvm2\"}]},\n"
" {\"exclude\": [\n"
" {\"storage_pools\": [\n"
" {\"name\": \"host0@backend0#pool0\"},\n"
" {\"name\": \"host1@backend1#pool1\"}\n"
" ]},\n"
" {\"volumes\": [\n"
" {\"uuid\": \"UUID1\"},\n"
" {\"uuid\": \"UUID2\"}\n"
" ]},\n"
" {\"projects\": [\n"
" {\"uuid\": \"UUID1\"},\n"
" {\"uuid\": \"UUID2\"}\n"
" ]},\n"
" ]}]\n"
" }\n"
"JSON example::\n"
"\n"
" [\n"
" {\"compute\":\n"
" [{\"host_aggregates\": [\n"
" {\"id\": 1},\n"
" {\"id\": 2},\n"
" {\"id\": 3}]},\n"
" {\"availability_zones\": [\n"
" {\"name\": \"AZ1\"},\n"
" {\"name\": \"AZ2\"}]},\n"
" {\"exclude\": [\n"
" {\"instances\": [\n"
" {\"uuid\": \"UUID1\"},\n"
" {\"uuid\": \"UUID2\"}\n"
" ]},\n"
" {\"compute_nodes\": [\n"
" {\"name\": \"compute1\"}\n"
" ]}\n"
" ]}]\n"
" },\n"
" {\"storage\":\n"
" [{\"availability_zones\": [\n"
" {\"name\": \"AZ1\"},\n"
" {\"name\": \"AZ2\"}]},\n"
" {\"volume_types\": [\n"
" {\"name\": \"lvm1\"},\n"
" {\"name\": \"lvm2\"}]},\n"
" {\"exclude\": [\n"
" {\"storage_pools\": [\n"
" {\"name\": \"host0@backend0#pool0\"},\n"
" {\"name\": \"host1@backend1#pool1\"}\n"
" ]},\n"
" {\"volumes\": [\n"
" {\"uuid\": \"UUID1\"},\n"
" {\"uuid\": \"UUID2\"}\n"
" ]},\n"
" {\"projects\": [\n"
" {\"uuid\": \"UUID1\"},\n"
" {\"uuid\": \"UUID2\"}\n"
" ]},\n"
" ]}]\n"
" }\n"
" ]\n"
)
)

View File

@@ -14,8 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import io
from osc_lib import utils
import six
from watcherclient._i18n import _
from watcherclient.common import command
@@ -37,7 +38,7 @@ class ShowGoal(command.ShowOne):
return parser
def _format_indicator_spec_table(self, spec, parsed_args):
out = six.StringIO()
out = io.StringIO()
self.formatter.emit_one(
column_names=list(field.capitalize() for field in spec.keys()),
data=utils.get_dict_properties(spec, spec.keys()),
@@ -107,7 +108,7 @@ class ListGoal(command.Lister):
return parser
def _format_indicator_spec_table(self, goal, parsed_args):
out = six.StringIO()
out = io.StringIO()
efficacy_specification = goal.efficacy_specification
fields = ['name', 'unit']
self.formatter.emit_list(

View File

@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import six.moves.urllib.parse as parse
from urllib import parse
from watcherclient.common import base
from watcherclient.common import utils

View File

@@ -71,7 +71,7 @@ class StateStrategy(command.Lister):
def _format_spec(self, requirements):
for req in requirements:
if type(req.state) == list:
if isinstance(req.state, list):
req.state = jsonutils.dumps(req.state, indent=2)
return requirements