Compare commits
6 Commits
unmaintain
...
1.3.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a8cf8445e | ||
|
|
e28f0e7ee2 | ||
|
|
b45c813d9a | ||
|
|
4a47b7886d | ||
| f5eae02253 | |||
| b6fe5c9261 |
@@ -2,3 +2,4 @@
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/python-watcherclient.git
|
||||
defaultbranch=stable/pike
|
||||
|
||||
12
.zuul.yaml
Normal file
12
.zuul.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
- project:
|
||||
templates:
|
||||
- openstack-python-jobs
|
||||
- openstack-python35-jobs
|
||||
- publish-openstack-sphinx-docs
|
||||
- check-requirements
|
||||
- openstackclient-plugin-jobs
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-cover:
|
||||
voting: false
|
||||
|
||||
@@ -9,6 +9,6 @@ oslo.i18n!=3.15.2,>=2.1.0 # Apache-2.0
|
||||
oslo.utils>=3.20.0 # Apache-2.0
|
||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
PrettyTable<0.8,>=0.7.1 # BSD
|
||||
keystoneauth1>=3.0.1 # Apache-2.0
|
||||
keystoneauth1>=3.1.0 # Apache-2.0
|
||||
six>=1.9.0 # MIT
|
||||
PyYAML>=3.10.0 # MIT
|
||||
|
||||
@@ -6,7 +6,7 @@ coverage!=4.4,>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
mock>=2.0 # BSD
|
||||
openstackdocstheme>=1.11.0 # Apache-2.0
|
||||
openstackdocstheme>=1.16.0 # Apache-2.0
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||
sphinx>=1.6.2 # BSD
|
||||
|
||||
2
tox.ini
2
tox.ini
@@ -6,7 +6,7 @@ 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/pike} {opts} {packages}
|
||||
pip install -U {opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
|
||||
@@ -75,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
|
||||
@@ -88,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 = jsonutils.loads(value)
|
||||
except ValueError:
|
||||
pass
|
||||
if key not in exclude_fields:
|
||||
try:
|
||||
value = jsonutils.loads(value)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return (key, value)
|
||||
|
||||
@@ -104,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
|
||||
@@ -112,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":
|
||||
|
||||
3
watcherclient/tests/unit/v1/test_action_shell.py
Normal file → Executable file
3
watcherclient/tests/unit/v1/test_action_shell.py
Normal file → Executable file
@@ -30,6 +30,7 @@ ACTION_1 = {
|
||||
'action_type': 'migrate',
|
||||
'parents': ['239f02a5-9649-4e14-9d33-ac2bf67cb755'],
|
||||
'input_parameters': {"test": 1},
|
||||
'description': 'test',
|
||||
'created_at': datetime.datetime.now().isoformat(),
|
||||
'updated_at': None,
|
||||
'deleted_at': None,
|
||||
@@ -42,6 +43,7 @@ ACTION_2 = {
|
||||
'action_type': 'migrate',
|
||||
'parents': ['67653274-eb24-c7ba-70f6-a84e73d80843'],
|
||||
'input_parameters': {"test": 2},
|
||||
'description': 'test',
|
||||
'created_at': datetime.datetime.now().isoformat(),
|
||||
'updated_at': None,
|
||||
'deleted_at': None,
|
||||
@@ -53,6 +55,7 @@ ACTION_3 = {
|
||||
'parents': [],
|
||||
'state': 'PENDING',
|
||||
'action_type': 'sleep',
|
||||
'description': 'test',
|
||||
'created_at': datetime.datetime.now().isoformat(),
|
||||
'updated_at': None,
|
||||
'deleted_at': None,
|
||||
|
||||
@@ -243,7 +243,8 @@ class UpdateAudit(command.ShowOne):
|
||||
raise exceptions.ValidationError()
|
||||
|
||||
patch = common_utils.args_array_to_patch(
|
||||
parsed_args.op, parsed_args.attributes[0])
|
||||
parsed_args.op, parsed_args.attributes[0],
|
||||
exclude_fields=['/interval'])
|
||||
|
||||
audit = client.audit.update(parsed_args.audit, patch)
|
||||
|
||||
|
||||
4
watcherclient/v1/resource_fields.py
Normal file → Executable file
4
watcherclient/v1/resource_fields.py
Normal file → Executable file
@@ -64,11 +64,11 @@ ACTION_PLAN_SHORT_LIST_FIELD_LABELS = ['UUID', 'Audit', 'State',
|
||||
# Action
|
||||
ACTION_FIELDS = ['uuid', 'created_at', 'updated_at', 'deleted_at', 'parents',
|
||||
'state', 'action_plan_uuid', 'action_type',
|
||||
'input_parameters']
|
||||
'input_parameters', 'description']
|
||||
|
||||
ACTION_FIELD_LABELS = ['UUID', 'Created At', 'Updated At', 'Deleted At',
|
||||
'Parents', 'State', 'Action Plan', 'Action',
|
||||
'Parameters']
|
||||
'Parameters', 'Description']
|
||||
|
||||
ACTION_SHORT_LIST_FIELDS = ['uuid', 'parents',
|
||||
'state', 'action_plan_uuid', 'action_type']
|
||||
|
||||
Reference in New Issue
Block a user