def _write_incron_lines(user, lines):
 if (user == 'system'):
  ret = {}
  ret['retcode'] = _write_file(_INCRON_SYSTEM_TAB, 'salt', ''.join(lines))
  return ret
 else:
  path = salt.utils.files.mkstemp()
  with salt.utils.fopen(path, 'w+') as fp_:
   fp_.writelines(lines)
  if ((__grains__['os_family'] == 'Solaris') and (user != 'root')):
   __salt__['cmd.run']('chown {0} {1}'.format(user, path), python_shell=False)
  ret = __salt__['cmd.run_all'](_get_incron_cmdstr(path), runas=user, python_shell=False)
  os.remove(path)
  return ret

def _write_incron_lines ( user , lines ) : if ( user == 'system' ) : ret = { } ret [ 'retcode' ] = _write_file ( _INCRON_SYSTEM_TAB , 'salt' , '' . join ( lines ) ) return ret else : path = salt . utils . files . mkstemp ( ) with salt . utils . fopen ( path , 'w+' ) as fp_ : fp_ . writelines ( lines ) if ( ( __grains__ [ 'os_family' ] == 'Solaris' ) and ( user != 'root' ) ) : __salt__ [ 'cmd.run' ] ( 'chown {0} {1}' . format ( user , path ) , python_shell = False ) ret = __salt__ [ 'cmd.run_all' ] ( _get_incron_cmdstr ( path ) , runas = user , python_shell = False ) os . remove ( path ) return ret
takes a list of lines to be committed to a users incrontab and writes it .