Exemplo n.º 1
0
 def __init__(self, location, ipversion=4):
     """Initialize instance with location, vlan, and ipversion defaults."""
     self.location = location
     self.ipversion = ipversion
     self.directory = Directory()
     self.hosts = gocept.net.dhcp.Hosts()
     self.networks = {}
Exemplo n.º 2
0
 def rg_addresses(self):
     """Query list of addresses in local vlan+location from directory."""
     d = Directory()
     with exceptions_screened():
         for node in d.list_addresses(self.vlan, self.location):
             if node['rg'] == self.rg:
                 yield netaddr.IPNetwork(node['addr']).ip
Exemplo n.º 3
0
 def _load(self):
     directory = Directory()
     with exceptions_screened():
         self.users = directory.list_users(self.resource_group)
         self.permissions = directory.list_permissions()
         self.admins_group = directory.lookup_resourcegroup('admins')
         self.admins_permission = {'description': 'Administrators',
                                   'id': self.admins_group['gid'],
                                   'name': self.admins_group['name']}
         self.rg_info = directory.lookup_resourcegroup(self.resource_group)
Exemplo n.º 4
0
def update():
    a = argparse.ArgumentParser()
    a.add_argument('-c',
                   '--config',
                   default='/etc/local/configure-zones.cfg',
                   help='path to configuration file (default: %(default)s)')
    args = a.parse_args()
    config = configobj.ConfigObj(args.config)
    zones = Zones(config)
    directory = Directory()
    with exceptions_screened():
        for node_addr in walk(directory):
            node_addr.inject_records(zones)
    if zones.update() and config['settings'].get('reload'):
        sys.stdout.flush()
        subprocess.check_call([config['settings']['reload']], shell=True)
Exemplo n.º 5
0
 def __init__(self, box_server, resource_group):
     self.box_server = box_server
     self.resource_group = resource_group
     self.d = Directory()
Exemplo n.º 6
0
 def __init__(self):
     self.d = Directory()