Issue #3325 has been updated by Roy Nielsen.

I was able to correct the awk line, so it does return 0, however it doesn't 
actually perform the job.

here's what now returns 0 (but doesn't actually stop the launchd job)

command => "launchctl list | awk /$job_real/'{system(\"launchctl stop \" 
\$3)}'",

I can't get the other command to return 0, the (changed) command is:

command   => "/bin/launchctl stop `/bin/launchctl list | /usr/bin/grep 
'$job_real' | /usr/bin/cut -f 3` ",

  returns:

err: 
//unload_sav/Stop_launchd_job[QuickMenu]/Exec[com.symantec.quickmenu]/returns: 
change from notrun to 0 failed: /bin/launchctl stop `/bin/launchctl list | 
/usr/bin/grep 'com.symantec.quickmenu' | /usr/bin/cut -f 3`  returned 1 instead 
of one of [0] at 
/var/puppet/environments/test/modules/lanl-baseline/manifests/definitions/stop_launchd_job.pp:42

however it both work as run, straight on the command line.

Regards,
-Roy

----------------------------------------
Bug #3325: Exec failure, possibly because `` or system() in the command
http://projects.reductivelabs.com/issues/3325

Author: Roy Nielsen
Status: Investigating
Priority: Normal
Assigned to: Markus Roberts
Category: exec
Target version: 
Affected version: 0.25.1
Keywords: exec spawn
Branch: 


I'm using puppet 0.25.1 - and I'm trying to create a custom resource to use 
launchctl to stop a launchd job.

command => "launchctl stop `launchctl list | grep $job_real | cut -f 3`",

yeilds:

err:
//sav/Stop_launchd_job[com.Symantec.SymSecondaryLaunch]/Exec[com.Symantec.SymSecondaryLaunch]/returns:
change from notrun to 0 failed: launchctl stop `launchctl list | grep
com.Symantec.SymSecondaryLaunch | cut -f 3` returned 1 instead of one of
[0] at
/var/puppet/environments/development/modules/lanl-baseline/manifests/definitions/stop_launchd_job.pp:49

and

command => "launchctl list | awk /$job_real/'{system(\"launchctl stop \"
\"\\\"\"\$3\"\\\"\");}'`",

yeilds:

err:
//sav/Stop_launchd_job[com.Symantec.SymSecondaryLaunch]/Exec[com.Symantec.SymSecondaryLaunch]/returns:
change from notrun to 0 failed: launchctl list | awk
/com.Symantec.SymSecondaryLaunch/'{system("launchctl stop "
"\""$3"\"");}'` returned 2 instead of one of [0] at
/var/puppet/environments/development/modules/lanl-baseline/manifests/definitions/stop_launchd_job.pp:49

Both commands work when done at the command-line (as seen in the error...)
and return 0 (when run at the command line).

Is the problem that with either command I'm either doing a `` or system()
call in the "command"?

If you'd like me to post the whole resource, I'd be happy to.

-Roy Nielsen



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to