'Adds a node to the inventory and index, as long as it is
addressable'

def add_node(self, node):

    if (node.state != 0):
        return
    if (not (node.public_ips == [])):
        dest = node.public_ips[0]
    if (not dest):
        return
    self.index[dest] = node.name
    self.inventory[node.name] = [dest]
    "\n                                #    Inventory:    Group    by    region\n                                self.push(self.inventory,    region,    dest)\n\n                                #    Inventory:    Group    by    availability    zone\n                                self.push(self.inventory,    node.placement,    dest)\n\n                                #    Inventory:    Group    by    instance    type\n                                self.push(self.inventory,    self.to_safe('type_'    +    node.instance_type),    dest)\n                                "
    if node.extra['key_name']:
        self.push(self.inventory, self.to_safe(('key_' + node.extra['key_name'])), dest)
    if node.extra['security_group']:
        self.push(self.inventory, self.to_safe(('sg_' + node.extra['security_group'][0])), dest)
    if node.extra['tags']:
        for tagkey in node.extra['tags'].keys():
            self.push(self.inventory, self.to_safe(((('tag_' + tagkey) + '_') + node.extra['tags'][tagkey])), dest)
