Fix model name not including user
authorCory Johns <johnsca@gmail.com>
Wed, 1 Mar 2017 16:49:58 +0000 (11:49 -0500)
committerCory Johns <johnsca@gmail.com>
Fri, 3 Mar 2017 16:33:39 +0000 (11:33 -0500)
The model names in models.yaml include the username prefix.

Also fixed a lint error.

juju/client/connection.py

index 9e8cb8f..3e304c1 100644 (file)
@@ -267,6 +267,7 @@ class Connection:
         username = accounts['user']
         password = accounts.get('password')
         models = jujudata.models()[controller_name]
+        model_name = '{}/{}'.format(username, model_name)
         model_uuid = models['models'][model_name]['uuid']
         macaroons = get_macaroons() if not password else None
 
@@ -349,7 +350,7 @@ def get_macaroons():
         cookie_file = os.path.expanduser('~/.go-cookies')
         with open(cookie_file, 'r') as f:
             cookies = json.load(f)
-    except (OSError, ValueError) as e:
+    except (OSError, ValueError):
         log.warn("Couldn't load macaroons from %s", cookie_file)
         return []