diff options
author | vamahaja <vamahaja@redhat.com> | 2019-11-06 11:14:17 +0530 |
---|---|---|
committer | vamahaja <vamahaja@redhat.com> | 2019-11-19 12:57:33 +0530 |
commit | a9b27974c785db4d52ec16faaaa4778d26c42dbb (patch) | |
tree | fa8c0f44e755dbf77a21184084537c11828d97f0 /openshift-storage-libs/openshiftstoragelibs/openshift_ops.py | |
parent | 98c622d2d4b29583e317c8993923a317e22b1ace (diff) |
Fix test case "test_heketi_node_add_with_valid_cluster"
Fix consists of -
- Remove steps for add device validation.
- Add steps for gluser peer status validation.
- Add steps for endpoints validation.
Change-Id: I773a883b1ea8bb2bc93660db3459fd864fcd1317
Signed-off-by: vamahaja <vamahaja@redhat.com>
Diffstat (limited to 'openshift-storage-libs/openshiftstoragelibs/openshift_ops.py')
-rw-r--r-- | openshift-storage-libs/openshiftstoragelibs/openshift_ops.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py index bee7af4c..87dd634f 100644 --- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py +++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py @@ -1842,3 +1842,33 @@ def oc_create_service_monitor(hostname, sm_name="heketi", }) oc_create(hostname, sm_data, 'stdin') return sm_name + + +def oc_patch(ocp_node, rtype, rname, changes, raise_on_error=True): + """Patch openshift resource with change + + Args: + ocp_node (str): Node on which the ocp command will run. + rtype (str): Name of the resource type (pod, storageClass, etc). + rname (str): Name of the resource to fetch. + changes (dict): Changes to be applied through patch. + raise_on_error (bool): If set to true a failure to patch + resource with changes will raise an error, otherwise + an None will be returned. + Returns: + str : output of oc patch command + Raises: + exceptions.ExecutionError: Raise when invalid json is provided. + AssertionError: Raised when unable to patch resource and + 'raise_on_error' is true. + """ + try: + changes = json.dumps(changes) + except TypeError: + raise exceptions.ExecutionError( + "Json %s is not serializable to string") + + cmd = ['oc', 'patch', rtype, rname, '-p', '\'%s\'' % changes] + out = command.cmd_run( + cmd, hostname=ocp_node, raise_on_error=raise_on_error) + return out or None |