'Create an inventory based on the catalog of nodes and services
registered in a consul cluster'

def __init__(self):

    self.node_metadata = {}
    self.nodes = {}
    self.nodes_by_service = {}
    self.nodes_by_tag = {}
    self.nodes_by_datacenter = {}
    self.nodes_by_kv = {}
    self.nodes_by_availability = {}
    self.current_dc = None
    config = ConsulConfig()
    self.config = config
    self.consul_api = config.get_consul_api()
    if config.has_config('datacenter'):
        if config.has_config('host'):
            self.load_data_for_node(config.host, config.datacenter)
        else:
            self.load_data_for_datacenter(config.datacenter)
    else:
        self.load_all_data_consul()
    self.combine_all_results()
    print json.dumps(self.inventory, sort_keys=True, indent=2)
