Add ipa-server-install --uninstall

Add a --uninstall option to ipa-server-install which tries to
restore the system to the way it was before ipa-server-install
was run using the state backed up through sysrestore.py.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
This commit is contained in:
Mark McLoughlin
2008-01-11 11:57:36 +00:00
parent c7f3c746cc
commit 4a162f6fc8
8 changed files with 148 additions and 6 deletions

View File

@@ -74,15 +74,21 @@ def parse_options():
default=False, help="configure bind with our zone file")
parser.add_option("-U", "--unattended", dest="unattended", action="store_true",
default=False, help="unattended installation never prompts the user")
parser.add_option("", "--uninstall", dest="uninstall", action="store_true",
default=False, help="uninstall an existing installation")
options, args = parser.parse_args()
if options.unattended and (not options.ds_user or
not options.realm_name or
not options.dm_password or
not options.admin_password or
not options.master_password):
parser.error("error: In unattended mode you need to provide at least -u, -r, -p and -P options")
if options.uninstall:
if (options.ds_user or options.realm_name or
options.dm_password or options.admin_password or
options.master_password):
parser.error("error: In uninstall mode, -u, r, -p and -P options are not allowed")
elif options.unattended:
if (not options.ds_user or not options.realm_name or
not options.dm_password or not options.admin_password or
not options.master_password):
parser.error("error: In unattended mode you need to provide at least -u, -r, -p and -P options")
return options
@@ -241,6 +247,17 @@ def read_admin_password():
admin_password = read_password("IPA admin")
return admin_password
def uninstall():
ipaserver.ntpinstance.NTPInstance().uninstall()
ipaserver.bindinstance.BindInstance().uninstall()
ipaserver.webguiinstance.WebGuiInstance().uninstall()
ipaserver.httpinstance.HTTPInstance().uninstall()
ipaserver.krbinstance.KrbInstance().uninstall()
ipaserver.dsinstance.DsInstance().uninstall()
sysrestore.restore_file("/etc/hosts")
sysrestore.restore_file("/etc/ipa/ipa.conf")
return 0
def main():
global ds
ds = None
@@ -256,6 +273,9 @@ def main():
standard_logging_setup("ipaserver-install.log", options.debug)
if options.uninstall:
return uninstall()
print "=============================================================================="
print "This program will setup the FreeIPA Server."
print ""