예제 #1
0
def print_instance_summary(instance, use_color='auto'):
    """ Print summary info line for the supplied instance """

    colorize_ = partial(colorize, use_color=use_color)

    name = colorize_(instance.name, "yellow")
    instance_type = instance.extra['gonzo_size']

    if instance.state == NodeState.RUNNING:
        status_colour = "green"
    else:
        status_colour = "red"

    instance_status = NodeState.tostring(instance.state)
    status = colorize_(instance_status, status_colour)

    if 'owner' in instance.extra['gonzo_tags']:
        owner = instance.extra['gonzo_tags']['owner']
    else:
        owner = "---"

    uptime = format_uptime(instance.extra['gonzo_created_time'])
    uptime = colorize_(uptime, "blue")

    availability_zone = instance.extra['gonzo_az']

    result_list = [
        name,
        instance_type,
        status,
        owner,
        uptime,
        availability_zone,
    ]
    return result_list
예제 #2
0
    def __repr__(self):
        state = NodeState.tostring(self.state)

        return (('<Node: uuid=%s, name=%s, state=%s, public_ips=%s, '
                 'private_ips=%s, provider=%s ...>')
                % (self.uuid, self.name, state, self.public_ips,
                   self.private_ips, self.driver.name))
예제 #3
0
    def _basic_instance_details(self, name):
        instance = self._find_instance_by_name(name)

        if instance is not None:
            details = {
                'id': instance.id,
                'status': NodeState.tostring(instance.state),
                'ip-private': instance.private_ips,
                'ip-public': instance.public_ips,
                'security_groups': instance.extra['groups'],
                'keypair': instance.extra['key_name'],
                'instance_type': instance.extra['instance_type'],
            }
        else:
            details = {'error': 'instance named {0} not found.'.format(name)}

        return details
예제 #4
0
파일: aws.py 프로젝트: sijis/err-aws
    def _basic_instance_details(self, name):
        instance = self._find_instance_by_name(name)

        if instance is not None:
            details = {
                'id': instance.id,
                'status': NodeState.tostring(instance.state),
                'ip-private': instance.private_ips,
                'ip-public': instance.public_ips,
                'security_groups': instance.extra['groups'],
                'keypair': instance.extra['key_name'],
                'instance_type': instance.extra['instance_type'],
            }
        else:
            details = {'error': 'instance named {0} not found.'.format(name)}

        return details
예제 #5
0
 def test_nodestate_tostring(self):
     self.assertEqual(NodeState.tostring(NodeState.RUNNING), "RUNNING")
예제 #6
0
 def get_state(self, obj):
     return NodeState.tostring(obj.state)
예제 #7
0
파일: Nova.py 프로젝트: seele02/ATLAS
 def list_nodes(self):
     driver = self.connect()  #get the Nova driver from the connection class
     nodes = driver.list_nodes()  #list all nodes runinng
     for node in nodes:  #for every node
         print 'Node Name: ', node.name, 'Node ID: ', node.id, 'Node State: ', NodeState.tostring(
             node.state)
예제 #8
0
 def test_nodestate_tostring(self):
     self.assertEqual(NodeState.tostring(NodeState.RUNNING), "RUNNING")
예제 #9
0
파일: admin.py 프로젝트: ZuluPro/pony-admin
 def get_state(self, obj):
     return NodeState.tostring(obj.state)