Skip to content

Commit 88a02a2

Browse files
authored
Don't use cache when listing api_groups (#281)
* Don't use cache when listing api_groups
1 parent 35ba7d1 commit 88a02a2

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

openshift/dynamic/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ def update(self, resources):
615615
@property
616616
def api_groups(self):
617617
""" list available api groups """
618-
return self.__resources['apis'].keys()
618+
return [group['name'] for group in load_json(self.__client.request("GET", '/apis'))['groups']]
619619

620620
def get(self, **kwargs):
621621
""" Same as search, but will throw an error if there are multiple or no

openshift/helper/base.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -609,28 +609,27 @@ def _read_stream(self, watcher, stream, name):
609609
# Object is either added or modified. Check the status and determine if we
610610
# should continue waiting
611611
if hasattr(obj, 'status'):
612-
status = getattr(obj, 'status')
613-
if hasattr(status, 'phase'):
614-
if status.phase == 'Active':
612+
if hasattr(obj.status, 'phase'):
613+
if obj.status.phase == 'Active':
615614
# TODO other phase values ??
616615
# TODO test namespaces for OpenShift annotations if needed
617616
return_obj = obj
618617
watcher.stop()
619618
break
620-
elif hasattr(status, 'conditions'):
621-
conditions = getattr(status, 'conditions')
619+
elif hasattr(obj.status, 'conditions'):
620+
conditions = obj.status.conditions
622621
if conditions and len(conditions) > 0:
623622
# We know there is a status, but it's up to the user to determine meaning.
624623
return_obj = obj
625624
watcher.stop()
626625
break
627-
elif obj.kind == 'Service' and status is not None:
626+
elif obj.kind == 'Service' and obj.status is not None:
628627
return_obj = obj
629628
watcher.stop()
630629
break
631630
elif obj.kind == 'Route':
632631
route_statuses = set()
633-
for route_ingress in status.ingress:
632+
for route_ingress in obj.status.ingress:
634633
for condition in route_ingress.conditions:
635634
route_statuses.add(condition.type)
636635
if route_statuses <= {'Ready', 'Admitted'}:

0 commit comments

Comments
 (0)