py3: fix CSR encoding inside framework

csr must be in string because framework excpects only strings, so we
have to decode it back

https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Martin Basti 2017-01-13 18:54:34 +01:00
parent 1023cfebff
commit d5ab0637fe
2 changed files with 4 additions and 2 deletions

View File

@ -804,7 +804,9 @@ class cert_request(Create, BaseCertMethod, VirtualCommand):
try:
# re-serialise to PEM, in case the user-supplied data has
# extraneous material that will cause Dogtag to freak out
csr_pem = csr_obj.public_bytes(serialization.Encoding.PEM)
# keep it as string not bytes, it is required later
csr_pem = csr_obj.public_bytes(
serialization.Encoding.PEM).decode('utf-8')
result = self.Backend.ra.request_certificate(
csr_pem, profile_id, ca_id, request_type=request_type)
except errors.HTTPRequestError as e:

View File

@ -1634,7 +1634,7 @@ class ra(rabase.rabase, RestClient):
self.debug('%s.request_certificate()', type(self).__name__)
# Call CMS
template = '''<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
template = u'''<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<CertEnrollmentRequest>
<ProfileID>{profile}</ProfileID>
<Input id="i1">