Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
 def get_base_dir(fqdn):
     return os.path.join(sexy.get_base_dir("db"), "host", fqdn)
Exemplo n.º 6
0
 def get_base_dir(network):
     return os.path.join(sexy.get_base_dir("db"), "net-ipv4", network)
Exemplo n.º 7
0
Arquivo: mac.py Projeto: BergSoft/sexy
 def get_base_dir():
     return sexy.get_base_dir("db/mac")
Exemplo n.º 8
0
 def get_base_dir(fqdn):
     return os.path.join(sexy.get_base_dir("db"), "host", fqdn)
Exemplo n.º 9
0
 def get_base_dir(network):
     return os.path.join(sexy.get_base_dir("db"), "net-ipv4", network)
Exemplo n.º 10
0
 def get_base_dir():
     return sexy.get_base_dir("db/mac")