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

Matthew Harmsen mharmsen at redhat.com
Wed Aug 21 00:05:08 UTC 2013


On 08/19/13 22:00, Endi Sukma Dewata wrote:
> 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.
>
I have attached a new patch which addresses (1) and (2) above; please 
review.

-- Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20130820-converted-strings-to-lists-and-applied-subprocess.patch
Type: text/x-patch
Size: 33533 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pki-devel/attachments/20130820/78ada990/attachment.bin>


More information about the Pki-devel mailing list