Beispiel #1
0
def get_juju_model():
    """Retrieve current model

    First check the environment for JUJU_MODEL. If this is not set, get the
    current active model.

    :returns: In focus model name
    :rtype: str
    """

    try:
        # Check the environment
        return os.environ["JUJU_MODEL"]
    except KeyError:
        # If unset connect get the current active model
        return model.get_current_model()
Beispiel #2
0
 def test_get_current_model(self):
     self.patch_object(model, 'Model')
     self.Model.return_value = self.Model_mock
     self.assertEqual(model.get_current_model(), self.model_name)