diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-12-18 14:46:41 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2013-02-04 18:48:02 -0500 |
commit | 981ebcce84770c9d48e80fc9b5ffd2bbf8fd0816 (patch) | |
tree | f656b7b675c780fed7ddd4e301338cd6fe89b7b4 /base/deploy/src/pkidestroy | |
parent | 3e0df521290e8159e36d1bdef52df297f20a809d (diff) | |
download | pki-981ebcce84770c9d48e80fc9b5ffd2bbf8fd0816.tar.gz pki-981ebcce84770c9d48e80fc9b5ffd2bbf8fd0816.tar.xz pki-981ebcce84770c9d48e80fc9b5ffd2bbf8fd0816.zip |
Added interactive subsystem installation.
The pkispawn has been modified such that the configuration file
and subsystem type are optional. The pkidestroy has been modified
such that the instance name and subsystem type are optional.
If any of these options are not specified they will enter an
interactive mode.
Ticket #380
Diffstat (limited to 'base/deploy/src/pkidestroy')
-rwxr-xr-x | base/deploy/src/pkidestroy | 68 |
1 files changed, 48 insertions, 20 deletions
diff --git a/base/deploy/src/pkidestroy b/base/deploy/src/pkidestroy index edb57e9ac..ba52d9642 100755 --- a/base/deploy/src/pkidestroy +++ b/base/deploy/src/pkidestroy @@ -1,4 +1,4 @@ -#!/usr/bin/python -t +#!/usr/bin/python -tu # Authors: # Matthew Harmsen <mharmsen@redhat.com> # @@ -94,17 +94,53 @@ def main(argv): 'PKI Instance Removal', log.PKIDESTROY_EPILOG) - parser.mandatory.add_argument('-i', + parser.optional.add_argument('-i', dest='pki_deployed_instance_name', action='store', - nargs=1, required=True, metavar='<instance>', + nargs=1, metavar='<instance>', help='FORMAT: ${pki_instance_name}') args = parser.process_command_line_arguments(argv) - # -i <instance name> - config.pki_deployed_instance_name =\ - str(args.pki_deployed_instance_name).strip('[\']') + interactive = False + + while True: + + # -s <subsystem> + if args.pki_subsystem is None: + interactive = True + config.pki_subsystem = parser.read_text('Subsystem (CA/KRA/OCSP/TKS)', + options=['CA', 'KRA', 'OCSP', 'TKS'], + default='CA', caseSensitive=False).upper() + else: + config.pki_subsystem = str(args.pki_subsystem).strip('[\']') + + # -i <instance name> + if args.pki_deployed_instance_name is None: + interactive = True + config.pki_deployed_instance_name = parser.read_text('Instance', default='pki-tomcat') + else: + config.pki_deployed_instance_name = str(args.pki_deployed_instance_name).strip('[\']') + + if interactive: + print + parser.indent = 0 + + begin = parser.read_text('Begin uninstallation (Yes/No/Quit)', + options=['Yes', 'Y', 'No', 'N', 'Quit', 'Q'], + sign='?', allowEmpty=False, caseSensitive=False).lower() + + print + + if begin == 'q' or begin == 'quit': + print "Uninstallation canceled." + sys.exit(0) + + elif begin == 'y' or begin == 'yes': + break + + else: + break # verify that previously deployed instance exists deployed_pki_instance_path = config.pki_root_prefix +\ @@ -135,6 +171,7 @@ def main(argv): config.USER_DEPLOYMENT_CONFIGURATION parser.validate() + parser.init_config() # Enable 'pkidestroy' logging. config.pki_log_dir = config.pki_root_prefix +\ @@ -161,20 +198,6 @@ def main(argv): extra=config.PKI_INDENTATION_LEVEL_0) sys.exit(1) - # NEVER print out 'sensitive' name/value pairs!!! - config.pki_log.debug(log.PKI_DICTIONARY_DEFAULT, - extra=config.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pkilogging.format(config.pki_default_dict), - extra=config.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_WEB_SERVER, - extra=config.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pkilogging.format(config.pki_web_server_dict), - extra=config.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(log.PKI_DICTIONARY_SUBSYSTEM, - extra=config.PKI_INDENTATION_LEVEL_0) - config.pki_log.debug(pkilogging.format(config.pki_subsystem_dict), - extra=config.PKI_INDENTATION_LEVEL_0) - # Combine the various sectional dictionaries into a PKI master dictionary parser.compose_pki_master_dictionary() config.pki_master_dict['pki_destroy_log'] = config.pki_log_dir + "/" +\ @@ -184,6 +207,8 @@ def main(argv): config.pki_log.debug(pkilogging.format(config.pki_master_dict), extra=config.PKI_INDENTATION_LEVEL_0) + print "Uninstalling " + config.pki_subsystem + " from " + deployed_pki_instance_path + "." + # Process the various "scriptlets" to remove the specified PKI subsystem. pki_subsystem_scriptlets = config.pki_master_dict['destroy_scriplets'].split() rv = 0 @@ -200,6 +225,9 @@ def main(argv): config.pki_log.debug(pkilogging.format(config.pki_master_dict), extra=config.PKI_INDENTATION_LEVEL_0) + print + print "Uninstallation complete." + # PKI Deployment Entry Point if __name__ == "__main__": |