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:
parent
7ba229abb2
commit
74ee674781
@ -147,6 +147,7 @@ class RestoreTempDirFromSwift(base.TripleOAction):
|
|||||||
^/tmp/file-mistral-action[A-Za-z0-9_]{6}$
|
^/tmp/file-mistral-action[A-Za-z0-9_]{6}$
|
||||||
|
|
||||||
Container should contain a single tarball object
|
Container should contain a single tarball object
|
||||||
|
If container is empty, then no error is returned
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, path, container):
|
def __init__(self, path, container):
|
||||||
@ -165,7 +166,9 @@ class RestoreTempDirFromSwift(base.TripleOAction):
|
|||||||
try:
|
try:
|
||||||
swiftutils.download_container(swift, self.container, self.path)
|
swiftutils.download_container(swift, self.container, self.path)
|
||||||
filenames = os.listdir(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)
|
tarball.extract_tarball(self.path, filenames[0], remove=True)
|
||||||
else:
|
else:
|
||||||
msg = "%d objects found in container: %s" \
|
msg = "%d objects found in container: %s" \
|
||||||
|
Loading…
Reference in New Issue
Block a user