コード例 #1
0
 def test_get_server_public_address_none(self):
     """
     No public IP when none has been assigned yet
     """
     server_class = namedtuple('Server', 'addresses')
     server = server_class(addresses=[])
     self.assertEqual(openstack.get_server_public_address(server), None)
コード例 #2
0
 def test_get_server_public_address_none(self):
     """
     No public IP when none has been assigned yet
     """
     server_class = namedtuple('Server', 'addresses')
     server = server_class(addresses=[])
     self.assertEqual(openstack.get_server_public_address(server), None)
コード例 #3
0
ファイル: server.py プロジェクト: taivo/opencraft
    def public_ip(self):
        """
        Return one of the public address(es)
        """
        if not self.openstack_id:
            return None

        public_addr = openstack.get_server_public_address(self.os_server)
        if not public_addr:
            return None

        return public_addr['addr']
コード例 #4
0
ファイル: server.py プロジェクト: open-craft/opencraft
    def public_ip(self):
        """
        Return one of the public address(es)
        """
        if not self.openstack_id:
            return None

        try:
            public_addr = openstack.get_server_public_address(self.os_server)
        except (requests.RequestException, novaclient.exceptions.ClientException):
            return None  # Could not determine an IP based on the OS API
        if not public_addr:
            return None

        return public_addr["addr"]