[train] paunch: exit module if config doesn't exist

It's possible that the step directory doesn't exist in a deployment,
just quit the module with no change and move on.

It'll avoid running paunch with empty config.
This will be backported to Train.

Change-Id: I3a5fc2214e7068f1e7aacc0e7a8a681c3f9715e9
(cherry picked from commit b2fe3f2d61)
This commit is contained in:
Emilien Macchi 2020-07-15 22:04:22 -04:00
parent 04c6fffa56
commit 8b6924bb70
1 changed files with 3 additions and 0 deletions

View File

@ -166,6 +166,9 @@ class PaunchManager:
log_file=self.log_file)
if self.config:
# Do nothing if config path doesn't exist
if not os.path.exists(self.config):
self.module.exit_json(**self.results)
if self.config.endswith('.json'):
self.module.warn('Only one config was given, cleanup disabled')
self.cleanup = False