Re: combining commands with the command module?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux