From 72b708fdd74a092cdc345e6beb9080dfd8cf25bc Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Tue, 20 Nov 2018 13:14:30 -0600 Subject: [PATCH] Update sysinv to handle newer version of python-docker Version 3.3 of python-docker changes the exec_run method signature to return a tuple with exit-code and message. The code that invokes exec_run needed to handle this modification. Also, when an application-remove fails, it can be attempted again. Story: 2003908 Task: 28013 Depends-On: I7ea41d8c2010ade9cfad7fc120df853771d46b49 Change-Id: I10b85dfa33dcbfc1f3973c7674b50de46387441a Signed-off-by: Al Bailey --- .../sysinv/sysinv/api/controllers/v1/kube_app.py | 1 + sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_app.py b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_app.py index f45d65573e..55158073b8 100644 --- a/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_app.py +++ b/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_app.py @@ -315,6 +315,7 @@ class KubeAppController(rest.RestController): return KubeApp.convert_with_links(db_app) else: if db_app.status not in [constants.APP_APPLY_SUCCESS, + constants.APP_REMOVE_FAILURE, constants.APP_APPLY_FAILURE]: raise wsme.exc.ClientSideError(_( "Application-remove rejected: operation is not allowed while " diff --git a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py index bde3910ec7..4a6d61ba6d 100644 --- a/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py +++ b/sysinv/sysinv/sysinv/sysinv/conductor/kube_app.py @@ -42,7 +42,6 @@ kube_app_opts = [ CONF = cfg.CONF CONF.register_opts(kube_app_opts) ARMADA_CONTAINER_NAME = 'armada_service' -ARMADA_ERRORS = ['ERROR', 'failed', 'timed out'] MAX_DOWNLOAD_THREAD = 20 @@ -705,8 +704,8 @@ class DockerHelper(object): if armada_svc: if request == 'validate': cmd = 'armada validate ' + manifest_file - exec_logs = armada_svc.exec_run(cmd) - if "Successfully validated" in exec_logs: + (exit_code, exec_logs) = armada_svc.exec_run(cmd) + if exit_code == 0: LOG.info("Manifest file %s was successfully validated." % manifest_file) else: @@ -716,8 +715,8 @@ class DockerHelper(object): elif request == 'apply': cmd = 'armada apply --debug ' + manifest_file + overrides_str LOG.info("Armada apply command = %s" % cmd) - exec_logs = armada_svc.exec_run(cmd) - if not any(str in exec_logs for str in ARMADA_ERRORS): + (exit_code, exec_logs) = armada_svc.exec_run(cmd) + if exit_code == 0: LOG.info("Application manifest %s was successfully " "applied/re-applied." % manifest_file) else: @@ -726,8 +725,8 @@ class DockerHelper(object): exec_logs) elif request == 'delete': cmd = 'armada delete --debug --manifest ' + manifest_file - exec_logs = armada_svc.exec_run(cmd) - if not any(str in exec_logs for str in ARMADA_ERRORS): + (exit_code, exec_logs) = armada_svc.exec_run(cmd) + if exit_code == 0: LOG.info("Application charts were successfully " "deleted.") else: