예제 #1
0
def inventory(*argv):
    usage = """
    Display inventory
    """
    parser = ArgumentParser(usage=usage)
    args = parser.parse_args(argv)
    the_inventory = Inventory()
    the_inventory.display(verbose=True)
    return 0
예제 #2
0
def inventory(*argv):
    usage = """
    Display inventory
    """
    parser = ArgumentParser(usage=usage,
                            formatter_class=ArgumentDefaultsHelpFormatter)
    parser.parse_args(argv)
    inventory = Inventory()
    inventory.display(verbose=True)
    return 0
예제 #3
0
 def local_control_ip(self):
     ### if specified in the config file, then use that
     if 'networking' in self.parser and 'local_control_ip' in self.parser['networking']:
         return self.parser['networking']['local_control_ip']
     ### but otherwise guess it
     # do not import at toplevel to avoid import loop
     from rhubarbe.inventory import Inventory
     the_inventory = Inventory()
     from rhubarbe.guessip import local_ip_on_same_network_as
     ip, prefixlen = local_ip_on_same_network_as(the_inventory.one_control_interface())
     return ip
예제 #4
0
 def local_control_ip(self):
     # if specified in the config file, then use that
     if ('networking' in self.parser
             and 'local_control_ip' in self.parser['networking']):
         return self.parser['networking']['local_control_ip']
     # but otherwise guess it
     # do not import at toplevel to avoid import loop
     from rhubarbe.inventory import Inventory
     the_inventory = Inventory()
     from rhubarbe.guessip import local_ip_on_same_network_as
     ipaddr, _ = local_ip_on_same_network_as(
         the_inventory.one_control_interface())
     return ipaddr
예제 #5
0
 def get_display_node(self, ip):
     # if we have it already
     if ip in self._display_node_by_ip:
         return self._display_node_by_ip[ip]
     
     # in case the incoming ip is a reboot ip
     from rhubarbe.inventory import Inventory
     the_inventory = Inventory()
     control_ip = the_inventory.control_ip_from_any_ip(ip)
     # locate this in the subject nodes list
     for rank, node in enumerate(self.nodes):
         if node.control_ip_address() == control_ip:
             self._display_node_by_ip[ip] = DisplayNode(node.control_hostname(), rank)
             return self._display_node_by_ip[ip]
예제 #6
0
    def get_display_node(self, ipaddr):
        # if we have it already
        if ipaddr in self._display_node_by_ip:
            return self._display_node_by_ip[ipaddr]

        # in case the incoming ip is a reboot ip
        from rhubarbe.inventory import Inventory
        the_inventory = Inventory()
        control_ip = the_inventory.control_ip_from_any_ip(ipaddr)
        # locate this in the subject nodes list
        for rank, node in enumerate(self.nodes):
            if node.control_ip_address() == control_ip:
                self._display_node_by_ip[ipaddr] = \
                    DisplayNode(node.control_hostname(), rank)
                return self._display_node_by_ip[ipaddr]
        return None
예제 #7
0
 def control_hostname(self):
     the_inventory = Inventory()
     return the_inventory.attached_hostname_info(self.cmc_name, "control", "hostname")
예제 #8
0
 def control_ip_address(self):
     the_inventory = Inventory()
     return the_inventory.attached_hostname_info(self.cmc_name, "control", "ip")
예제 #9
0
 def control_hostname(self):
     the_inventory = Inventory()
     return the_inventory.attached_hostname_info(self.cmc_name, 'control',
                                                 'hostname')
예제 #10
0
 def control_ip_address(self):
     the_inventory = Inventory()
     return the_inventory.attached_hostname_info(self.cmc_name, 'control',
                                                 'ip')