def network_list(cls): networks = [] base_dir = os.path.join(sexy.get_base_dir("db"), "net-ipv4") for entry in os.listdir(base_dir): # With or without the mask is the question... #network = cls(entry) #networks.append("%s/%s" % (entry, network.mask)) networks.append("%s" % (entry)) return networks
def network_list(cls): networks = [] base_dir = os.path.join(sexy.get_base_dir("db"), "net-ipv4") for entry in os.listdir(base_dir): # With or without the mask is the question... #network = cls(entry) #networks.append("%s/%s" % (entry, network.mask)) networks.append("%s" % (entry)) return networks
def hosts_list(cls, host_type=None): hosts = [] if host_type: if host_type not in HOST_TYPES: raise Error("Host type must be one of %s" % (" ".join(HOST_TYPES))) base_dir = os.path.join(sexy.get_base_dir("db"), "host") if not os.path.isdir(base_dir): return [] for entry in os.listdir(base_dir): if host_type: host = cls(entry) if host.host_type == host_type: hosts.append(entry) else: hosts.append(entry) return hosts
def hosts_list(cls, host_type=None): hosts = [] if host_type: if host_type not in HOST_TYPES: raise Error("Host type must be one of %s" % (" ".join(HOST_TYPES))) base_dir = os.path.join(sexy.get_base_dir("db"), "host") if not os.path.isdir(base_dir): return [] for entry in os.listdir(base_dir): if host_type: host = cls(entry) if host.host_type == host_type: hosts.append(entry) else: hosts.append(entry) return hosts
def get_base_dir(fqdn): return os.path.join(sexy.get_base_dir("db"), "host", fqdn)
def get_base_dir(network): return os.path.join(sexy.get_base_dir("db"), "net-ipv4", network)
def get_base_dir(): return sexy.get_base_dir("db/mac")
def get_base_dir(fqdn): return os.path.join(sexy.get_base_dir("db"), "host", fqdn)
def get_base_dir(network): return os.path.join(sexy.get_base_dir("db"), "net-ipv4", network)
def get_base_dir(): return sexy.get_base_dir("db/mac")