On 02/21/2013 01:50 PM, Martin Kosek wrote:
On 02/21/2013 01:29 PM, Tomas Babej wrote:
On 02/21/2013 12:47 PM, Martin Kosek wrote:
On 02/20/2013 10:31 AM, Tomas Babej wrote:
Hi,
When installing / uninstalling IPA client, the checks that
determine whether IPA client is installed now take the existence
of /etc/ipa/default.conf into consideration.
The client will not uninstall unless either something is backed
up or /etc/ipa/default.conf file does exist.
The client will not install if something is backed up or
default.conf file does exist (unless it's installation on master).
https://fedorahosted.org/freeipa/ticket/3331
Tomas
Can we create a function testing if ipa client is installed to avoid
duplication of the decision logic? Something like is_ipa_configured present in
ipaserver/install/installutils.py.
Keep in mind that we cannot use ipaserver package as it may not be present on
client.
Martin
Moved to is_ipa_client_installed function to ipautils.py
Updated patch attached.
Tomas
You just created a nice import loop:
...
I made the function part of ipa-client-install script then.
We probably will not need to check whether client is installed anywhere
else.
Tomas
>From 9351410b0dc3958a7dcd67ef404568f839f22bfe Mon Sep 17 00:00:00 2001
From: Tomas Babej <tba...@redhat.com>
Date: Tue, 19 Feb 2013 17:59:50 +0100
Subject: [PATCH] Use default.conf as flag of IPA client being installed
When installing / uninstalling IPA client, the checks that
determine whether IPA client is installed now take the existence
of /etc/ipa/default.conf into consideration.
The client will not uninstall unless either something is backed
up or /etc/ipa/default.conf file does exist.
The client will not install if something is backed up or
default.conf file does exist (unless it's installation on master).
https://fedorahosted.org/freeipa/ticket/3331
---
ipa-client/ipa-install/ipa-client-install | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index 2d32e28ece72c1058152787058c83ae5b06df64c..308c3f8d0ec39e1e7f048d37a34738bf6a4853e2 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -36,7 +36,9 @@ try:
from ipaclient.ipadiscovery import CACERT
import ipaclient.ipachangeconf
import ipaclient.ntpconf
- from ipapython.ipautil import run, user_input, CalledProcessError, file_exists, realm_to_suffix, convert_ldap_error
+ from ipapython.ipautil import run, user_input, CalledProcessError,\
+ file_exists, realm_to_suffix,\
+ convert_ldap_error
import ipapython.services as ipaservices
from ipapython import ipautil
from ipapython import sysrestore
@@ -281,9 +283,22 @@ def delete_ipa_domain():
root_logger.warning("IPA domain could not be deleted. "
"No access to the /etc/sssd/sssd.conf file.")
+def is_ipa_client_installed(on_master=False):
+ """
+ Consider IPA client not installed if nothing is backed up
+ and default.conf file does not exist. If on_master is set to True,
+ the existence of default.conf file is not taken into consideration,
+ since it has been already created by ipa-server-install.
+ """
+
+ installed = fstore.has_files() or \
+ (not on_master and os.path.exists('/etc/ipa/default.conf'))
+
+ return installed
+
def uninstall(options, env):
- if not fstore.has_files():
+ if not is_ipa_client_installed():
root_logger.error("IPA client is not configured on this system.")
return CLIENT_NOT_CONFIGURED
@@ -2326,7 +2341,7 @@ def main():
if options.uninstall:
return uninstall(options, env)
- if fstore.has_files():
+ if is_ipa_client_installed(on_master=options.on_master):
root_logger.error("IPA client is already configured on this system.")
root_logger.info(
"If you want to reinstall the IPA client, uninstall it first " +
--
1.7.11.7
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel