diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-07-14 08:59:02 -0400 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2017-07-14 09:03:23 -0400 |
commit | f51e0082fe17f14aec5e14facc143986f47cf260 (patch) | |
tree | d8951d26f4f0242a92faa859cf1e6a339ae99c47 /roles/lib_openshift/src/class | |
parent | d3cd981326c98984117ae6fd768d63c39257de69 (diff) | |
download | openshift-f51e0082fe17f14aec5e14facc143986f47cf260.tar.gz openshift-f51e0082fe17f14aec5e14facc143986f47cf260.tar.bz2 openshift-f51e0082fe17f14aec5e14facc143986f47cf260.tar.xz openshift-f51e0082fe17f14aec5e14facc143986f47cf260.zip |
Fixing needs_update comparison. Added a small pause for race conditions. Fixed doc. Fix kind to storageclass
Diffstat (limited to 'roles/lib_openshift/src/class')
-rw-r--r-- | roles/lib_openshift/src/class/oc_storageclass.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/roles/lib_openshift/src/class/oc_storageclass.py b/roles/lib_openshift/src/class/oc_storageclass.py index 6c62c7bd8..ece684c56 100644 --- a/roles/lib_openshift/src/class/oc_storageclass.py +++ b/roles/lib_openshift/src/class/oc_storageclass.py @@ -4,7 +4,7 @@ # pylint: disable=too-many-instance-attributes class OCStorageClass(OpenShiftCLI): ''' Class to wrap the oc command line tools ''' - kind = 'sc' + kind = 'storageclass' # pylint allows 5 # pylint: disable=too-many-arguments @@ -46,15 +46,22 @@ class OCStorageClass(OpenShiftCLI): '''update the object''' # parameters are currently unable to be updated. need to delete and recreate self.delete() + # pause here and attempt to wait for delete. + # Better option would be to poll + time.sleep(5) return self.create() def needs_update(self): ''' verify an update is needed ''' # check if params have updated - if self.storage_class.get_parameters() == self.config.parameters: - return False + if self.storage_class.get_parameters() != self.config.parameters: + return True + + for anno_key, anno_value in self.storage_class.get_annotations().items(): + if 'is-default-class' in anno_key and anno_value != self.config.default_storage_class: + return True - return True + return False @staticmethod # pylint: disable=too-many-return-statements,too-many-branches @@ -67,7 +74,7 @@ class OCStorageClass(OpenShiftCLI): parameters=params['parameters'], annotations=params['annotations'], api_version="storage.k8s.io/{}".format(params['api_version']), - default_sc=params['default_storage_class'], + default_storage_class=params.get('default_storage_class', 'false'), kubeconfig=params['kubeconfig'], ) |