def _write_cron_lines(user, lines):
 path = salt.utils.files.mkstemp()
 if (_check_instance_uid_match(user) or (__grains__.get('os_family') in ('Solaris', 'AIX'))):
  with salt.utils.fpopen(path, 'w+', uid=__salt__['file.user_to_uid'](user), mode=384) as fp_:
   fp_.writelines(lines)
  ret = __salt__['cmd.run_all'](_get_cron_cmdstr(path), runas=user, python_shell=False)
 else:
  with salt.utils.fpopen(path, 'w+', mode=384) as fp_:
   fp_.writelines(lines)
  ret = __salt__['cmd.run_all'](_get_cron_cmdstr(path, user), python_shell=False)
 os.remove(path)
 return ret

def _write_cron_lines ( user , lines ) : path = salt . utils . files . mkstemp ( ) if ( _check_instance_uid_match ( user ) or ( __grains__ . get ( 'os_family' ) in ( 'Solaris' , 'AIX' ) ) ) : with salt . utils . fpopen ( path , 'w+' , uid = __salt__ [ 'file.user_to_uid' ] ( user ) , mode = 384 ) as fp_ : fp_ . writelines ( lines ) ret = __salt__ [ 'cmd.run_all' ] ( _get_cron_cmdstr ( path ) , runas = user , python_shell = False ) else : with salt . utils . fpopen ( path , 'w+' , mode = 384 ) as fp_ : fp_ . writelines ( lines ) ret = __salt__ [ 'cmd.run_all' ] ( _get_cron_cmdstr ( path , user ) , python_shell = False ) os . remove ( path ) return ret
takes a list of lines to be committed to a users crontab and writes it .