From f98d96815bb6f4773626bb70408216fc678768d5 Mon Sep 17 00:00:00 2001 From: Billy Bethell <93923166+bbethell-1@users.noreply.github.com> Date: Fri, 21 Apr 2023 09:09:04 +0100 Subject: [PATCH] Update operator.py - Sonarqube fix - Delete unreachable The last line of the code (return) is unreachable Delete this unreachable code --- lab-ui-manager/operator/operator.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lab-ui-manager/operator/operator.py b/lab-ui-manager/operator/operator.py index 6860d2776..e2fc4d0e4 100755 --- a/lab-ui-manager/operator/operator.py +++ b/lab-ui-manager/operator/operator.py @@ -528,17 +528,16 @@ def delete_service_account(self, logger): def get_image(self): if self.image_stream_name: - image_stream = custom_objects_api.get_namespaced_custom_object( - 'image.openshift.io', 'v1', self.image_stream_namespace, 'imagestreams', self.image_stream_name - ) - if 'tags' in image_stream['status']: - return image_stream['status']['tags'][0]['items'][0]['dockerImageReference'] - else: - return f"{image_stream['status']['dockerImageRepository']}:latest" - return + image_stream = custom_objects_api.get_namespaced_custom_object( + 'image.openshift.io', 'v1', self.image_stream_namespace, 'imagestreams', self.image_stream_name + ) + if 'tags' in image_stream['status']: + return image_stream['status']['tags'][0]['items'][0]['dockerImageReference'] else: - return self.image - + return f"{image_stream['status']['dockerImageRepository']}:latest" + else: + return self.image + def handle_delete(self, logger): self.delete_service_account(logger=logger) self.delete_role_binding(logger=logger)