ipa-adtrust-install: Add warning that we will break existing samba configuration

In case /etc/samba/smb.conf exists and it was not created by ipa-adtrust-install,
print a warning that we will break existing samba configuration and ask for
a confirmation in the interactive mode.

Part of: https://fedorahosted.org/freeipa/ticket/3479
This commit is contained in:
Tomas Babej
2013-10-09 12:52:33 +02:00
committed by Martin Kosek
parent 4a95a50596
commit 45e310ecc4

View File

@@ -264,13 +264,25 @@ def main():
allow_empty = False):
sys.exit("Aborting installation.")
# Check if /etc/samba/smb.conf already exists. In case it was not generated
# by IPA, print a warning that we will break existing configuration.
if adtrustinstance.ipa_smb_conf_exists():
if not options.unattended:
while True:
print "IPA generated smb.conf detected."
if not ipautil.user_input("Overwrite smb.conf?", default = False, allow_empty = False):
if not ipautil.user_input("Overwrite smb.conf?",
default = False,
allow_empty = False):
sys.exit("Aborting installation.")
break
elif os.path.exists('/etc/samba/smb.conf'):
print("WARNING: The smb.conf already exists. Running ipa-adtrust-install
"will break your existing samba configuration.\n\n")
if not options.unattended:
if not ipautil.user_input("Do you wish to continue?",
default = False,
allow_empty = False):
sys.exit("Aborting installation.")
if not options.unattended and not options.enable_compat:
options.enable_compat = enable_compat_tree()