Cast single value list as a string for config id

When passing containers config-id into the paunch module,
convert it into a single value (string) for backwards compatibility
of paunch, and unlocking upgrade paths as well.

Paunch as a library only "understands" such single values for
config ids yet. This can be fixed later although.

Related-bug: #1853812

Change-Id: Id8985795fc8fac5a10466486d404799e9c65cc65
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
(cherry picked from commit 5bc81a826d)
This commit is contained in:
Bogdan Dobrelya 2019-11-25 15:47:46 +01:00
parent 25a5df8797
commit 4a039e6a81
1 changed files with 5 additions and 1 deletions

View File

@ -123,7 +123,11 @@ class PaunchManager:
self.module = module
self.results = results
self.config = self.module.params['config']
self.config_id = self.module.params['config_id']
if (isinstance(self.module.params['config_id'], list)
and len(self.module.params['config_id']) == 1):
self.config_id = self.module.params['config_id'][0]
else:
self.config_id = self.module.params['config_id']
self.action = self.module.params['action']
self.healthcheck_disabled = \
self.module.params['healthcheck_disabled']