diff --git a/distributedcloud/dcmanager/common/exceptions.py b/distributedcloud/dcmanager/common/exceptions.py index 710bd31c3..2f006511a 100644 --- a/distributedcloud/dcmanager/common/exceptions.py +++ b/distributedcloud/dcmanager/common/exceptions.py @@ -154,7 +154,8 @@ class SubcloudGroupDefaultNotDeletable(DCManagerException): class SubcloudBackupOperationFailed(DCManagerException): - message = _("Failed to run subcloud-backup %(operation)s, check dcmanager logs") + message = _("Failed to run subcloud-backup %(operation)s. Please run " + "'dcmanager subcloud error' command for details") class ConnectionRefused(DCManagerException): diff --git a/distributedcloud/dcmanager/manager/subcloud_manager.py b/distributedcloud/dcmanager/manager/subcloud_manager.py index 3df81a924..e691fbeaf 100644 --- a/distributedcloud/dcmanager/manager/subcloud_manager.py +++ b/distributedcloud/dcmanager/manager/subcloud_manager.py @@ -726,7 +726,8 @@ class SubcloudManager(manager.Manager): failed_subclouds) if invalid_subclouds or failed_subclouds: - return self._build_subcloud_operation_notice(failed_subclouds, + return self._build_subcloud_operation_notice(operation, + failed_subclouds, invalid_subclouds) return @@ -933,17 +934,19 @@ class SubcloudManager(manager.Manager): return subcloud, success @staticmethod - def _build_subcloud_operation_notice(failed_subclouds, invalid_subclouds): + def _build_subcloud_operation_notice(operation, failed_subclouds, invalid_subclouds): invalid_subcloud_names = [subcloud.name for subcloud in invalid_subclouds] failed_subcloud_names = [subcloud.name for subcloud in failed_subclouds] - notice = "Subcloud backup operation completed with warnings:\n" + notice = "Subcloud backup %s operation completed with warnings:\n" % operation if invalid_subclouds: notice += ("The following subclouds were skipped for local backup " - "operation: %s." % ' ,'.join(invalid_subcloud_names)) + "%s operation: %s." + % (operation, ' ,'.join(invalid_subcloud_names))) if failed_subclouds: notice += ("The following subclouds failed during backup " - "operation: %s." % ' ,'.join(failed_subcloud_names)) + "%s operation: %s." + % (operation, ' ,'.join(failed_subcloud_names))) return notice def _create_subcloud_inventory_file(self, subcloud, data_install=None): @@ -1089,6 +1092,15 @@ class SubcloudManager(manager.Manager): except PlaybookExecutionFailed: LOG.error("Failed to delete backup for subcloud %s, check individual " "log at %s for detailed output." % (subcloud.name, log_file)) + + msg = utils.find_ansible_error_msg( + subcloud.name, log_file, consts.BACKUP_STATE_FAILED) + LOG.error(msg) + + db_api.subcloud_update( + context, subcloud.id, + error_description=msg[0:consts.ERROR_DESCRIPTION_LENGTH]) + return False def _run_subcloud_backup_restore_playbook( diff --git a/distributedcloud/tox.ini b/distributedcloud/tox.ini index 026c9e6fe..4ad81f754 100644 --- a/distributedcloud/tox.ini +++ b/distributedcloud/tox.ini @@ -47,7 +47,7 @@ setenv = deps = -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt -whitelist_externals = +allowlist_externals = rm find reno @@ -146,7 +146,7 @@ deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html -whitelist_externals = rm +allowlist_externals = rm [testenv:releasenotes] basepython = python3 @@ -155,7 +155,7 @@ deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf releasenotes/build sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html -whitelist_externals = rm +allowlist_externals = rm [testenv:newnote] basepython = python3 @@ -171,7 +171,7 @@ deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf api-ref/build sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html -whitelist_externals = rm +allowlist_externals = rm [testenv:debug] basepython = python3 @@ -236,7 +236,7 @@ basepython = python3 # bashate ignore: # E006 - accept long lines # E040 - false positive on |& syntax (new in bash 4) -whitelist_externals = bash +allowlist_externals = bash commands = bash -c "find {toxinidir} \ \( -name .tox -prune \) \ diff --git a/tox.ini b/tox.ini index b191ced6b..9f6c173e6 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,7 @@ deps = -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt keyring -whitelist_externals = +allowlist_externals = rm find reno @@ -42,7 +42,7 @@ description = Dummy environment to allow pylint to be run in subdir tox [testenv:linters] basepython = python3 -whitelist_externals = bash +allowlist_externals = bash commands = bash -c "find {toxinidir} \ \( -name .tox -prune \) \ @@ -55,7 +55,7 @@ deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html -whitelist_externals = rm +allowlist_externals = rm [testenv:releasenotes] basepython = python3 @@ -63,7 +63,7 @@ deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf releasenotes/build sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html -whitelist_externals = +allowlist_externals = rm reno @@ -81,7 +81,7 @@ deps = commands = rm -rf api-ref/build sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html -whitelist_externals = rm +allowlist_externals = rm [testenv:bandit] basepython = python3