#NEWLINE# def main( ) : #NEWLINE# #INDENT# os . chdir ( settings . named_path ) #NEWLINE# code = subprocess . call ( '/usr/bin/git pull hub master' , shell = True ) #NEWLINE# if code : #NEWLINE# #INDENT# sys . stderr . write ( 'git pull code failed\n' ) #NEWLINE# #UNINDENT# zones = [ f for f in os . listdir ( settings . zones_path ) if ( is_file ( f ) and ( not f . endswith ( '.jnl' ) ) ) ] #NEWLINE# with open ( named_conf_master , 'w' ) as f : #NEWLINE# #INDENT# f . write ( ( 'include "%s/named.conf";\n\n' % settings . named_path ) ) #NEWLINE# f . write ( transfer_key ) #NEWLINE# f . write ( '\n' . join ( [ get_master ( z ) for z in zones ] ) ) #NEWLINE# #UNINDENT# with open ( named_conf_slave , 'w' ) as f : #NEWLINE# #INDENT# f . write ( ( 'include "%s/named.conf";\n\n' % settings . named_path ) ) #NEWLINE# f . write ( transfer_key ) #NEWLINE# f . write ( ( 'server %s { keys %s; };\n\n' % ( settings . master_ip , transfer_key_name ) ) ) #NEWLINE# f . write ( '\n' . join ( [ ( nameconf_slave % ( z , z , settings . master_ip ) ) for z in z ] ) ) #NEWLINE# #UNINDENT# rndc_conf = ( '%s/rndc.key' % settings . named_path ) #NEWLINE# code = subprocess . call ( ( '/usr/sbin/rndc -k %s -s localhost reload' % rndc_conf ) , shell = True ) #NEWLINE# if code : #NEWLINE# #INDENT# sys . stderr . write ( 'reload master name server failed\n' ) #NEWLINE# sys . exit ( ( - 1 ) ) #NEWLINE# #UNINDENT# for ( slave_ip , system ) in settings . slave_ips . items ( ) : #NEWLINE# #INDENT# reload_slave ( slave_ip , system )