Convert certificate generation to processutils.

Its a bit concerning that this doesn't have unit test coverage,
but I'm just here to make things no use utils.execute().

Change-Id: I76ccea47245d46def4b500e29681200ae951b7d0
blueprint: execs-ive-had-a-few
This commit is contained in:
Michael Still 2018-04-25 19:25:09 +10:00
parent d08314d80f
commit b3d2c2a94a

View File

@ -30,6 +30,7 @@ from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
from cryptography import x509
from oslo_concurrency import processutils
from oslo_log import log as logging
import paramiko
import six
@ -119,14 +120,14 @@ def generate_winrm_x509_cert(user_id, bits=2048):
_create_x509_openssl_config(conffile, upn)
(certificate, _err) = utils.execute(
(certificate, _err) = processutils.execute(
'openssl', 'req', '-x509', '-nodes', '-days', '3650',
'-config', conffile, '-newkey', 'rsa:%s' % bits,
'-outform', 'PEM', '-keyout', keyfile, '-subj', subject,
'-extensions', 'v3_req_client',
binary=True)
(out, _err) = utils.execute('openssl', 'pkcs12', '-export',
(out, _err) = processutils.execute('openssl', 'pkcs12', '-export',
'-inkey', keyfile, '-password', 'pass:',
process_input=certificate,
binary=True)