mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
parent
decc31a766
commit
987d1fee7c
1 changed files with 5 additions and 10 deletions
|
@ -66,16 +66,11 @@ def present(name, timespec, tag=None, user=None, job=None):
|
|||
timespec)
|
||||
return ret
|
||||
|
||||
if __grains__['os_family'] == 'RedHat':
|
||||
echo_cmd = 'echo -e'
|
||||
else:
|
||||
echo_cmd = 'echo'
|
||||
|
||||
if tag:
|
||||
cmd = '{0} "### SALT: {4}\n{1}" | {2} {3}'.format(echo_cmd,
|
||||
job, binary, timespec, tag)
|
||||
stdin = '### SALT: {0}\n{1}'.format(tag, job)
|
||||
else:
|
||||
cmd = '{0} "{1}" | {2} {3}'.format(echo_cmd, name, binary, timespec)
|
||||
stdin = name
|
||||
cmd = '{0} {1}'.format(binary, timespec)
|
||||
|
||||
if user:
|
||||
luser = __salt__['user.info'](user)
|
||||
|
@ -83,9 +78,9 @@ def present(name, timespec, tag=None, user=None, job=None):
|
|||
ret['comment'] = 'User: {0} is not exists'.format(user)
|
||||
ret['result'] = False
|
||||
return ret
|
||||
ret['comment'] = __salt__['cmd.run']('{0}'.format(cmd), runas=user, python_shell=True)
|
||||
ret['comment'] = __salt__['cmd.run'](cmd, stdin=stdin, runas=user)
|
||||
else:
|
||||
ret['comment'] = __salt__['cmd.run']('{0}'.format(cmd), python_shell=True)
|
||||
ret['comment'] = __salt__['cmd.run'](cmd, stdin=stdin)
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue