Compare commits
179 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
582b52b1b8 | ||
|
|
4d0eb4c55a | ||
|
|
3e9b0d678e | ||
|
|
b34b746d1c | ||
|
|
baf0133c5b | ||
| e5bd6e00cb | |||
| 827d474cc4 | |||
|
|
6681724daa | ||
|
|
8d62995cf4 | ||
|
|
d82be4c8c4 | ||
|
|
152804168d | ||
|
|
4a4add3dcc | ||
|
|
db012f1f8f | ||
|
|
a4c020c19f | ||
|
|
8ef72f18c4 | ||
|
|
673905fead | ||
|
|
d886672fb5 | ||
|
|
83ccfbb177 | ||
|
|
4c47c7364c | ||
|
|
8acf01859c | ||
|
|
d4af8d8834 | ||
|
|
40d8df21c8 | ||
|
|
b87399cb2c | ||
|
|
9bfefbf9ab | ||
|
|
b84039d7d4 | ||
|
|
f8ead12481 | ||
|
|
85e4e364b7 | ||
|
|
ed9ce5b952 | ||
|
|
731e019bc1 | ||
|
|
a22dab5f88 | ||
|
|
0d7233055d | ||
|
|
2777a9bba8 | ||
|
|
e359488cde | ||
|
|
a1b6eed54c | ||
|
|
a907c2d0cd | ||
|
|
d38bb255ed | ||
|
|
30e2aad126 | ||
|
|
bc0fb4f051 | ||
|
|
ef533eb151 | ||
|
|
3c160af376 | ||
|
|
186029ac87 | ||
|
|
b9112a1199 | ||
|
|
9d301fa14a | ||
|
|
15d7d78b8b | ||
|
|
81b84bcff5 | ||
|
|
79880c2dff | ||
|
|
32259fe287 | ||
|
|
d36ba79e77 | ||
|
|
4f5487b5e1 | ||
|
|
7bf192a981 | ||
|
|
f8b341c0f3 | ||
|
|
abd6d8a0cb | ||
|
|
147e4cd383 | ||
|
|
3988e9e7a8 | ||
|
|
88131d19fd | ||
|
|
c1668fff44 | ||
|
|
1a6703266f | ||
|
|
fada471714 | ||
|
|
1cd8c38d95 | ||
|
|
0257aa9116 | ||
|
|
aa9d1a65f6 | ||
|
|
b5f584dafa | ||
|
|
bf706365ea | ||
|
|
7898268426 | ||
|
|
1eecf8fd63 | ||
|
|
e6f361804f | ||
|
|
f5b2e7e4f5 | ||
|
|
0a29b296ae | ||
|
|
4789e22e4a | ||
|
|
5378102cd6 | ||
|
|
42cab67124 | ||
|
|
0fd1b11f6d | ||
|
|
74773a60b2 | ||
|
|
e92dd4db20 | ||
|
|
ad0a32886d | ||
|
|
84f05d8e40 | ||
|
|
b33a444e90 | ||
|
|
27d1e4c85a | ||
|
|
77eb8f677f | ||
|
|
320bb4c14f | ||
|
|
7b5908b390 | ||
|
|
1d69f6a72f | ||
|
|
0e080e7294 | ||
|
|
c09ad28c9a | ||
|
|
08fbccc684 | ||
|
|
2f2d05d657 | ||
|
|
c02f584b33 | ||
|
|
d6b68dc819 | ||
|
|
a70d587803 | ||
|
|
2e47d77f86 | ||
|
|
a9405f5c2d | ||
|
|
4bb678f7a5 | ||
|
|
baadbe3dca | ||
|
|
24b089c057 | ||
|
|
c8acc20e82 | ||
|
|
fa91740b47 | ||
|
|
504ca86b78 | ||
|
|
2b155f9505 | ||
|
|
c8df16da8f | ||
|
|
0de3f627c5 | ||
|
|
9c46ee00bb | ||
|
|
48703e19e4 | ||
|
|
799084d3d1 | ||
|
|
ee087b85d5 | ||
|
|
8524016170 | ||
|
|
ed5e1b86c3 | ||
|
|
42bf82c22c | ||
|
|
0d0192c472 | ||
|
|
641cd44adb | ||
|
|
da715f8e70 | ||
|
|
abe14a14d4 | ||
|
|
984601ecfa | ||
|
|
f32956493b | ||
|
|
1e2a13fe1a | ||
|
|
417b3a2669 | ||
|
|
3f25b6b223 | ||
|
|
5cbce9fb20 | ||
|
|
f379b1544c | ||
|
|
30f49c9f70 | ||
|
|
af13d9cdd1 | ||
|
|
8952b2fbd2 | ||
|
|
66681ef9c9 | ||
|
|
4285b388ca | ||
|
|
723d39cd65 | ||
|
|
156d660cd3 | ||
|
|
07b19ede3f | ||
|
|
94c317250e | ||
|
|
7250886d14 | ||
|
|
03ac32b1be | ||
|
|
89390ac0a9 | ||
|
|
69c10379af | ||
|
|
0ea4020d98 | ||
|
|
cbcc990383 | ||
|
|
15f519f827 | ||
|
|
1ccf0588f9 | ||
|
|
cd267c9fa4 | ||
|
|
ce477baa1f | ||
|
|
cd918fe086 | ||
|
|
1f7df3d53d | ||
|
|
dfe9d31ee4 | ||
|
|
2ea26be247 | ||
|
|
15b5fb791e | ||
|
|
eafb6b21f7 | ||
|
|
08cf7d99d3 | ||
|
|
cec8ee4f15 | ||
|
|
4713a69a18 | ||
|
|
22bc9a97c9 | ||
|
|
11e3568d66 | ||
|
|
96ef016b81 | ||
|
|
c0f6ea54f6 | ||
|
|
b8666d511e | ||
|
|
4a093e168d | ||
|
|
1fa93eeb8f | ||
|
|
d36f2de07e | ||
|
|
d17bc25fef | ||
|
|
075b32efe2 | ||
|
|
a2cbb8d4b2 | ||
|
|
ecfa35ecc2 | ||
|
|
546d03c3aa | ||
|
|
3a04f9fb9a | ||
|
|
17a144e2f8 | ||
|
|
658fd038f3 | ||
|
|
d2aede7151 | ||
|
|
de54d5b8ba | ||
|
|
ae003b7e76 | ||
|
|
d08c0e3ef1 | ||
|
|
c68120edcd | ||
|
|
bf7085fabd | ||
|
|
ef93a57b46 | ||
|
|
6e291f0f13 | ||
|
|
73dcf25b63 | ||
|
|
0ecafcd6a0 | ||
|
|
529f406075 | ||
|
|
b66834506a | ||
|
|
5b8e3d4d6c | ||
|
|
fce4e7e10c | ||
|
|
8004b4ec0b | ||
|
|
0584350663 | ||
|
|
ccef7be62c |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -6,6 +6,7 @@
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
.eggs
|
||||
dist
|
||||
build
|
||||
eggs
|
||||
@@ -42,7 +43,7 @@ output/*/index.html
|
||||
|
||||
# Sphinx
|
||||
doc/build
|
||||
doc/source/api
|
||||
doc/source/reference/api
|
||||
|
||||
# pbr generates these
|
||||
AUTHORS
|
||||
@@ -55,3 +56,6 @@ ChangeLog
|
||||
|
||||
sftp-config.json
|
||||
/.idea/
|
||||
|
||||
# Desktop Service Store
|
||||
*.DS_Store
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
host=review.opendev.org
|
||||
port=29418
|
||||
project=openstack/python-watcherclient.git
|
||||
defaultbranch=stable/rocky
|
||||
|
||||
3
.stestr.conf
Normal file
3
.stestr.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
[DEFAULT]
|
||||
test_path=${OS_TEST_PATH:-./watcherclient/tests/functional}
|
||||
top_dir=./
|
||||
18
.zuul.yaml
Normal file
18
.zuul.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
- project:
|
||||
templates:
|
||||
- openstack-python-jobs
|
||||
- openstack-python35-jobs
|
||||
- publish-openstack-sphinx-docs
|
||||
- check-requirements
|
||||
- openstackclient-plugin-jobs
|
||||
check:
|
||||
jobs:
|
||||
- watcherclient-tempest-functional:
|
||||
voting: false
|
||||
- openstack-tox-lower-constraints
|
||||
- openstack-tox-cover:
|
||||
voting: false
|
||||
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-lower-constraints
|
||||
@@ -1,13 +1,13 @@
|
||||
If you would like to contribute to the development of OpenStack,
|
||||
you must follow the steps in this page:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html
|
||||
https://docs.openstack.org/infra/manual/developers.html
|
||||
|
||||
Once those steps have been completed, changes to OpenStack
|
||||
should be submitted for review via the Gerrit tool, following
|
||||
the workflow documented at:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
https://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
|
||||
Pull requests submitted through GitHub will be ignored.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
python-watcherclient Style Commandments
|
||||
=======================================
|
||||
|
||||
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/
|
||||
Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
include AUTHORS
|
||||
include ChangeLog
|
||||
exclude .gitignore
|
||||
exclude .gitreview
|
||||
|
||||
global-exclude *.pyc
|
||||
19
README.rst
19
README.rst
@@ -1,3 +1,12 @@
|
||||
========================
|
||||
Team and repository tags
|
||||
========================
|
||||
|
||||
.. image:: https://governance.openstack.org/tc/badges/python-watcherclient.svg
|
||||
:target: https://governance.openstack.org/tc/reference/tags/index.html
|
||||
|
||||
.. Change things from this point on
|
||||
|
||||
====================
|
||||
python-watcherclient
|
||||
====================
|
||||
@@ -11,12 +20,12 @@ metrics receiver, complex event processor and profiler, optimization processor
|
||||
and an action plan applier. This provides a robust framework to realize a wide
|
||||
range of cloud optimization goals, including the reduction of data center
|
||||
operating costs, increased system performance via intelligent virtual machine
|
||||
migration, increased energy efficiency-and more!
|
||||
migration, increased energy efficiency and more!
|
||||
|
||||
* Free software: Apache license
|
||||
* Wiki: http://wiki.openstack.org/wiki/Watcher
|
||||
* Source: http://git.openstack.org/cgit/openstack/python-watcher
|
||||
* Bugs: http://bugs.launchpad.net/watcher
|
||||
* Wiki: https://wiki.openstack.org/wiki/Watcher
|
||||
* Source: https://git.openstack.org/cgit/openstack/python-watcher
|
||||
* Bugs: https://bugs.launchpad.net/watcher
|
||||
|
||||
Installation
|
||||
============
|
||||
@@ -52,7 +61,7 @@ You can install the Watcher CLI with the following command:
|
||||
sudo pip install python-watcherclient
|
||||
|
||||
|
||||
You can also use the `OpenStack client <http://docs.openstack.org/cli-reference/overview.html>`_
|
||||
You can also use the `OpenStack client <https://docs.openstack.org/python-openstackclient/latest/>`_
|
||||
with Watcher (our watcher plugin for OpenStack client is included in the
|
||||
python-watcherclient package). To install it, you have just to run this command:
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.client` Module
|
||||
======================================
|
||||
|
||||
.. automodule:: watcherclient.client
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.apiclient.auth` Module
|
||||
=====================================================
|
||||
|
||||
.. automodule:: watcherclient.common.apiclient.auth
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.apiclient.base` Module
|
||||
=====================================================
|
||||
|
||||
.. automodule:: watcherclient.common.apiclient.base
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.apiclient.client` Module
|
||||
=======================================================
|
||||
|
||||
.. automodule:: watcherclient.common.apiclient.client
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.apiclient.exceptions` Module
|
||||
===========================================================
|
||||
|
||||
.. automodule:: watcherclient.common.apiclient.exceptions
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.apiclient.utils` Module
|
||||
======================================================
|
||||
|
||||
.. automodule:: watcherclient.common.apiclient.utils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.base` Module
|
||||
===========================================
|
||||
|
||||
.. automodule:: watcherclient.common.base
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.cliutils` Module
|
||||
===============================================
|
||||
|
||||
.. automodule:: watcherclient.common.cliutils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.http` Module
|
||||
===========================================
|
||||
|
||||
.. automodule:: watcherclient.common.http
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.i18n` Module
|
||||
===========================================
|
||||
|
||||
.. automodule:: watcherclient.common.i18n
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.common.utils` Module
|
||||
============================================
|
||||
|
||||
.. automodule:: watcherclient.common.utils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.exceptions` Module
|
||||
==========================================
|
||||
|
||||
.. automodule:: watcherclient.exceptions
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.shell` Module
|
||||
=====================================
|
||||
|
||||
.. automodule:: watcherclient.shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.keystone_client_fixtures` Module
|
||||
==============================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.keystone_client_fixtures
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.test_client` Module
|
||||
=================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.test_client
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.test_http` Module
|
||||
===============================================
|
||||
|
||||
.. automodule:: watcherclient.tests.test_http
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.test_import` Module
|
||||
=================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.test_import
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.test_shell` Module
|
||||
================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.test_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.test_utils` Module
|
||||
================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.test_utils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.utils` Module
|
||||
===========================================
|
||||
|
||||
.. automodule:: watcherclient.tests.utils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_action` Module
|
||||
====================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_action
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_action_plan` Module
|
||||
=========================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_action_plan
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_action_plan_shell` Module
|
||||
===============================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_action_plan_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_action_shell` Module
|
||||
==========================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_action_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_audit` Module
|
||||
===================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_audit
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_audit_shell` Module
|
||||
=========================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_audit_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_audit_template` Module
|
||||
============================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_audit_template
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_audit_template_shell` Module
|
||||
==================================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_audit_template_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_goal` Module
|
||||
==================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_goal
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_goal_shell` Module
|
||||
========================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_goal_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_metric_collector` Module
|
||||
==============================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_metric_collector
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.tests.v1.test_metric_collector_shell` Module
|
||||
====================================================================
|
||||
|
||||
.. automodule:: watcherclient.tests.v1.test_metric_collector_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.action` Module
|
||||
=========================================
|
||||
|
||||
.. automodule:: watcherclient.v1.action
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.action_plan` Module
|
||||
==============================================
|
||||
|
||||
.. automodule:: watcherclient.v1.action_plan
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.action_plan_shell` Module
|
||||
====================================================
|
||||
|
||||
.. automodule:: watcherclient.v1.action_plan_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.action_shell` Module
|
||||
===============================================
|
||||
|
||||
.. automodule:: watcherclient.v1.action_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.audit` Module
|
||||
========================================
|
||||
|
||||
.. automodule:: watcherclient.v1.audit
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.audit_shell` Module
|
||||
==============================================
|
||||
|
||||
.. automodule:: watcherclient.v1.audit_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.audit_template` Module
|
||||
=================================================
|
||||
|
||||
.. automodule:: watcherclient.v1.audit_template
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.audit_template_shell` Module
|
||||
=======================================================
|
||||
|
||||
.. automodule:: watcherclient.v1.audit_template_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.client` Module
|
||||
=========================================
|
||||
|
||||
.. automodule:: watcherclient.v1.client
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.goal` Module
|
||||
=======================================
|
||||
|
||||
.. automodule:: watcherclient.v1.goal
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.goal_shell` Module
|
||||
=============================================
|
||||
|
||||
.. automodule:: watcherclient.v1.goal_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.metric_collector` Module
|
||||
===================================================
|
||||
|
||||
.. automodule:: watcherclient.v1.metric_collector
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.metric_collector_shell` Module
|
||||
=========================================================
|
||||
|
||||
.. automodule:: watcherclient.v1.metric_collector_shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.resource_fields` Module
|
||||
==================================================
|
||||
|
||||
.. automodule:: watcherclient.v1.resource_fields
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.v1.shell` Module
|
||||
========================================
|
||||
|
||||
.. automodule:: watcherclient.v1.shell
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
The :mod:`watcherclient.version` Module
|
||||
=======================================
|
||||
|
||||
.. automodule:: watcherclient.version
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
1012
doc/source/cli/details.rst
Normal file
1012
doc/source/cli/details.rst
Normal file
File diff suppressed because it is too large
Load Diff
32
doc/source/cli/index.rst
Normal file
32
doc/source/cli/index.rst
Normal file
@@ -0,0 +1,32 @@
|
||||
=============================
|
||||
Command-line Tool Reference
|
||||
=============================
|
||||
|
||||
In order to use the CLI, you must provide your OpenStack username,
|
||||
password, tenant, and auth endpoint. Use the corresponding
|
||||
configuration options (``--os-username``, ``--os-password``,
|
||||
``--os-tenant-id``, and ``--os-auth-url``) or set them in environment
|
||||
variables::
|
||||
|
||||
export OS_USERNAME=user
|
||||
export OS_PASSWORD=pass
|
||||
export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b
|
||||
export OS_AUTH_URL=http://auth.example.com:5000/v2.0
|
||||
|
||||
The command line tool will attempt to reauthenticate using your
|
||||
provided credentials for every request. You can override this behavior
|
||||
by manually supplying an auth token using ``--os-watcher-url`` and
|
||||
``--os-auth-token``. You can alternatively set these environment
|
||||
variables::
|
||||
|
||||
export OS_WATCHER_URL=http://watcher.example.org:9322/
|
||||
export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
|
||||
|
||||
Once you've configured your authentication parameters, you can run
|
||||
``watcher help`` to see a complete listing of available commands.
|
||||
|
||||
.. toctree::
|
||||
|
||||
watcher
|
||||
openstack_cli
|
||||
details
|
||||
@@ -24,9 +24,9 @@ OpenStack infra-optim Service (Watcher), by using our additional plugin
|
||||
|
||||
In order to use the CLI, you must provide your OpenStack username, password,
|
||||
project (historically called tenant), and auth endpoint. You can use
|
||||
configuration options :option:`--os-username`, :option:`--os-password`,
|
||||
:option:`--os-tenant-id` (or :option:`--os-tenant-name`),
|
||||
and :option:`--os-auth-url`, or set the corresponding
|
||||
configuration options :option:``--os-username``, :option:``--os-password``,
|
||||
:option:``--os-tenant-id`` (or :option:``--os-tenant-name``),
|
||||
and :option:``--os-auth-url``, or set the corresponding
|
||||
environment variables::
|
||||
|
||||
$ export OS_USERNAME=user
|
||||
@@ -37,14 +37,14 @@ environment variables::
|
||||
|
||||
The command-line tool will attempt to reauthenticate using the provided
|
||||
credentials for every request. You can override this behavior by manually
|
||||
supplying an auth token using :option:`--watcher-url` and
|
||||
:option:`--os-auth-token`, or by setting the corresponding environment variables::
|
||||
supplying an auth token using :option:``--watcher-url`` and
|
||||
:option:``--os-auth-token``, or by setting the corresponding environment variables::
|
||||
|
||||
export WATCHER_URL=http://watcher.example.org:9322/
|
||||
export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
|
||||
|
||||
Since Keystone can return multiple regions in the Service Catalog, you can
|
||||
specify the one you want with :option:`--os-region-name` or set the following
|
||||
specify the one you want with :option:``--os-region-name`` or set the following
|
||||
environment variable. (It defaults to the first in the list returned.)
|
||||
::
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
==============================================
|
||||
===============================================
|
||||
:program:`watcher` Command-Line Interface (CLI)
|
||||
==============================================
|
||||
===============================================
|
||||
|
||||
.. program:: watcher
|
||||
.. highlight:: bash
|
||||
@@ -23,9 +23,9 @@ OpenStack infra-optim Service (Watcher).
|
||||
|
||||
In order to use the CLI, you must provide your OpenStack username, password,
|
||||
project (historically called tenant), and auth endpoint. You can use
|
||||
configuration options :option:`--os-username`, :option:`--os-password`,
|
||||
:option:`--os-tenant-id` (or :option:`--os-tenant-name`),
|
||||
and :option:`--os-auth-url`, or set the corresponding
|
||||
configuration options :option:``--os-username``, :option:``--os-password``,
|
||||
:option:``--os-tenant-id`` (or :option:``--os-tenant-name``),
|
||||
and :option:``--os-auth-url``, or set the corresponding
|
||||
environment variables::
|
||||
|
||||
$ export OS_USERNAME=user
|
||||
@@ -36,14 +36,14 @@ environment variables::
|
||||
|
||||
The command-line tool will attempt to reauthenticate using the provided
|
||||
credentials for every request. You can override this behavior by manually
|
||||
supplying an auth token using :option:`--watcher-url` and
|
||||
:option:`--os-auth-token`, or by setting the corresponding environment variables::
|
||||
supplying an auth token using :option:``--watcher-url`` and
|
||||
:option:``--os-auth-token``, or by setting the corresponding environment variables::
|
||||
|
||||
$ export WATCHER_URL=http://watcher.example.org:9322/
|
||||
$ export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
|
||||
|
||||
Since Keystone can return multiple regions in the Service Catalog, you can
|
||||
specify the one you want with :option:`--os-region-name` or set the following
|
||||
specify the one you want with :option:``--os-region-name`` or set the following
|
||||
environment variable. (It defaults to the first in the list returned.)
|
||||
::
|
||||
|
||||
@@ -55,7 +55,7 @@ fill partially typed commands. To use this feature, source the below file
|
||||
https://git.openstack.org/cgit/openstack/python-watcherclient/tree/tools/watcher.bash_completion)
|
||||
to your terminal and then bash completion should work::
|
||||
|
||||
$ source watcher.bash_completion
|
||||
$ . watcher.bash_completion
|
||||
|
||||
To avoid doing this every time, add this to your ``.bashrc`` or copy the
|
||||
watcher.bash_completion file to the default bash completion scripts directory
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
@@ -12,6 +11,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from watcherclient import version as watcherclient_version
|
||||
|
||||
# -- General configuration ----------------------------------------------------
|
||||
@@ -20,9 +20,8 @@ from watcherclient import version as watcherclient_version
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = ['sphinx.ext.autodoc',
|
||||
'sphinx.ext.viewcode',
|
||||
'oslosphinx',
|
||||
]
|
||||
|
||||
'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
|
||||
@@ -70,7 +69,8 @@ pygments_style = 'sphinx'
|
||||
# html_theme_path = ["."]
|
||||
# html_theme = '_theme'
|
||||
# html_static_path = ['_static']
|
||||
html_theme_options = {'incubating': True}
|
||||
html_theme = 'openstackdocs'
|
||||
# html_theme_path = [openstackdocstheme.get_html_theme_path()]
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = '%sdoc' % project
|
||||
@@ -87,3 +87,13 @@ latex_documents = [
|
||||
u'OpenStack Foundation', 'manual'
|
||||
),
|
||||
]
|
||||
|
||||
# openstackdocstheme options
|
||||
repository_name = 'openstack/python-watcherclient'
|
||||
bug_project = 'python-watcherclient'
|
||||
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"}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
.. _contributing:
|
||||
|
||||
===================================
|
||||
====================================
|
||||
Contributing to python-watcherclient
|
||||
===================================
|
||||
====================================
|
||||
|
||||
If you're interested in contributing to the python-watcherclient project,
|
||||
the following will help get you started.
|
||||
@@ -19,8 +19,8 @@ signed OpenStack's contributor's agreement.
|
||||
|
||||
.. seealso::
|
||||
|
||||
* http://docs.openstack.org/infra/manual/developers.html
|
||||
* http://wiki.openstack.org/CLA
|
||||
* https://docs.openstack.org/infra/manual/developers.html
|
||||
* https://wiki.openstack.org/CLA
|
||||
|
||||
LaunchPad Project
|
||||
-----------------
|
||||
@@ -41,7 +41,7 @@ Project Hosting Details
|
||||
-------------------------
|
||||
|
||||
Bug tracker
|
||||
http://launchpad.net/python-watcherclient
|
||||
https://launchpad.net/python-watcherclient
|
||||
|
||||
Mailing list (prefix subjects with ``[watcher]`` for faster responses)
|
||||
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
|
||||
|
||||
@@ -1,43 +1,15 @@
|
||||
Python bindings to the OpenStack Watcher API
|
||||
============================================
|
||||
|
||||
This is a client for OpenStack Watcher API. There's :doc:`a Python API
|
||||
<api_v1>` (the :mod:`watcherclient` modules), and a :doc:`command-line script
|
||||
<cli>` (installed as :program:`watcher`). Each implements the entire
|
||||
This is a client for OpenStack Watcher API. There's a Python API
|
||||
(the :mod:`watcherclient` modules), and a command-line script
|
||||
(installed as :program:`watcher`). Each implements the entire
|
||||
OpenStack Watcher API.
|
||||
|
||||
You'll need credentials for an OpenStack cloud in order to use the watcher client.
|
||||
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:maxdepth: 2
|
||||
|
||||
readme
|
||||
cli/index
|
||||
reference/index
|
||||
installation
|
||||
api_v1
|
||||
cli
|
||||
openstack_cli
|
||||
contributing
|
||||
|
||||
Contributing
|
||||
============
|
||||
|
||||
Code is hosted at `git.openstack.org`_. Submit bugs to the Watcher project on
|
||||
`Launchpad`_. Submit code to the openstack/python-watcherclient project using
|
||||
`Gerrit`_.
|
||||
|
||||
.. _git.openstack.org: https://git.openstack.org/cgit/openstack/python-watcherclient
|
||||
.. _Launchpad: https://launchpad.net/watcher
|
||||
.. _Gerrit: http://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
The preferred way to run the unit tests is using ``tox``.
|
||||
|
||||
See `Consistent Testing Interface`_ for more details.
|
||||
|
||||
.. _Consistent Testing Interface: http://git.openstack.org/cgit/openstack/governance/tree/reference/project-testing-interface.rst
|
||||
.. _Watcher: https://wiki.openstack.org/wiki/Watcher
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
.. include:: ../../README.rst
|
||||
8
doc/source/reference/api/index.rst
Normal file
8
doc/source/reference/api/index.rst
Normal file
@@ -0,0 +1,8 @@
|
||||
======================
|
||||
Python API Reference
|
||||
======================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
autoindex
|
||||
@@ -68,11 +68,10 @@ Once you have an watcher `Client`_, you can perform various tasks::
|
||||
|
||||
>>> watcher.action.list() # list of actions
|
||||
>>> watcher.action_plan.list() # list of action_plan
|
||||
>>> watcher.audit.get(audit_uuid) # information about a particular audit
|
||||
>>> watcher.audit.get(audit_uuid_or_name) # information about a particular audit
|
||||
|
||||
When the `Client`_ needs to propagate an exception, it will usually
|
||||
raise an instance subclassed from
|
||||
`watcherclient.exc.BaseException`_ or `watcherclient.exc.ClientException`_.
|
||||
raise an instance listed in `watcherclient.exceptions`_.
|
||||
|
||||
Refer to the modules themselves, for more details.
|
||||
|
||||
@@ -80,15 +79,8 @@ Refer to the modules themselves, for more details.
|
||||
watcherclient Modules
|
||||
=====================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
modules <api/autoindex>
|
||||
|
||||
|
||||
.. _watcherclient.v1.audit: api/watcherclient.v1.audit.html#watcherclient.v1.audit.Audit
|
||||
.. _watcherclient.v1.client.Client: api/watcherclient.v1.client.html#watcherclient.v1.client.Client
|
||||
.. _Client: api/watcherclient.v1.client.html#watcherclient.v1.client.Client
|
||||
.. _watcherclient.client.get_client(): api/watcherclient.client.html#watcherclient.client.get_client
|
||||
.. _watcherclient.exc.BaseException: api/watcherclient.exc.html#watcherclient.exc.BaseException
|
||||
.. _watcherclient.exc.ClientException: api/watcherclient.exc.html#watcherclient.exc.ClientException
|
||||
.. _watcherclient.exceptions: api/watcherclient.exceptions.html
|
||||
14
doc/source/reference/index.rst
Normal file
14
doc/source/reference/index.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
==========================
|
||||
Python Library Reference
|
||||
==========================
|
||||
|
||||
In order to use the python api directly, you must first obtain an auth
|
||||
token and identify which endpoint you wish to speak to. Once you have
|
||||
done so, you can use the API like so.
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
api/index
|
||||
api_v1
|
||||
91
lower-constraints.txt
Normal file
91
lower-constraints.txt
Normal file
@@ -0,0 +1,91 @@
|
||||
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
|
||||
prettytable==0.7.2
|
||||
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==1.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
|
||||
unittest2==1.1.0
|
||||
urllib3==1.22
|
||||
wrapt==1.10.11
|
||||
@@ -1,10 +0,0 @@
|
||||
[DEFAULT]
|
||||
|
||||
# The list of modules to copy from oslo-incubator.git
|
||||
module=apiclient
|
||||
module=cliutils
|
||||
module=_i18n
|
||||
|
||||
|
||||
# The base module to hold the copy of openstack.common
|
||||
base=watcherclient
|
||||
@@ -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.3.4 # BSD
|
||||
cliff>=2.2.0 # Apache-2.0
|
||||
osc-lib>=1.2.0 # Apache-2.0
|
||||
oslo.i18n>=2.1.0 # Apache-2.0
|
||||
oslo.utils>=3.18.0 # Apache-2.0
|
||||
pbr>=1.8 # Apache-2.0
|
||||
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
|
||||
python-keystoneclient>=3.6.0 # Apache-2.0
|
||||
six>=1.9.0 # MIT
|
||||
PyYAML>=3.10.0 # MIT
|
||||
keystoneauth1>=3.4.0 # Apache-2.0
|
||||
six>=1.10.0 # MIT
|
||||
PyYAML>=3.12 # MIT
|
||||
|
||||
17
setup.cfg
17
setup.cfg
@@ -5,7 +5,7 @@ description-file =
|
||||
README.rst
|
||||
author = OpenStack
|
||||
author-email = openstack-dev@lists.openstack.org
|
||||
home-page = http://docs.openstack.org/developer/python-watcherclient
|
||||
home-page = https://docs.openstack.org/python-watcherclient/latest/
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Intended Audience :: Information Technology
|
||||
@@ -16,7 +16,6 @@ classifier =
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.4
|
||||
Programming Language :: Python :: 3.5
|
||||
|
||||
[files]
|
||||
@@ -26,9 +25,11 @@ packages =
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
watcher = watcherclient.shell:main
|
||||
tempest.test_plugins =
|
||||
watcherclient_tests = watcherclient.plugin:WatcherClientTempestPlugin
|
||||
|
||||
openstack.cli.extension =
|
||||
infra_optim = watcherclient.plugin
|
||||
infra_optim = watcherclient.osc.plugin
|
||||
|
||||
# Entry points for the 'openstack' command
|
||||
openstack.infra_optim.v1 =
|
||||
@@ -37,6 +38,7 @@ openstack.infra_optim.v1 =
|
||||
|
||||
optimize_strategy_show = watcherclient.v1.strategy_shell:ShowStrategy
|
||||
optimize_strategy_list = watcherclient.v1.strategy_shell:ListStrategy
|
||||
optimize_strategy_state = watcherclient.v1.strategy_shell:StateStrategy
|
||||
|
||||
optimize_audittemplate_show = watcherclient.v1.audit_template_shell:ShowAuditTemplate
|
||||
optimize_audittemplate_list = watcherclient.v1.audit_template_shell:ListAuditTemplate
|
||||
@@ -52,9 +54,9 @@ openstack.infra_optim.v1 =
|
||||
|
||||
optimize_actionplan_show = watcherclient.v1.action_plan_shell:ShowActionPlan
|
||||
optimize_actionplan_list = watcherclient.v1.action_plan_shell:ListActionPlan
|
||||
optimize_actionplan_create = watcherclient.v1.action_plan_shell:CreateActionPlan
|
||||
optimize_actionplan_update = watcherclient.v1.action_plan_shell:UpdateActionPlan
|
||||
optimize_actionplan_start = watcherclient.v1.action_plan_shell:StartActionPlan
|
||||
optimize_actionplan_cancel = watcherclient.v1.action_plan_shell:CancelActionPlan
|
||||
|
||||
optimize_action_show = watcherclient.v1.action_shell:ShowAction
|
||||
optimize_action_list = watcherclient.v1.action_shell:ListAction
|
||||
@@ -72,6 +74,7 @@ watcherclient.v1 =
|
||||
|
||||
strategy_show = watcherclient.v1.strategy_shell:ShowStrategy
|
||||
strategy_list = watcherclient.v1.strategy_shell:ListStrategy
|
||||
strategy_state = watcherclient.v1.strategy_shell:StateStrategy
|
||||
|
||||
audittemplate_show = watcherclient.v1.audit_template_shell:ShowAuditTemplate
|
||||
audittemplate_list = watcherclient.v1.audit_template_shell:ListAuditTemplate
|
||||
@@ -87,10 +90,10 @@ watcherclient.v1 =
|
||||
|
||||
actionplan_show = watcherclient.v1.action_plan_shell:ShowActionPlan
|
||||
actionplan_list = watcherclient.v1.action_plan_shell:ListActionPlan
|
||||
actionplan_create = watcherclient.v1.action_plan_shell:CreateActionPlan
|
||||
actionplan_update = watcherclient.v1.action_plan_shell:UpdateActionPlan
|
||||
actionplan_start = watcherclient.v1.action_plan_shell:StartActionPlan
|
||||
actionplan_delete = watcherclient.v1.action_plan_shell:DeleteActionPlan
|
||||
actionplan_cancel = watcherclient.v1.action_plan_shell:CancelActionPlan
|
||||
|
||||
action_show = watcherclient.v1.action_shell:ShowAction
|
||||
action_list = watcherclient.v1.action_shell:ListAction
|
||||
@@ -103,11 +106,15 @@ watcherclient.v1 =
|
||||
|
||||
[pbr]
|
||||
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
|
||||
|
||||
2
setup.py
2
setup.py
@@ -25,5 +25,5 @@ except ImportError:
|
||||
pass
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr>=1.8'],
|
||||
setup_requires=['pbr>=2.0.0'],
|
||||
pbr=True)
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
coverage>=4.0 # Apache-2.0
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
hacking<0.11,>=0.10.2
|
||||
mock>=2.0 # BSD
|
||||
oslosphinx>=4.7.0 # Apache-2.0
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||
sphinx!=1.3b1,<1.4,>=1.2.1 # BSD
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
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
|
||||
testscenarios>=0.4 # Apache-2.0/BSD
|
||||
testtools>=1.4.0 # MIT
|
||||
testtools>=2.2.0 # MIT
|
||||
tempest>=17.1.0 # Apache-2.0
|
||||
|
||||
# Needed for pypi packaging
|
||||
wheel # MIT
|
||||
wheel>=0.24.0 # MIT
|
||||
|
||||
44
tox.ini
44
tox.ini
@@ -1,42 +1,76 @@
|
||||
[tox]
|
||||
minversion = 1.8
|
||||
envlist = py35,py34,py27,pep8
|
||||
envlist = py35,py27,pep8
|
||||
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://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/rocky} {opts} {packages}
|
||||
pip install -U {opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
OS_TEST_PATH=./watcherclient/tests/unit
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||
commands = rm -f .testrepository/times.dbm
|
||||
python setup.py testr --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python3
|
||||
commands = flake8
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python3
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||
basepython = python3
|
||||
commands =
|
||||
python setup.py testr --coverage --testr-args='{posargs}'
|
||||
coverage report
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[testenv:debug]
|
||||
commands = oslo_debug_helper {posargs}
|
||||
basepython = python3
|
||||
commands = oslo_debug_helper -t watcherclient/tests/unit {posargs}
|
||||
|
||||
[testenv:functional]
|
||||
basepython = python2.7
|
||||
passenv =
|
||||
OS_PROJECT_DOMAIN_NAME
|
||||
OS_USER_DOMAIN_NAME
|
||||
OS_PROJECT_NAME
|
||||
OS_USERNAME
|
||||
OS_PASSWORD
|
||||
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}'
|
||||
|
||||
[flake8]
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
show-source = True
|
||||
enable-extensions = H203,H106
|
||||
ignore = E123,E125
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||
|
||||
[testenv:wheel]
|
||||
basepython = python3
|
||||
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
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
||||
# All Rights Reserved.
|
||||
|
||||
@@ -30,16 +30,6 @@ _C = _translators.contextual_form
|
||||
# requires oslo.i18n >=2.1.0
|
||||
_P = _translators.plural_form
|
||||
|
||||
# Translators for log levels.
|
||||
#
|
||||
# The abbreviated names are meant to reflect the usual use of a short
|
||||
# name like '_'. The "L" is for "log" and the other letter comes from
|
||||
# the level.
|
||||
_LI = _translators.log_info
|
||||
_LW = _translators.log_warning
|
||||
_LE = _translators.log_error
|
||||
_LC = _translators.log_critical
|
||||
|
||||
|
||||
def get_available_languages():
|
||||
return oslo_i18n.get_available_languages(DOMAIN)
|
||||
|
||||
@@ -18,7 +18,7 @@ import re
|
||||
|
||||
from oslo_utils import strutils
|
||||
|
||||
from watcherclient._i18n import _, _LW
|
||||
from watcherclient._i18n import _
|
||||
from watcherclient import exceptions
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -202,8 +202,8 @@ def get_api_version(version_string):
|
||||
version_string = str(version_string)
|
||||
if version_string in DEPRECATED_VERSIONS:
|
||||
LOG.warning(
|
||||
_LW("Version %(deprecated_version)s is deprecated, using "
|
||||
"alternative version %(alternative)s instead."),
|
||||
"Version %(deprecated_version)s is deprecated, using "
|
||||
"alternative version %(alternative)s instead.",
|
||||
{"deprecated_version": version_string,
|
||||
"alternative": DEPRECATED_VERSIONS[version_string]})
|
||||
version_string = DEPRECATED_VERSIONS[version_string]
|
||||
|
||||
@@ -317,7 +317,7 @@ class CrudManager(BaseManager):
|
||||
|
||||
def _filter_kwargs(self, kwargs):
|
||||
"""Drop null values and handle ids."""
|
||||
for key, ref in six.iteritems(kwargs.copy()):
|
||||
for key, ref in kwargs.copy().items():
|
||||
if ref is None:
|
||||
kwargs.pop(key)
|
||||
else:
|
||||
@@ -475,7 +475,7 @@ class Resource(object):
|
||||
return None
|
||||
|
||||
def _add_details(self, info):
|
||||
for (k, v) in six.iteritems(info):
|
||||
for (k, v) in info.items():
|
||||
try:
|
||||
setattr(self, k, v)
|
||||
self._info[k] = v
|
||||
|
||||
@@ -421,7 +421,7 @@ class HttpVersionNotSupported(HttpServerError):
|
||||
# _code_map contains all the classes that have http_status attribute.
|
||||
_code_map = dict(
|
||||
(getattr(obj, 'http_status', None), obj)
|
||||
for name, obj in six.iteritems(vars(sys.modules[__name__]))
|
||||
for name, obj in vars(sys.modules[__name__]).items()
|
||||
if inspect.isclass(obj) and getattr(obj, 'http_status', False)
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2012 OpenStack LLC.
|
||||
# All Rights Reserved.
|
||||
@@ -135,6 +134,11 @@ class Manager(object):
|
||||
def _delete(self, url):
|
||||
self.api.raw_request('DELETE', url)
|
||||
|
||||
def _start(self, url, body=None, method='POST'):
|
||||
resp, body = self.api.json_request(method, url, body={})
|
||||
if body:
|
||||
return self.resource_class(self, body)
|
||||
|
||||
|
||||
class Resource(base.Resource):
|
||||
"""Represents a particular instance of an object (tenant, user, etc).
|
||||
|
||||
@@ -198,12 +198,14 @@ def print_dict(dct, dict_property="Property", wrap=0):
|
||||
"""
|
||||
pt = prettytable.PrettyTable([dict_property, 'Value'])
|
||||
pt.align = 'l'
|
||||
for k, v in six.iteritems(dct):
|
||||
for k, v in dct.items():
|
||||
# convert dict to str to check length
|
||||
if isinstance(v, dict):
|
||||
v = six.text_type(v)
|
||||
if wrap > 0:
|
||||
v = textwrap.fill(six.text_type(v), wrap)
|
||||
elif wrap < 0:
|
||||
raise ValueError(_("Wrap argument should be a positive integer"))
|
||||
# if value has a newline, add in multiple rows
|
||||
# e.g. fault with stacktrace
|
||||
if v and isinstance(v, six.string_types) and r'\n' in v:
|
||||
|
||||
@@ -17,7 +17,6 @@ import copy
|
||||
from distutils import version
|
||||
import functools
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import socket
|
||||
@@ -27,13 +26,14 @@ import time
|
||||
|
||||
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 _, _LE, _LW
|
||||
from watcherclient._i18n import _
|
||||
from watcherclient import exceptions
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ def _extract_error_json(body):
|
||||
"""Return error_message from the HTTP response body."""
|
||||
error_json = {}
|
||||
try:
|
||||
body_json = json.loads(body)
|
||||
body_json = jsonutils.loads(body)
|
||||
if 'error_message' in body_json:
|
||||
raw_msg = body_json['error_message']
|
||||
error_json = json.loads(raw_msg)
|
||||
error_json = jsonutils.loads(raw_msg)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
@@ -165,8 +165,7 @@ class VersionNegotiationMixin(object):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
_RETRY_EXCEPTIONS = (exceptions.Conflict,
|
||||
exceptions.ServiceUnavailable,
|
||||
_RETRY_EXCEPTIONS = (exceptions.ServiceUnavailable,
|
||||
exceptions.ConnectionRefused,
|
||||
kexceptions.RetriableConnectionFailure)
|
||||
|
||||
@@ -185,8 +184,8 @@ def with_retries(func):
|
||||
try:
|
||||
return func(self, url, method, **kwargs)
|
||||
except _RETRY_EXCEPTIONS as error:
|
||||
msg = (_LE("Error contacting Watcher server: %(error)s. "
|
||||
"Attempt %(attempt)d of %(total)d") %
|
||||
msg = ("Error contacting Watcher server: %(error)s. "
|
||||
"Attempt %(attempt)d of %(total)d" %
|
||||
{'attempt': attempt,
|
||||
'total': num_attempts,
|
||||
'error': error})
|
||||
@@ -382,7 +381,7 @@ class HTTPClient(VersionNegotiationMixin):
|
||||
kwargs['headers'].setdefault('Accept', 'application/json')
|
||||
|
||||
if 'body' in kwargs:
|
||||
kwargs['body'] = json.dumps(kwargs['body'])
|
||||
kwargs['body'] = jsonutils.dumps(kwargs['body'])
|
||||
|
||||
resp, body_iter = self._http_request(url, method, **kwargs)
|
||||
content_type = resp.headers.get('Content-Type')
|
||||
@@ -395,9 +394,9 @@ class HTTPClient(VersionNegotiationMixin):
|
||||
if 'application/json' in content_type:
|
||||
body = ''.join([chunk for chunk in body_iter])
|
||||
try:
|
||||
body = json.loads(body)
|
||||
body = jsonutils.loads(body)
|
||||
except ValueError:
|
||||
LOG.error(_LE('Could not decode response body as JSON'))
|
||||
LOG.error('Could not decode response body as JSON')
|
||||
else:
|
||||
body = None
|
||||
|
||||
@@ -545,7 +544,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
|
||||
kwargs['headers'].setdefault('Accept', 'application/json')
|
||||
|
||||
if 'body' in kwargs:
|
||||
kwargs['data'] = json.dumps(kwargs.pop('body'))
|
||||
kwargs['data'] = jsonutils.dumps(kwargs.pop('body'))
|
||||
|
||||
resp = self._http_request(url, method, **kwargs)
|
||||
body = resp.content
|
||||
@@ -558,7 +557,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
|
||||
try:
|
||||
body = resp.json()
|
||||
except ValueError:
|
||||
LOG.error(_LE('Could not decode response body as JSON'))
|
||||
LOG.error('Could not decode response body as JSON')
|
||||
else:
|
||||
body = None
|
||||
|
||||
@@ -602,8 +601,8 @@ def _construct_http_client(endpoint=None,
|
||||
dvars = [k for k, v in ignored.items() if v]
|
||||
|
||||
if dvars:
|
||||
LOG.warning(_LW('The following arguments are ignored when using '
|
||||
'the session to construct a client: %s'),
|
||||
LOG.warning('The following arguments are ignored when using '
|
||||
'the session to construct a client: %s',
|
||||
', '.join(dvars))
|
||||
|
||||
return SessionClient(session=session,
|
||||
@@ -615,8 +614,8 @@ def _construct_http_client(endpoint=None,
|
||||
**kwargs)
|
||||
else:
|
||||
if kwargs:
|
||||
LOG.warning(_LW('The following arguments are being ignored when '
|
||||
'constructing the client: %s'), ', '.join(kwargs))
|
||||
LOG.warning('The following arguments are being ignored when '
|
||||
'constructing the client: %s', ', '.join(kwargs))
|
||||
|
||||
return HTTPClient(endpoint=endpoint,
|
||||
token=token,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2012 OpenStack LLC.
|
||||
# All Rights Reserved.
|
||||
@@ -18,11 +17,11 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import uuid
|
||||
import yaml
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import importutils
|
||||
|
||||
from watcherclient._i18n import _
|
||||
@@ -76,7 +75,7 @@ def import_versioned_module(version, submodule=None):
|
||||
return importutils.import_module(module)
|
||||
|
||||
|
||||
def split_and_deserialize(string):
|
||||
def split_and_deserialize(string, exclude_fields=[]):
|
||||
"""Split and try to JSON deserialize a string.
|
||||
|
||||
Gets a string with the KEY=VALUE format, split it (using '=' as the
|
||||
@@ -89,10 +88,11 @@ def split_and_deserialize(string):
|
||||
except ValueError:
|
||||
raise exc.CommandError(_('Attributes must be a list of '
|
||||
'PATH=VALUE not "%s"') % string)
|
||||
try:
|
||||
value = json.loads(value)
|
||||
except ValueError:
|
||||
pass
|
||||
if key not in exclude_fields:
|
||||
try:
|
||||
value = jsonutils.loads(value)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return (key, value)
|
||||
|
||||
@@ -105,7 +105,7 @@ def args_array_to_dict(kwargs, key_to_convert):
|
||||
return kwargs
|
||||
|
||||
|
||||
def args_array_to_patch(op, attributes):
|
||||
def args_array_to_patch(op, attributes, exclude_fields=[]):
|
||||
patch = []
|
||||
for attr in attributes:
|
||||
# Sanitize
|
||||
@@ -113,7 +113,8 @@ def args_array_to_patch(op, attributes):
|
||||
attr = '/' + attr
|
||||
|
||||
if op in ['add', 'replace']:
|
||||
path, value = split_and_deserialize(attr)
|
||||
path, value = split_and_deserialize(attr,
|
||||
exclude_fields=exclude_fields)
|
||||
patch.append({'op': op, 'path': path, 'value': value})
|
||||
|
||||
elif op == "remove":
|
||||
@@ -160,17 +161,21 @@ def common_params_for_list(args, fields, field_labels):
|
||||
args.sort_dir)
|
||||
params['sort_dir'] = args.sort_dir
|
||||
|
||||
marker = getattr(args, 'marker', None)
|
||||
if marker is not None:
|
||||
params['marker'] = marker
|
||||
params['detail'] = args.detail
|
||||
|
||||
return params
|
||||
|
||||
|
||||
def common_filters(limit=None, sort_key=None, sort_dir=None):
|
||||
def common_filters(limit=None, sort_key=None, sort_dir=None, marker=None):
|
||||
"""Generate common filters for any list request.
|
||||
|
||||
:param limit: maximum number of entities to return.
|
||||
:param sort_key: field to use for sorting.
|
||||
:param sort_dir: direction of sorting: 'asc' or 'desc'.
|
||||
:param marker: The last actionplan UUID of the previous page.
|
||||
:returns: list of string filters.
|
||||
"""
|
||||
filters = []
|
||||
@@ -180,6 +185,8 @@ def common_filters(limit=None, sort_key=None, sort_dir=None):
|
||||
filters.append('sort_key=%s' % sort_key)
|
||||
if sort_dir is not None:
|
||||
filters.append('sort_dir=%s' % sort_dir)
|
||||
if marker is not None:
|
||||
filters.append('marker=%s' % marker)
|
||||
return filters
|
||||
|
||||
|
||||
|
||||
23
watcherclient/config.py
Normal file
23
watcherclient/config.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Copyright (c) 2018 Servionica
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
service_option = cfg.BoolOpt("watcher_client",
|
||||
default=True,
|
||||
help="Whether or not watcher_client is expected"
|
||||
"to be available")
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
|
||||
55
watcherclient/osc/plugin.py
Normal file
55
watcherclient/osc/plugin.py
Normal file
@@ -0,0 +1,55 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
from osc_lib import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_API_VERSION = '1'
|
||||
API_VERSION_OPTION = 'os_infra_optim_api_version'
|
||||
API_NAME = 'infra-optim'
|
||||
API_VERSIONS = {
|
||||
'1': 'watcherclient.v1.client.Client',
|
||||
}
|
||||
|
||||
|
||||
def make_client(instance):
|
||||
"""Returns an infra-optim service client."""
|
||||
infraoptim_client_class = utils.get_client_class(
|
||||
API_NAME,
|
||||
instance._api_version[API_NAME],
|
||||
API_VERSIONS)
|
||||
LOG.debug('Instantiating infraoptim client: %s', infraoptim_client_class)
|
||||
|
||||
client = infraoptim_client_class(
|
||||
os_watcher_api_version=instance._api_version[API_NAME],
|
||||
session=instance.session,
|
||||
region_name=instance._region_name,
|
||||
)
|
||||
|
||||
return client
|
||||
|
||||
|
||||
def build_option_parser(parser):
|
||||
"""Hook to add global options."""
|
||||
parser.add_argument('--os-infra-optim-api-version',
|
||||
metavar='<infra-optim-api-version>',
|
||||
default=utils.env(
|
||||
'OS_INFRA_OPTIM_API_VERSION',
|
||||
default=DEFAULT_API_VERSION),
|
||||
help=('Watcher API version, default=' +
|
||||
DEFAULT_API_VERSION +
|
||||
' (Env: OS_INFRA_OPTIM_API_VERSION)'))
|
||||
return parser
|
||||
@@ -1,55 +1,34 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from osc_lib import utils
|
||||
from tempest.test_discover import plugins
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_API_VERSION = '1'
|
||||
API_VERSION_OPTION = 'os_infra_optim_api_version'
|
||||
API_NAME = 'infra-optim'
|
||||
API_VERSIONS = {
|
||||
'1': 'watcherclient.v1.client.Client',
|
||||
}
|
||||
from watcherclient import config as watcher_config
|
||||
|
||||
|
||||
def make_client(instance):
|
||||
"""Returns an infra-optim service client."""
|
||||
infraoptim_client_class = utils.get_client_class(
|
||||
API_NAME,
|
||||
instance._api_version[API_NAME],
|
||||
API_VERSIONS)
|
||||
LOG.debug('Instantiating infraoptim client: %s', infraoptim_client_class)
|
||||
class WatcherClientTempestPlugin(plugins.TempestPlugin):
|
||||
def load_tests(self):
|
||||
base_path = os.path.split(os.path.dirname(
|
||||
os.path.abspath(__file__)))[0]
|
||||
test_dir = "watcherclient/tests/functional/v1"
|
||||
full_test_dir = os.path.join(base_path, test_dir)
|
||||
return full_test_dir, base_path
|
||||
|
||||
client = infraoptim_client_class(
|
||||
os_watcher_api_version=instance._api_version[API_NAME],
|
||||
session=instance.session,
|
||||
region_name=instance._region_name,
|
||||
)
|
||||
def register_opts(self, conf):
|
||||
conf.register_opt(watcher_config.service_option,
|
||||
group='service_available')
|
||||
|
||||
return client
|
||||
|
||||
|
||||
def build_option_parser(parser):
|
||||
"""Hook to add global options."""
|
||||
parser.add_argument('--os-infra-optim-api-version',
|
||||
metavar='<infra-optim-api-version>',
|
||||
default=utils.env(
|
||||
'OS_INFRA_OPTIM_API_VERSION',
|
||||
default=DEFAULT_API_VERSION),
|
||||
help=('Watcher API version, default=' +
|
||||
DEFAULT_API_VERSION +
|
||||
' (Env: OS_INFRA_OPTIM_API_VERSION)'))
|
||||
return parser
|
||||
def get_opt_lists(self):
|
||||
return [('service_available', [watcher_config.service_option])]
|
||||
|
||||
@@ -25,7 +25,7 @@ from cliff import command
|
||||
from cliff import commandmanager
|
||||
from cliff import complete
|
||||
from cliff import help as cli_help
|
||||
from keystoneclient import session
|
||||
from keystoneauth1 import loading
|
||||
from osc_lib import logs
|
||||
from osc_lib import utils
|
||||
|
||||
@@ -165,7 +165,7 @@ class WatcherShell(app.App):
|
||||
"Service Catalog.")
|
||||
parser.epilog = ('See "watcher help COMMAND" for help '
|
||||
'on a specific command.')
|
||||
session.Session.register_cli_options(parser)
|
||||
loading.register_session_argparse_arguments(parser)
|
||||
return parser
|
||||
|
||||
def configure_logging(self):
|
||||
|
||||
61
watcherclient/tests/README.rst
Normal file
61
watcherclient/tests/README.rst
Normal file
@@ -0,0 +1,61 @@
|
||||
..
|
||||
Except where otherwise noted, this document is licensed under Creative
|
||||
Commons Attribution 3.0 License. You can view the license at:
|
||||
|
||||
https://creativecommons.org/licenses/by/3.0/
|
||||
|
||||
=======
|
||||
Testing
|
||||
=======
|
||||
|
||||
.. _functional_tests:
|
||||
|
||||
Functional tests
|
||||
================
|
||||
|
||||
The following procedure gets you started with Tempest testing but you can also
|
||||
refer to the `Tempest documentation`_ for more details.
|
||||
|
||||
.. _Tempest documentation: https://docs.openstack.org/tempest/latest/
|
||||
|
||||
|
||||
Tempest installation
|
||||
--------------------
|
||||
|
||||
You need to install virtualenv, create a virtual environment and activate it::
|
||||
|
||||
$ pip install virtualenv
|
||||
$ virtualenv watcher-env
|
||||
$ . watcher-env/bin/activate
|
||||
|
||||
Then, to install Tempest you can issue the following commands::
|
||||
|
||||
$ git clone https://github.com/openstack/tempest/
|
||||
$ pip install tempest/
|
||||
|
||||
There should be set environment variables using the OpenStack RC file. If
|
||||
you don't have RC file yet, create ``admin-openrc`` file and fill it using
|
||||
the following example::
|
||||
|
||||
export OS_PROJECT_DOMAIN_NAME=default
|
||||
export OS_USER_DOMAIN_NAME=default
|
||||
export OS_PROJECT_NAME=admin
|
||||
export OS_USERNAME=admin
|
||||
export OS_PASSWORD=admin
|
||||
export OS_AUTH_URL=http://controller:35357/v3
|
||||
export OS_IDENTITY_API_VERSION=3
|
||||
export OS_IMAGE_API_VERSION=2
|
||||
|
||||
Then, save file and execute ``source admin-openrc`` to set environment
|
||||
variables.
|
||||
|
||||
To run functional tests you need to go to python-watcherclient folder, install
|
||||
all requirements and execute ``tempest run`` command::
|
||||
|
||||
$ pip install -r requirements.txt -r test-requirements.txt
|
||||
$ pip install .
|
||||
$ tempest run --regex watcherclient.tests.functional
|
||||
|
||||
You can run specified test(s) by using regular expression::
|
||||
|
||||
$ tempest run --regex watcherclient.tests.functional.v1.test_action.ActionTests.test_action_list
|
||||
0
watcherclient/tests/functional/v1/__init__.py
Normal file
0
watcherclient/tests/functional/v1/__init__.py
Normal file
144
watcherclient/tests/functional/v1/base.py
Normal file
144
watcherclient/tests/functional/v1/base.py
Normal file
@@ -0,0 +1,144 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import testtools
|
||||
|
||||
import six
|
||||
from tempest import clients
|
||||
from tempest.common import credentials_factory as creds_factory
|
||||
from tempest.lib.cli import output_parser
|
||||
from tempest.lib import exceptions
|
||||
|
||||
|
||||
def credentials():
|
||||
# You can get credentials either from tempest.conf file or
|
||||
# from OS environment.
|
||||
tempest_creds = clients.get_auth_provider(
|
||||
creds_factory.get_configured_admin_credentials())
|
||||
creds = tempest_creds.credentials
|
||||
creds_dict = {
|
||||
'--os-username': os.environ.get('OS_USERNAME', creds.username),
|
||||
'--os-password': os.environ.get('OS_PASSWORD', creds.password),
|
||||
'--os-project-name': os.environ.get('OS_PROJECT_NAME',
|
||||
creds.project_name),
|
||||
'--os-auth-url': os.environ.get('OS_AUTH_URL',
|
||||
tempest_creds.auth_url),
|
||||
'--os-project-domain-name': os.environ.get('OS_PROJECT_DOMAIN_ID',
|
||||
creds.project_domain_name),
|
||||
'--os-user-domain-name': os.environ.get('OS_USER_DOMAIN_ID',
|
||||
creds.user_domain_name),
|
||||
}
|
||||
return [x for sub in creds_dict.items() for x in sub]
|
||||
|
||||
|
||||
def execute(cmd, fail_ok=False, merge_stderr=False):
|
||||
"""Executes specified command for the given action."""
|
||||
cmdlist = shlex.split(cmd)
|
||||
cmdlist.extend(credentials())
|
||||
stdout = subprocess.PIPE
|
||||
stderr = subprocess.STDOUT if merge_stderr else subprocess.PIPE
|
||||
proc = subprocess.Popen(cmdlist, stdout=stdout, stderr=stderr)
|
||||
result, result_err = proc.communicate()
|
||||
result = result.decode('utf-8')
|
||||
if not fail_ok and proc.returncode != 0:
|
||||
raise exceptions.CommandFailed(proc.returncode, cmd, result,
|
||||
result_err)
|
||||
return result
|
||||
|
||||
|
||||
class TestCase(testtools.TestCase):
|
||||
|
||||
delimiter_line = re.compile('^\+\-[\+\-]+\-\+$')
|
||||
|
||||
@classmethod
|
||||
def watcher(cls, cmd, fail_ok=False):
|
||||
"""Executes watcherclient command for the given action."""
|
||||
return execute('watcher {0}'.format(cmd), fail_ok=fail_ok)
|
||||
|
||||
@classmethod
|
||||
def get_opts(cls, fields, format='value'):
|
||||
return ' -f {0} {1}'.format(format,
|
||||
' '.join(['-c ' + it for it in fields]))
|
||||
|
||||
@classmethod
|
||||
def assertOutput(cls, expected, actual):
|
||||
if expected != actual:
|
||||
raise Exception('{0} != {1}'.format(expected, actual))
|
||||
|
||||
@classmethod
|
||||
def assertInOutput(cls, expected, actual):
|
||||
if expected not in actual:
|
||||
raise Exception('{0} not in {1}'.format(expected, actual))
|
||||
|
||||
def assert_table_structure(self, items, field_names):
|
||||
"""Verify that all items have keys listed in field_names."""
|
||||
for item in items:
|
||||
for field in field_names:
|
||||
self.assertIn(field, item)
|
||||
|
||||
def assert_show_fields(self, items, field_names):
|
||||
"""Verify that all items have keys listed in field_names."""
|
||||
for item in items:
|
||||
for key in six.iterkeys(item):
|
||||
self.assertIn(key, field_names)
|
||||
|
||||
def assert_show_structure(self, items, field_names):
|
||||
"""Verify that all field_names listed in keys of all items."""
|
||||
if isinstance(items, list):
|
||||
o = {}
|
||||
for d in items:
|
||||
o.update(d)
|
||||
else:
|
||||
o = items
|
||||
item_keys = o.keys()
|
||||
for field in field_names:
|
||||
self.assertIn(field, item_keys)
|
||||
|
||||
@staticmethod
|
||||
def parse_show_as_object(raw_output):
|
||||
"""Return a dict with values parsed from cli output."""
|
||||
items = TestCase.parse_show(raw_output)
|
||||
o = {}
|
||||
for item in items:
|
||||
o.update(item)
|
||||
return o
|
||||
|
||||
@staticmethod
|
||||
def parse_show(raw_output):
|
||||
"""Return list of dicts with item values parsed from cli output."""
|
||||
|
||||
items = []
|
||||
table_ = output_parser.table(raw_output)
|
||||
for row in table_['values']:
|
||||
item = {}
|
||||
item[row[0]] = row[1]
|
||||
items.append(item)
|
||||
return items
|
||||
|
||||
def parse_listing(self, raw_output):
|
||||
"""Return list of dicts with basic item parsed from cli output."""
|
||||
return output_parser.listing(raw_output)
|
||||
|
||||
def has_actionplan_succeeded(self, ap_uuid):
|
||||
return self.parse_show_as_object(
|
||||
self.watcher('actionplan show %s' % ap_uuid)
|
||||
)['State'] == 'SUCCEEDED'
|
||||
|
||||
@classmethod
|
||||
def has_audit_created(cls, audit_uuid):
|
||||
return cls.parse_show_as_object(
|
||||
cls.watcher('audit show %s' % audit_uuid))['State'] == 'SUCCEEDED'
|
||||
81
watcherclient/tests/functional/v1/test_action.py
Normal file
81
watcherclient/tests/functional/v1/test_action.py
Normal file
@@ -0,0 +1,81 @@
|
||||
# Copyright (c) 2016 Servionica
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
import functools
|
||||
|
||||
from tempest.lib.common.utils import test_utils
|
||||
|
||||
from watcherclient.tests.functional.v1 import base
|
||||
|
||||
|
||||
class ActionTests(base.TestCase):
|
||||
"""Functional tests for action."""
|
||||
|
||||
dummy_name = 'dummy'
|
||||
list_fields = ['UUID', 'Parents', 'State', 'Action Plan', 'Action']
|
||||
detailed_list_fields = list_fields + ['Created At', 'Updated At',
|
||||
'Deleted At', 'Parameters']
|
||||
audit_template_name = 'a' + uuidutils.generate_uuid()
|
||||
audit_uuid = None
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
template_raw_output = cls.watcher(
|
||||
'audittemplate create %s dummy -s dummy' % cls.audit_template_name)
|
||||
template_output = cls.parse_show_as_object(template_raw_output)
|
||||
audit_output = cls.parse_show_as_object(cls.watcher(
|
||||
'audit create -a %s' % template_output['Name']))
|
||||
cls.audit_uuid = audit_output['UUID']
|
||||
audit_created = test_utils.call_until_true(
|
||||
func=functools.partial(cls.has_audit_created, cls.audit_uuid),
|
||||
duration=600,
|
||||
sleep_for=2)
|
||||
if not audit_created:
|
||||
raise Exception('Audit has not been succeeded')
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
# Delete Action Plan and all related actions.
|
||||
output = cls.parse_show(
|
||||
cls.watcher('actionplan list --audit %s' % cls.audit_uuid))
|
||||
action_plan_uuid = list(output[0])[0]
|
||||
raw_output = cls.watcher('actionplan delete %s' % action_plan_uuid)
|
||||
cls.assertOutput('', raw_output)
|
||||
# Delete audit
|
||||
raw_output = cls.watcher('audit delete %s' % cls.audit_uuid)
|
||||
cls.assertOutput('', raw_output)
|
||||
# Delete Template
|
||||
raw_output = cls.watcher(
|
||||
'audittemplate delete %s' % cls.audit_template_name)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def test_action_list(self):
|
||||
raw_output = self.watcher('action list')
|
||||
self.assert_table_structure([raw_output], self.list_fields)
|
||||
|
||||
def test_action_detailed_list(self):
|
||||
raw_output = self.watcher('action list --detail')
|
||||
self.assert_table_structure([raw_output], self.detailed_list_fields)
|
||||
|
||||
def test_action_show(self):
|
||||
action_list = self.parse_show(self.watcher('action list --audit %s'
|
||||
% self.audit_uuid))
|
||||
action_uuid = list(action_list[0])[0]
|
||||
action = self.watcher('action show %s' % action_uuid)
|
||||
self.assertIn(action_uuid, action)
|
||||
self.assert_table_structure([action],
|
||||
self.detailed_list_fields)
|
||||
97
watcherclient/tests/functional/v1/test_action_plan.py
Normal file
97
watcherclient/tests/functional/v1/test_action_plan.py
Normal file
@@ -0,0 +1,97 @@
|
||||
# Copyright (c) 2016 Servionica
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
import functools
|
||||
|
||||
from tempest.lib.common.utils import test_utils
|
||||
|
||||
from watcherclient.tests.functional.v1 import base
|
||||
|
||||
|
||||
class ActionPlanTests(base.TestCase):
|
||||
"""Functional tests for action plan."""
|
||||
|
||||
dummy_name = 'dummy'
|
||||
list_fields = ['UUID', 'Audit', 'State', 'Updated At', 'Global efficacy']
|
||||
detailed_list_fields = list_fields + ['Created At', 'Deleted At',
|
||||
'Strategy', 'Efficacy indicators',
|
||||
'Hostname']
|
||||
audit_template_name = 'a' + uuidutils.generate_uuid()
|
||||
audit_uuid = None
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
template_raw_output = cls.watcher(
|
||||
'audittemplate create %s dummy -s dummy' % cls.audit_template_name)
|
||||
template_output = cls.parse_show_as_object(template_raw_output)
|
||||
audit_raw_output = cls.watcher('audit create -a %s'
|
||||
% template_output['Name'])
|
||||
audit_output = cls.parse_show_as_object(audit_raw_output)
|
||||
cls.audit_uuid = audit_output['UUID']
|
||||
audit_created = test_utils.call_until_true(
|
||||
func=functools.partial(cls.has_audit_created, cls.audit_uuid),
|
||||
duration=600,
|
||||
sleep_for=2)
|
||||
if not audit_created:
|
||||
raise Exception('Audit has not been succeeded')
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
# Delete action plan
|
||||
output = cls.parse_show(
|
||||
cls.watcher('actionplan list --audit %s' % cls.audit_uuid))
|
||||
action_plan_uuid = list(output[0])[0]
|
||||
raw_output = cls.watcher('actionplan delete %s' % action_plan_uuid)
|
||||
cls.assertOutput('', raw_output)
|
||||
# Delete audit
|
||||
raw_output = cls.watcher('audit delete %s' % cls.audit_uuid)
|
||||
cls.assertOutput('', raw_output)
|
||||
# Delete Template
|
||||
raw_output = cls.watcher(
|
||||
'audittemplate delete %s' % cls.audit_template_name)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def test_action_plan_list(self):
|
||||
raw_output = self.watcher('actionplan list')
|
||||
self.assert_table_structure([raw_output], self.list_fields)
|
||||
|
||||
def test_action_plan_detailed_list(self):
|
||||
raw_output = self.watcher('actionplan list --detail')
|
||||
self.assert_table_structure([raw_output], self.detailed_list_fields)
|
||||
|
||||
def test_action_plan_show(self):
|
||||
action_plan_list = self.parse_show(self.watcher('actionplan list'))
|
||||
action_plan_uuid = list(action_plan_list[0])[0]
|
||||
actionplan = self.watcher('actionplan show %s' % action_plan_uuid)
|
||||
self.assertIn(action_plan_uuid, actionplan)
|
||||
self.assert_table_structure([actionplan],
|
||||
self.detailed_list_fields)
|
||||
|
||||
def test_action_plan_start(self):
|
||||
output = self.parse_show(self.watcher('actionplan list --audit %s'
|
||||
% self.audit_uuid))
|
||||
action_plan_uuid = list(output[0])[0]
|
||||
self.watcher('actionplan start %s' % action_plan_uuid)
|
||||
raw_output = self.watcher('actionplan show %s' % action_plan_uuid)
|
||||
self.assert_table_structure([raw_output], self.detailed_list_fields)
|
||||
|
||||
self.assertTrue(test_utils.call_until_true(
|
||||
func=functools.partial(
|
||||
self.has_actionplan_succeeded, action_plan_uuid),
|
||||
duration=600,
|
||||
sleep_for=2
|
||||
))
|
||||
136
watcherclient/tests/functional/v1/test_audit.py
Normal file
136
watcherclient/tests/functional/v1/test_audit.py
Normal file
@@ -0,0 +1,136 @@
|
||||
# Copyright (c) 2016 Servionica
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
import functools
|
||||
|
||||
from tempest.lib.common.utils import test_utils
|
||||
|
||||
from watcherclient.tests.functional.v1 import base
|
||||
|
||||
|
||||
class AuditTests(base.TestCase):
|
||||
"""Functional tests for audit."""
|
||||
|
||||
dummy_name = 'dummy'
|
||||
list_fields = ['UUID', 'Name', 'Audit Type', 'State', 'Goal', 'Strategy']
|
||||
detailed_list_fields = list_fields + ['Created At', 'Updated At',
|
||||
'Deleted At', 'Parameters',
|
||||
'Interval', 'Audit Scope',
|
||||
'Next Run Time', 'Hostname']
|
||||
audit_template_name = 'a' + uuidutils.generate_uuid()
|
||||
audit_uuid = None
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
raw_output = cls.watcher('audittemplate create %s dummy -s dummy'
|
||||
% cls.audit_template_name)
|
||||
template_output = cls.parse_show_as_object(raw_output)
|
||||
audit_raw_output = cls.watcher(
|
||||
'audit create -a %s' % template_output['Name'])
|
||||
audit_output = cls.parse_show_as_object(audit_raw_output)
|
||||
cls.audit_uuid = audit_output['UUID']
|
||||
audit_created = test_utils.call_until_true(
|
||||
func=functools.partial(cls.has_audit_created, cls.audit_uuid),
|
||||
duration=600,
|
||||
sleep_for=2)
|
||||
if not audit_created:
|
||||
raise Exception('Audit has not been succeeded')
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
output = cls.parse_show(
|
||||
cls.watcher('actionplan list --audit %s' % cls.audit_uuid))
|
||||
action_plan_uuid = list(output[0])[0]
|
||||
cls.watcher('actionplan delete %s' % action_plan_uuid)
|
||||
cls.watcher('audit delete %s' % cls.audit_uuid)
|
||||
cls.watcher('audittemplate delete %s' % cls.audit_template_name)
|
||||
|
||||
def test_audit_list(self):
|
||||
raw_output = self.watcher('audit list')
|
||||
self.assert_table_structure([raw_output], self.list_fields)
|
||||
|
||||
def test_audit_detailed_list(self):
|
||||
raw_output = self.watcher('audit list --detail')
|
||||
self.assert_table_structure([raw_output], self.detailed_list_fields)
|
||||
|
||||
def test_audit_show(self):
|
||||
audit = self.watcher('audit show ' + self.audit_uuid)
|
||||
self.assertIn(self.audit_uuid, audit)
|
||||
self.assert_table_structure([audit], self.detailed_list_fields)
|
||||
|
||||
def test_audit_update(self):
|
||||
audit_raw_output = self.watcher('audit update %s add interval=2'
|
||||
% self.audit_uuid)
|
||||
audit_output = self.parse_show_as_object(audit_raw_output)
|
||||
assert int(audit_output['Interval']) == 2
|
||||
|
||||
|
||||
class AuditActiveTests(base.TestCase):
|
||||
|
||||
list_fields = ['UUID', 'Name', 'Audit Type', 'State', 'Goal', 'Strategy']
|
||||
detailed_list_fields = list_fields + ['Created At', 'Updated At',
|
||||
'Deleted At', 'Parameters',
|
||||
'Interval', 'Audit Scope']
|
||||
audit_template_name = 'a' + uuidutils.generate_uuid()
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.watcher('audittemplate create %s dummy -s dummy'
|
||||
% cls.audit_template_name)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.watcher('audittemplate delete %s' % cls.audit_template_name)
|
||||
|
||||
def _create_audit(self):
|
||||
return self.parse_show_as_object(
|
||||
self.watcher('audit create -a %s'
|
||||
% self.audit_template_name))['UUID']
|
||||
|
||||
def _delete_audit(self, audit_uuid):
|
||||
self.assertTrue(test_utils.call_until_true(
|
||||
func=functools.partial(
|
||||
self.has_audit_created, audit_uuid),
|
||||
duration=600,
|
||||
sleep_for=2
|
||||
))
|
||||
output = self.parse_show(
|
||||
self.watcher('actionplan list --audit %s' % audit_uuid))
|
||||
action_plan_uuid = list(output[0])[0]
|
||||
self.watcher('actionplan delete %s' % action_plan_uuid)
|
||||
self.watcher('audit delete %s' % audit_uuid)
|
||||
|
||||
def test_create_audit(self):
|
||||
audit = self.watcher('audit create -a %s' % self.audit_template_name)
|
||||
audit_uuid = self.parse_show_as_object(audit)['UUID']
|
||||
self.assert_table_structure([audit], self.detailed_list_fields)
|
||||
self._delete_audit(audit_uuid)
|
||||
|
||||
def test_delete_audit(self):
|
||||
audit_uuid = self._create_audit()
|
||||
self.assertTrue(test_utils.call_until_true(
|
||||
func=functools.partial(
|
||||
self.has_audit_created, audit_uuid),
|
||||
duration=600,
|
||||
sleep_for=2
|
||||
))
|
||||
raw_output = self.watcher('audit delete %s' % audit_uuid)
|
||||
self.assertOutput('', raw_output)
|
||||
output = self.parse_show(
|
||||
self.watcher('actionplan list --audit %s' % audit_uuid))
|
||||
action_plan_uuid = list(output[0])[0]
|
||||
self.watcher('actionplan delete %s' % action_plan_uuid)
|
||||
89
watcherclient/tests/functional/v1/test_audit_template.py
Normal file
89
watcherclient/tests/functional/v1/test_audit_template.py
Normal file
@@ -0,0 +1,89 @@
|
||||
# Copyright (c) 2016 Servionica
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from watcherclient.tests.functional.v1 import base
|
||||
|
||||
|
||||
class AuditTemplateTests(base.TestCase):
|
||||
"""Functional tests for audit template."""
|
||||
|
||||
dummy_name = 'dummy'
|
||||
list_fields = ['UUID', 'Name', 'Goal', 'Strategy']
|
||||
detailed_list_fields = list_fields + ['Created At', 'Updated At',
|
||||
'Deleted At', 'Description',
|
||||
'Audit Scope']
|
||||
audit_template_name = 'a' + uuidutils.generate_uuid()
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.watcher('audittemplate create %s dummy -s dummy'
|
||||
% cls.audit_template_name)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.watcher('audittemplate delete %s' % cls.audit_template_name)
|
||||
|
||||
def test_audit_template_list(self):
|
||||
raw_output = self.watcher('audittemplate list')
|
||||
self.assert_table_structure([raw_output], self.list_fields)
|
||||
|
||||
def test_audit_template_detailed_list(self):
|
||||
raw_output = self.watcher('audittemplate list --detail')
|
||||
self.assert_table_structure([raw_output], self.detailed_list_fields)
|
||||
|
||||
def test_audit_template_show(self):
|
||||
audit_template = self.watcher(
|
||||
'audittemplate show %s' % self.audit_template_name)
|
||||
self.assertIn(self.audit_template_name, audit_template)
|
||||
self.assert_table_structure([audit_template],
|
||||
self.detailed_list_fields)
|
||||
|
||||
def test_audit_template_update(self):
|
||||
raw_output = self.watcher('audittemplate update %s replace '
|
||||
'description="Updated Desc"'
|
||||
% self.audit_template_name)
|
||||
audit_template_output = self.parse_show_as_object(raw_output)
|
||||
assert audit_template_output['Description'] == 'Updated Desc'
|
||||
|
||||
|
||||
class AuditTemplateActiveTests(base.TestCase):
|
||||
|
||||
audit_template_name = 'b' + uuidutils.generate_uuid()
|
||||
list_fields = ['UUID', 'Name', 'Goal', 'Strategy']
|
||||
detailed_list_fields = list_fields + ['Created At', 'Updated At',
|
||||
'Deleted At', 'Description',
|
||||
'Audit Scope']
|
||||
|
||||
def _create_audit_template(self):
|
||||
self.watcher('audittemplate create %s dummy -s dummy '
|
||||
'-d "Test Audit Template"' % self.audit_template_name)
|
||||
|
||||
def _delete_audit_template(self):
|
||||
self.watcher('audittemplate delete %s' % self.audit_template_name)
|
||||
|
||||
def test_create_audit_template(self):
|
||||
raw_output = self.watcher('audittemplate create %s dummy '
|
||||
'-s dummy -d "Test Audit Template"'
|
||||
% self.audit_template_name)
|
||||
self.assert_table_structure([raw_output], self.detailed_list_fields)
|
||||
self._delete_audit_template()
|
||||
|
||||
def test_delete_audit_template(self):
|
||||
self._create_audit_template()
|
||||
raw_output = self.watcher('audittemplate delete %s'
|
||||
% self.audit_template_name)
|
||||
self.assertOutput('', raw_output)
|
||||
41
watcherclient/tests/functional/v1/test_goal.py
Normal file
41
watcherclient/tests/functional/v1/test_goal.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2016 Servionica
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from watcherclient.tests.functional.v1 import base
|
||||
|
||||
|
||||
class GoalTests(base.TestCase):
|
||||
"""Functional tests for goal."""
|
||||
|
||||
dummy_name = 'dummy'
|
||||
list_fields = ['UUID', 'Name', 'Display name']
|
||||
|
||||
def test_goal_list(self):
|
||||
raw_output = self.watcher('goal list')
|
||||
self.assertIn(self.dummy_name, raw_output)
|
||||
self.assert_table_structure([raw_output], self.list_fields)
|
||||
|
||||
def test_goal_detailed_list(self):
|
||||
raw_output = self.watcher('goal list --detail')
|
||||
self.assertIn(self.dummy_name, raw_output)
|
||||
self.assert_table_structure(
|
||||
[raw_output], self.list_fields + ['Efficacy specification'])
|
||||
|
||||
def test_goal_show(self):
|
||||
raw_output = self.watcher('goal show %s' % self.dummy_name)
|
||||
self.assertIn(self.dummy_name, raw_output)
|
||||
self.assert_table_structure(
|
||||
[raw_output], self.list_fields + ['Efficacy specification'])
|
||||
self.assertNotIn('server_consolidation', raw_output)
|
||||
40
watcherclient/tests/functional/v1/test_scoring_engine.py
Normal file
40
watcherclient/tests/functional/v1/test_scoring_engine.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2016 Servionica
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from watcherclient.tests.functional.v1 import base
|
||||
|
||||
|
||||
class ScoringEngineTests(base.TestCase):
|
||||
"""Functional tests for scoring engine."""
|
||||
|
||||
dummy_name = 'dummy_scorer'
|
||||
list_fields = ['UUID', 'Name', 'Description']
|
||||
detailed_list_fields = list_fields + ['Metainfo']
|
||||
|
||||
def test_scoringengine_list(self):
|
||||
raw_output = self.watcher('scoringengine list')
|
||||
self.assertIn(self.dummy_name, raw_output)
|
||||
self.assert_table_structure([raw_output], self.list_fields)
|
||||
|
||||
def test_scoringengine_detailed_list(self):
|
||||
raw_output = self.watcher('scoringengine list --detail')
|
||||
self.assertIn(self.dummy_name, raw_output)
|
||||
self.assert_table_structure([raw_output], self.detailed_list_fields)
|
||||
|
||||
def test_scoringengine_show(self):
|
||||
raw_output = self.watcher('scoringengine show %s' % self.dummy_name)
|
||||
self.assertIn(self.dummy_name, raw_output)
|
||||
self.assert_table_structure([raw_output], self.detailed_list_fields)
|
||||
self.assertNotIn('dummy_avg_scorer', raw_output)
|
||||
47
watcherclient/tests/functional/v1/test_service.py
Normal file
47
watcherclient/tests/functional/v1/test_service.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# Copyright (c) 2016 Servionica
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from watcherclient.tests.functional.v1 import base
|
||||
|
||||
|
||||
class ServiceTests(base.TestCase):
|
||||
"""Functional tests for service."""
|
||||
|
||||
decision_engine_name = 'watcher-decision-engine'
|
||||
applier_name = 'watcher-applier'
|
||||
list_fields = ['ID', 'Name', 'Host', 'Status']
|
||||
|
||||
def test_service_list(self):
|
||||
raw_output = self.watcher('service list')
|
||||
self.assertIn(self.decision_engine_name, raw_output)
|
||||
self.assertIn(self.applier_name, raw_output)
|
||||
self.assert_table_structure([raw_output], self.list_fields)
|
||||
|
||||
def test_service_detailed_list(self):
|
||||
raw_output = self.watcher('service list --detail')
|
||||
self.assertIn(self.decision_engine_name, raw_output)
|
||||
self.assertIn(self.applier_name, raw_output)
|
||||
self.assert_table_structure([raw_output],
|
||||
self.list_fields + ['Last seen up'])
|
||||
|
||||
def test_service_show(self):
|
||||
# TODO(alexchadin): this method should be refactored since Watcher will
|
||||
# get HA support soon.
|
||||
raw_output = self.watcher('service show %s'
|
||||
% self.decision_engine_name)
|
||||
self.assertIn(self.decision_engine_name, raw_output)
|
||||
self.assert_table_structure([raw_output],
|
||||
self.list_fields + ['Last seen up'])
|
||||
self.assertNotIn(self.applier_name, raw_output)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user