예제 #1
0
def get_provider_type():
    """Get the type of the undercloud.

    If it can't work it out (i.e. it might be a localhost lxd install where
    there is no clouds.yaml) then return None.

    If libjuju doesn't know (i.e. cloud is not truthy) then default to
    openstack.

    :returns: Name of the undercloud type
    :rtype: Optional[string]
    """
    cloud = controller.get_cloud()
    if cloud:
        # If the controller was deployed from this system with
        # the cloud configured in ~/.local/share/juju/clouds.yaml
        # Determine the cloud type directly
        try:
            return get_cloud_configs(cloud)["type"]
        except Exception:
            return None
    else:
        # If the controller was deployed elsewhere
        # For now assume openstack
        return "openstack"
예제 #2
0
파일: juju.py 프로젝트: Gleland/zaza
def get_provider_type():
    """Get the type of the undercloud.

    :returns: Name of the undercloud type
    :rtype: string
    """
    cloud = controller.get_cloud()
    if cloud:
        # If the controller was deployed from this system with
        # the cloud configured in ~/.local/share/juju/clouds.yaml
        # Determine the cloud type directly
        return get_cloud_configs(cloud)["type"]
    else:
        # If the controller was deployed elsewhere
        # For now assume openstack
        return "openstack"
예제 #3
0
 def test_get_cloud(self):
     self.assertEqual(controller.get_cloud(), self.cloud)
     self.Controller_mock.get_cloud.assert_called_once()