Pass arguments for shell command as elements in a list. When shell=False, subprocess interprets the string as the name of an executable (including spaces) and fails to run.

This commit is contained in:
Pritpal Sabharwal 2017-03-16 10:49:30 +00:00
parent a6200ff629
commit 87efcc812b

View file

@ -23,7 +23,7 @@ class CheckPublicKeyFile(Task):
msg = 'Could not find public key at %s' % pubkey
info.manifest.validation_error(msg, ['plugins', 'admin_user', 'pubkey'])
ret, _, stderr = log_call('ssh-keygen -l -f ' + abs_pubkey)
ret, _, stderr = log_call(['ssh-keygen', '-l', '-f', abs_pubkey])
if ret != 0:
msg = 'Invalid public key file at %s' % pubkey
info.manifest.validation_error(msg, ['plugins', 'admin_user', 'pubkey'])