mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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:
@@ -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 ""
|
||||
|
||||
Reference in New Issue
Block a user