#561 Replace subprocess.call() with subprocess.check_call()
Closed: Fixed None Opened 11 years ago by edewata.

The subprocess.check_call() is a better alternative than os.system() to execute external commands because the arguments can be passed as a list (no need for quotations) and it checks the return code.


Ran the following commands:

# cd pki

# git branch
* master

# git pull
Already up-to-date.

# find . -exec grep "os.system" /dev/null {} \;

# find . -exec grep "subprocess.check_call" /dev/null {} \;
./base/server/python/pki/server/deployment/pkihelper.py:            subprocess.check_call(command, shell=True)

So it appears that this ticket may have already been addressed.

It looks like the os.system() has been replaced with subprocess.call(). In some cases the command and arguments are passed as a list, but in some other cases they are concatenated into a single string. This is probably fine for now and can be changed incrementally in the future as needed. A bigger issue is the call() still doesn't check the return value of the command. So it's probably still important to change all call() into check_call() and see if the deployment still works.

Fix checked into 'master':

  • f4d52789e244633ef1a3166b2ef3e3c03b342c5d

Metadata Update from @edewata:
- Issue assigned to mharmsen
- Issue set to the milestone: 10.1 - 08/13 (August)

7 years ago

Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new
issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.

This issue has been cloned to GitHub and is available here:
https://github.com/dogtagpki/pki/issues/1131

If you want to receive further updates on the issue, please navigate to the
GitHub issue and click on Subscribe button.

Thank you for understanding, and we apologize for any inconvenience.

Login to comment on this ticket.

Metadata