Fix invalid model name if already contains username
authorCory Johns <johnsca@gmail.com>
Thu, 2 Mar 2017 14:40:39 +0000 (09:40 -0500)
committerCory Johns <johnsca@gmail.com>
Fri, 3 Mar 2017 16:33:39 +0000 (11:33 -0500)
juju/client/connection.py

index 3011a8a..dbd48c6 100644 (file)
@@ -273,7 +273,8 @@ class Connection:
         username = accounts['user']
         password = accounts.get('password')
         models = jujudata.models()[controller_name]
-        model_name = '{}/{}'.format(username, model_name)
+        if '/' not in model_name:
+            model_name = '{}/{}'.format(username, model_name)
         model_uuid = models['models'][model_name]['uuid']
         macaroons = get_macaroons() if not password else None