diff options
author | Christian Heimes <cheimes@redhat.com> | 2018-02-07 14:22:06 +0100 |
---|---|---|
committer | Christian Heimes <cheimes@redhat.com> | 2018-02-15 14:02:03 +0100 |
commit | 0cc2a6cae01043f0aba32319ac8c6475780b6d7f (patch) | |
tree | 80942384094cb83b037cb11729f6689bbed1acaa /ipalib | |
parent | 0ee3a267112dfafe12726fb185a4ce260c67aff7 (diff) | |
download | freeipa-0cc2a6cae01043f0aba32319ac8c6475780b6d7f.tar.gz freeipa-0cc2a6cae01043f0aba32319ac8c6475780b6d7f.tar.xz freeipa-0cc2a6cae01043f0aba32319ac8c6475780b6d7f.zip |
Fix multiple uninstallation of server
"ipa-server-install --uninstall" no longer fails with error message
"'Env' object has no attribute 'basedn'" when executed on a system that
has no freeIPA server installation.
Fixes: https://pagure.io/freeipa/issue/7063
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Felipe Volpone <fbarreto@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/config.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ipalib/config.py b/ipalib/config.py index 4ee10d2a8..52b032a25 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -576,6 +576,16 @@ class Env(object): if 'log' not in self: self.log = self._join('logdir', '%s.log' % self.context) + # Workaround for ipa-server-install --uninstall. When no config file + # is available, we set realm, domain, and basedn to RFC 2606 reserved + # suffix to suppress attribute errors during uninstallation. + if (self.in_server and self.context == 'installer' and + not getattr(self, 'config_loaded', False)): + if 'realm' not in self: + self.realm = 'UNCONFIGURED.INVALID' + if 'domain' not in self: + self.domain = self.realm.lower() + if 'basedn' not in self and 'domain' in self: self.basedn = DN(*(('dc', dc) for dc in self.domain.split('.'))) |