Adam Stokes wrote:
----- Original Message -----
From: "Michael DeHaan" <mdehaan@xxxxxxxxxx>
To: "Adam Stokes" <ajs@xxxxxxxxxx>
Cc: func-list@xxxxxxxxxx
Sent: Wednesday, December 10, 2008 9:28:04 AM GMT -05:00 Columbia
Subject: Re: combining commands with the command module?
Adam Stokes wrote:
Is there a proper way to combine commands for use in the command module? Something like :
Here is a snippet of my code but of coures fails on the command run
try:
import func.overlord.client as fc
# Pull the architecture from the elf file to match up with a
# server providing this architecture
debugKernelArch = self.util.debugKernelArch(debugKernel)
if os.path.isfile(SERVERS):
serverList = self.util.load(SERVERS)
if serverList.has_key(debugKernelArch):
# TODO: Randomize server selection
casProcessMachine = serverList[debugKernelArch][0]
cmd = "cd %s; %s" % (self.storagePath,os.path.join(self.storagePath,"crash"))
client = fc.Overlord(casProcessMachine)
client_dict = client.command.run(cmd) <- epic fail
# Only necessary for debugging why running of crash failed.
# (sts, out, err) = client_dict[client_dict.keys()[0]]
else:
print("No servers available for arch, please run cas-admin -h " \
"for more information")
print("Continueing without processing core.")
else:
print("No servers database found, please run cas-admin -h for " \
"more information")
sys.exit(1)
except ImportError:
print("You need to install func (http://fedorahosted.org/func if you "\
"wish to have the data processed automatically.")
Errors with:
{'megatron.gsslab.rdu.redhat.com': ['REMOTE_ERROR', 'exceptions.OSError', '[Errno 2] No such file or directory', ' File "/usr/lib/python2.4/site-packages/func/minion/server.py", line 138, in __call__\n rc = self.__method(*args)\n File "/usr/lib/python2.4/site-packages/func/minion/modules/command.py", line 32, in run\n stderr=sub_process.PIPE, shell=False)\n File "/usr/lib/python2.4/site-packages/func/minion/sub_process.py", line 593, in __init__\n errread, errwrite)\n File "/usr/lib/python2.4/site-packages/func/minion/sub_process.py", line 1055, in _execute_child\n raise child_exception\n']}
Thanks
The existing release does not use the shell (python subprocess's
shell=True) when running commands. I believe the version in git does,
you may want to try this.
--Michael
no luck :-( any other thoughts?
Hmm, this seems to work for me. Well, at least commands like;
func "*" call command run "cd /tmp; ls"
func "*" call command run " echo blip >> /tmp/test.foo"; ls /tmp"
Even on non existing command, I just get a shell error for command not found
(all of the above with the git version, btw)
Adrian
_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list