[Pki-devel] [PATCH] TRAC Ticket #561 - Replace subprocess.call() with subprocess.check_call()

Endi Sukma Dewata edewata at redhat.com
Tue Aug 20 05:00:52 UTC 2013


On 8/16/2013 5:09 PM, Matthew Harmsen wrote:
> Please review the attached patch for the following TRAC ticket:
>
>   * https://fedorahosted.org/pki/ticket/561 TRAC Ticket #561 - Replace
>     subprocess.call() with subprocess.check_call()
>
> This patch was tested by successfully installing default versions of a
> CA and a KRA.

I have a different result on an F18 machine:

1. Build failed due to pylint errors:

E0602:2664,25:KRAConnector.execute_using_pki: Undefined variable 'https'
E0602:2938,25:SecurityDomain.get_installation_token: Undefined variable 
'https'

It looks like the 'https' should have been quoted.

2. I tried running the following test code:

   import subprocess
   command = ["/bin/echo", "test", ">", "/dev/null", "2>&1"]
   subprocess.check_call(command, stdout=None)

The ">" redirection doesn't seem to work, it's actually printed to the 
screen. To get it to work correctly I had to specify shell=True. 
Alternatively, it's also possible to open /dev/null file and pass the 
file handler:

   with open(os.devnull, "w") as fnull:
     subprocess.check_call(command, stdout=fnull, stderr=fnull)

There are some instances in the code where the ">" redirection is used 
without shell=True.

-- 
Endi S. Dewata




More information about the Pki-devel mailing list