Beispiel #1
0
 def set_missing_zi_data():
     """
     Set missing fields in supplied zi_data to prevent problems
     """
     # Set ZI Zone ttl if not already set
     if 'zone_ttl' not in zi_data:
         zi_data['zone_ttl'] = zone_ttl
     # Set other SOA values in zi_data from defaults
     # if they are not there. soa_ttl can be None
     for field in [
             'soa_mname', 'soa_rname', 'soa_refresh', 'soa_retry',
             'soa_expire', 'soa_minimum'
     ]:
         if not zi_data.get(field):
             zi_data[field] = zone_cfg.get_row_exc(db_session,
                                                   field,
                                                   sg=zone_sm.sg)
     # We always update serial number on zone udpdate/publish
     # but it is nicer and probably less troublesome to replace
     # an existing serial number that may be out there
     if not zi_data.get('soa_serial'):
         if zone_sm.soa_serial:
             zi_data['soa_serial'] = zone_sm.soa_serial
         else:
             # Obviously a new zone
             zi_data['soa_serial'] = new_zone_soa_serial(db_session)
Beispiel #2
0
def get_default_zi_data(db_session, sg_name=None):
    """
    Return default zi data from zone_cfg table

    This is called from wsgi code or zone_tool
    """
    zi_data = {}
    soa_fields = ['soa_mname', 'soa_rname', 'soa_refresh', 
            'soa_retry', 'soa_expire', 'soa_minimum']
    for field in soa_fields:
        zi_data[field] = zone_cfg.get_row_exc(db_session, field, 
                sg_name=sg_name)
    zi_data['zone_ttl'] = zone_cfg.get_row_exc(db_session, 'zone_ttl', 
                    sg_name=sg_name)
    zi_data['soa_ttl'] = None
    zi_data['soa_serial'] = new_zone_soa_serial(db_session)
    return zi_data
Beispiel #3
0
def get_default_zi_data(db_session, sg_name=None):
    """
    Return default zi data from zone_cfg table

    This is called from wsgi code or zone_tool
    """
    zi_data = {}
    soa_fields = [
        'soa_mname', 'soa_rname', 'soa_refresh', 'soa_retry', 'soa_expire',
        'soa_minimum'
    ]
    for field in soa_fields:
        zi_data[field] = zone_cfg.get_row_exc(db_session,
                                              field,
                                              sg_name=sg_name)
    zi_data['zone_ttl'] = zone_cfg.get_row_exc(db_session,
                                               'zone_ttl',
                                               sg_name=sg_name)
    zi_data['soa_ttl'] = None
    zi_data['soa_serial'] = new_zone_soa_serial(db_session)
    return zi_data
Beispiel #4
0
 def set_missing_zi_data():
     """
     Set missing fields in supplied zi_data to prevent problems
     """
     # Set ZI Zone ttl if not already set
     if 'zone_ttl' not in zi_data:
         zi_data['zone_ttl'] = zone_ttl
     # Set other SOA values in zi_data from defaults 
     # if they are not there. soa_ttl can be None
     for field in ['soa_mname', 'soa_rname', 'soa_refresh', 'soa_retry', 
             'soa_expire', 'soa_minimum']:
         if not zi_data.get(field):
             zi_data[field] = zone_cfg.get_row_exc(db_session, field,
                                                 sg=zone_sm.sg)
     # We always update serial number on zone udpdate/publish
     # but it is nicer and probably less troublesome to replace 
     # an existing serial number that may be out there
     if not zi_data.get('soa_serial'):
         if zone_sm.soa_serial:
             zi_data['soa_serial'] = zone_sm.soa_serial
         else:
             # Obviously a new zone
             zi_data['soa_serial'] = new_zone_soa_serial(db_session)