From 2c31dcbd0bc41c2af214a8ed358d7c134cccc339 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Sun, 6 Aug 2017 08:54:58 +0300 Subject: [PATCH] Admin-Utils NSX|v3: Fix constants and typo in cert util Change-Id: I63cfff15e507fcee7121dcee2b488fb08e7641bb --- .../plugins/nsxv3/resources/certificates.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/vmware_nsx/shell/admin/plugins/nsxv3/resources/certificates.py b/vmware_nsx/shell/admin/plugins/nsxv3/resources/certificates.py index 6a66772b23..d1ec6df12a 100644 --- a/vmware_nsx/shell/admin/plugins/nsxv3/resources/certificates.py +++ b/vmware_nsx/shell/admin/plugins/nsxv3/resources/certificates.py @@ -106,13 +106,12 @@ def generate_cert(resource, event, trigger, **kwargs): return signature_alg = properties.get('sig-alg') - # TODO(annak): use nsxlib constants when they land subject = {} - subject['country'] = properties.get('country') - subject['state'] = properties.get('state') - subject['organization'] = properties.get('org') - subject['unit'] = properties.get('org') - subject['hostname'] = properties.get('host') + subject[client_cert.CERT_SUBJECT_COUNTRY] = properties.get('country') + subject[client_cert.CERT_SUBJECT_STATE] = properties.get('state') + subject[client_cert.CERT_SUBJECT_ORG] = properties.get('org') + subject[client_cert.CERT_SUBJECT_UNIT] = properties.get('org') + subject[client_cert.CERT_SUBJECT_HOST] = properties.get('host') with get_certificate_manager(**kwargs) as cert: if cert.exists(): @@ -126,7 +125,7 @@ def generate_cert(resource, event, trigger, **kwargs): LOG.info(e) return - LOG.info("Client certificate generated succesfully") + LOG.info("Client certificate generated successfully") @admin_utils.output_header @@ -149,7 +148,7 @@ def delete_cert(resource, event, trigger, **kwargs): return cert.delete() - LOG.info("Client certificate deleted succesfully") + LOG.info("Client certificate deleted successfully") @admin_utils.output_header @@ -221,7 +220,7 @@ def import_cert(resource, event, trigger, **kwargs): return cert.import_pem(filename) - LOG.info("Client certificate imported succesfully") + LOG.info("Client certificate imported successfully") @admin_utils.output_header