summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
diff options
context:
space:
mode:
authorAshmitha <asambast@redhat.com>2019-09-10 16:01:56 +0530
committerAshmitha <asambast@redhat.com>2019-09-12 18:13:14 +0530
commitff7b40a09c4029a0a59b6fb96bbe9dc2a19e88e2 (patch)
treee7284f62eb490674742e66b426cdff120e1df931 /openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
parent8c2db5c9894c4f7b90704143cdc97c919c4fe961 (diff)
Add test case to try creation of storage class with duplicate name
Change-Id: If30737958bc667264fc01fe81d411f406b501918
Diffstat (limited to 'openshift-storage-libs/openshiftstoragelibs/openshift_ops.py')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/openshift_ops.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
index 60748aa0..87e55806 100644
--- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
@@ -269,7 +269,7 @@ def oc_create_secret(hostname, secret_name_prefix="autotests-secret",
def oc_create_sc(hostname, sc_name_prefix="autotests-sc",
provisioner="kubernetes.io/glusterfs",
allow_volume_expansion=False,
- reclaim_policy="Delete", **parameters):
+ reclaim_policy="Delete", sc_name=None, **parameters):
"""Create storage class using data provided as stdin input.
Args:
@@ -292,7 +292,8 @@ def oc_create_sc(hostname, sc_name_prefix="autotests-sc",
for parameter in parameters.keys():
if parameter.lower() not in allowed_parameters:
parameters.pop(parameter)
- sc_name = "%s-%s" % (sc_name_prefix, utils.get_random_str())
+ if not sc_name:
+ sc_name = "%s-%s" % (sc_name_prefix, utils.get_random_str())
sc_data = json.dumps({
"kind": "StorageClass",
"apiVersion": "storage.k8s.io/v1",