From a8b2f06681b3cc5e76eef00a73eedc425f74af2b Mon Sep 17 00:00:00 2001 From: Sean Feole Date: Wed, 23 Nov 2016 10:23:04 -0500 Subject: [PATCH] Updated juju.controller.destroy_models(), prepend 'model-' to UUID and pass a single string of objects rather than individual objects --- juju/controller.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/juju/controller.py b/juju/controller.py index 2d8b4fa..f0ef3b9 100644 --- a/juju/controller.py +++ b/juju/controller.py @@ -67,15 +67,27 @@ class Controller(object): """Destroy a model to this controller. - :param str : model- + :param str : of the Model + param accepts string of only OR `model-` + """ model_facade = client.ModelManagerFacade() model_facade.connect(self.connection) - for arg in args: + #Generate list of args, pre-pend 'model-' + prependarg = list(args) + for index, item in enumerate(prependarg): + if not item.startswith('model-'): + prependarg[index]="model-%s" % item + + #Create list of objects to pass to DestroyModels() + arglist = [] + for arg in prependarg: + arglist.append(client.Entity(arg)) log.debug('Destroying Model %s', arg) - await model_facade.DestroyModels([client.Entity(arg)]) + + await model_facade.DestroyModels(arglist) def add_user(self, username, display_name=None, acl=None, models=None): """Add a user to this controller. -- 2.25.1