From: Sean Feole Date: Wed, 23 Nov 2016 15:23:04 +0000 (-0500) Subject: Updated juju.controller.destroy_models(), prepend 'model-' to UUID and pass a single... X-Git-Tag: 0.1.0~38^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=a8b2f06681b3cc5e76eef00a73eedc425f74af2b;p=osm%2FN2VC.git Updated juju.controller.destroy_models(), prepend 'model-' to UUID and pass a single string of objects rather than individual objects --- 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.