Limit the scope of try-except block
The scope of the try-except block in get_readiness_state is too big. Change-Id: Ie9e3acbb349550d91b795316d6d2c83a3803004e
This commit is contained in:
parent
3432ed77c5
commit
1cc8d8c64a
@ -173,17 +173,18 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
|
||||
try:
|
||||
pod = cls.k8s_client.CoreV1Api().read_namespaced_pod(pod_name,
|
||||
namespace)
|
||||
if container_name:
|
||||
for container in pod.status.container_statuses:
|
||||
if container.name == container_name:
|
||||
return container.ready
|
||||
else:
|
||||
for condition in pod.status.conditions:
|
||||
if condition.type == 'Ready':
|
||||
return condition.status
|
||||
except kubernetes.client.rest.ApiException:
|
||||
return None
|
||||
|
||||
if container_name:
|
||||
for container in pod.status.container_statuses:
|
||||
if container.name == container_name:
|
||||
return container.ready
|
||||
else:
|
||||
for condition in pod.status.conditions:
|
||||
if condition.type == 'Ready':
|
||||
return condition.status
|
||||
|
||||
@classmethod
|
||||
def get_pod_readiness(cls, pod_name, namespace="default"):
|
||||
return cls.get_readiness_state(pod_name, namespace=namespace)
|
||||
|
Loading…
x
Reference in New Issue
Block a user