def git_handling():
 orig_dir = os.getcwd()
 os.chdir(global_params.CFGS_DIR)
 current_dir = (os.getcwd() + '/')
 if (current_dir == global_params.CFGS_DIR):
  proc = subprocess.Popen([GIT, 'add', '*.txt'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  (std_out, std_err) = proc.communicate()
  commit_message = 'Network config changes (auto)'
  proc = subprocess.Popen([GIT, 'commit', '-m', commit_message], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  (std_out, std_err) = proc.communicate()
 os.chdir(orig_dir)

def git_handling ( ) : orig_dir = os . getcwd ( ) os . chdir ( global_params . CFGS_DIR ) current_dir = ( os . getcwd ( ) + '/' ) if ( current_dir == global_params . CFGS_DIR ) : proc = subprocess . Popen ( [ GIT , 'add' , '*.txt' ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( std_out , std_err ) = proc . communicate ( ) commit_message = 'Network config changes (auto)' proc = subprocess . Popen ( [ GIT , 'commit' , '-m' , commit_message ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( std_out , std_err ) = proc . communicate ( ) os . chdir ( orig_dir )
commit the change into git following config file change .