diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-02-11 13:07:19 -0700 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-17 16:03:09 -0500 |
commit | e0fe7323187df205c0994cc3fa4e0ee0b6445788 (patch) | |
tree | a9ce7b1211174ef064004f2e4e547d05c94562b4 /ipalib/plugins/cert.py | |
parent | 0e6e11d2e3836f9667f1c5beda4487dbbeffc25b (diff) | |
download | freeipa-e0fe7323187df205c0994cc3fa4e0ee0b6445788.tar.gz freeipa-e0fe7323187df205c0994cc3fa4e0ee0b6445788.tar.xz freeipa-e0fe7323187df205c0994cc3fa4e0ee0b6445788.zip |
Added env.enable_ra variable and change cert.py and ra.py plugin modules to register plugins conditionally
Diffstat (limited to 'ipalib/plugins/cert.py')
-rw-r--r-- | ipalib/plugins/cert.py | 144 |
1 files changed, 73 insertions, 71 deletions
diff --git a/ipalib/plugins/cert.py b/ipalib/plugins/cert.py index 9854830a4..22ec4c6a0 100644 --- a/ipalib/plugins/cert.py +++ b/ipalib/plugins/cert.py @@ -22,108 +22,110 @@ Command plugins for IPA-RA certificate operations. """ -from ipalib import api, Command, Str, Int +from ipalib import api +if api.env.enable_ra: + from ipalib import Command, Str, Int -class cert_request(Command): - """ - Submit a certificate singing request. - """ + class cert_request(Command): + """ + Submit a certificate singing request. + """ - takes_args = ('csr',) + takes_args = ('csr',) - takes_options = ( - Str('request_type', default=u'pkcs10', autofill=True), - ) + takes_options = ( + Str('request_type', default=u'pkcs10', autofill=True), + ) - def execute(self, csr, **options): - return self.Backend.ra.request_certificate(csr, **options) + def execute(self, csr, **options): + return self.Backend.ra.request_certificate(csr, **options) - def output_for_cli(self, textui, result, *args, **options): - if isinstance(result, dict) and len(result) > 0: - textui.print_entry(result, 0) - else: - textui.print_plain('Failed to submit a certificate request.') + def output_for_cli(self, textui, result, *args, **options): + if isinstance(result, dict) and len(result) > 0: + textui.print_entry(result, 0) + else: + textui.print_plain('Failed to submit a certificate request.') -api.register(cert_request) + api.register(cert_request) -class cert_status(Command): - """ - Check status of a certificate signing request. - """ + class cert_status(Command): + """ + Check status of a certificate signing request. + """ - takes_args = ['request_id'] + takes_args = ['request_id'] - def execute(self, request_id, **options): - return self.Backend.ra.check_request_status(request_id) + def execute(self, request_id, **options): + return self.Backend.ra.check_request_status(request_id) - def output_for_cli(self, textui, result, *args, **options): - if isinstance(result, dict) and len(result) > 0: - textui.print_entry(result, 0) - else: - textui.print_plain('Failed to retrieve a request status.') + def output_for_cli(self, textui, result, *args, **options): + if isinstance(result, dict) and len(result) > 0: + textui.print_entry(result, 0) + else: + textui.print_plain('Failed to retrieve a request status.') -api.register(cert_status) + api.register(cert_status) -class cert_get(Command): - """ - Retrieve an existing certificate. - """ + class cert_get(Command): + """ + Retrieve an existing certificate. + """ - takes_args = ['serial_number'] + takes_args = ['serial_number'] - def execute(self, serial_number): - return self.Backend.ra.get_certificate(serial_number) + def execute(self, serial_number): + return self.Backend.ra.get_certificate(serial_number) - def output_for_cli(self, textui, result, *args, **options): - if isinstance(result, dict) and len(result) > 0: - textui.print_entry(result, 0) - else: - textui.print_plain('Failed to obtain a certificate.') + def output_for_cli(self, textui, result, *args, **options): + if isinstance(result, dict) and len(result) > 0: + textui.print_entry(result, 0) + else: + textui.print_plain('Failed to obtain a certificate.') -api.register(cert_get) + api.register(cert_get) -class cert_revoke(Command): - """ - Revoke a certificate. - """ + class cert_revoke(Command): + """ + Revoke a certificate. + """ - takes_args = ['serial_number'] + takes_args = ['serial_number'] - # FIXME: The default is 0. Is this really an Int param? - takes_options = [Int('revocation_reason?', default=0)] + # FIXME: The default is 0. Is this really an Int param? + takes_options = [Int('revocation_reason?', default=0)] - def execute(self, serial_number, **options): - return self.Backend.ra.revoke_certificate(serial_number, **options) + def execute(self, serial_number, **options): + return self.Backend.ra.revoke_certificate(serial_number, **options) - def output_for_cli(self, textui, result, *args, **options): - if isinstance(result, dict) and len(result) > 0: - textui.print_entry(result, 0) - else: - textui.print_plain('Failed to revoke a certificate.') + def output_for_cli(self, textui, result, *args, **options): + if isinstance(result, dict) and len(result) > 0: + textui.print_entry(result, 0) + else: + textui.print_plain('Failed to revoke a certificate.') -api.register(cert_revoke) + api.register(cert_revoke) -class cert_remove_hold(Command): - """ - Take a revoked certificate off hold. - """ + class cert_remove_hold(Command): + """ + Take a revoked certificate off hold. + """ - takes_args = ['serial_number'] + takes_args = ['serial_number'] - def execute(self, serial_number, **options): - return self.Backend.ra.take_certificate_off_hold(serial_number) + def execute(self, serial_number, **options): + return self.Backend.ra.take_certificate_off_hold(serial_number) - def output_for_cli(self, textui, result, *args, **options): - if isinstance(result, dict) and len(result) > 0: - textui.print_entry(result, 0) - else: - textui.print_plain('Failed to take a revoked certificate off hold.') + def output_for_cli(self, textui, result, *args, **options): + if isinstance(result, dict) and len(result) > 0: + textui.print_entry(result, 0) + else: + textui.print_plain('Failed to take a revoked certificate off hold.') -api.register(cert_remove_hold) + api.register(cert_remove_hold) |