Do not fail deploy for empty ceph ansible fetch directory

The RestoreTempDirFromSwift action returned an error if
the Swift container is empty which can stop a deployment.
However there are legitimate reasons the Swift container
could be empty for which the deployment should not be
stopped.

Change-Id: Ic2d9f31caaacbf1c83c4c716cd5e282c6a1953f0
Closes-Bug: #1803609
(cherry picked from commit e05349d55a)
This commit is contained in:
John Fulton 2018-11-20 14:35:46 -05:00
parent 7ba229abb2
commit 74ee674781

View File

@ -147,6 +147,7 @@ class RestoreTempDirFromSwift(base.TripleOAction):
^/tmp/file-mistral-action[A-Za-z0-9_]{6}$
Container should contain a single tarball object
If container is empty, then no error is returned
"""
def __init__(self, path, container):
@ -165,7 +166,9 @@ class RestoreTempDirFromSwift(base.TripleOAction):
try:
swiftutils.download_container(swift, self.container, self.path)
filenames = os.listdir(self.path)
if len(filenames) == 1:
if len(filenames) == 0:
pass
elif len(filenames) == 1:
tarball.extract_tarball(self.path, filenames[0], remove=True)
else:
msg = "%d objects found in container: %s" \