diff options
author | Jan Cholasta <jcholast@redhat.com> | 2015-12-10 07:23:18 +0100 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-12-11 07:11:46 +0100 |
commit | b4a78db4e7d06237a715f088d1b914b47eccf32f (patch) | |
tree | 7b660d58a58907aea6697ee6e38b924c3c0a658c /ipaserver/install/server/replicainstall.py | |
parent | 8f36a5bd68140fdd338d9c738977a6c67fdfdf08 (diff) | |
download | freeipa-b4a78db4e7d06237a715f088d1b914b47eccf32f.tar.gz freeipa-b4a78db4e7d06237a715f088d1b914b47eccf32f.tar.xz freeipa-b4a78db4e7d06237a715f088d1b914b47eccf32f.zip |
replica promotion: check domain level before ipaservers membership
Check domain level before checking ipaservers membership to prevent
"not found" error when attempting replica promotion in domain level 0.
https://fedorahosted.org/freeipa/ticket/5401
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipaserver/install/server/replicainstall.py')
-rw-r--r-- | ipaserver/install/server/replicainstall.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py index 4f239aacd..97f19c7fd 100644 --- a/ipaserver/install/server/replicainstall.py +++ b/ipaserver/install/server/replicainstall.py @@ -975,6 +975,20 @@ def promote_check(installer): replman = ReplicationManager(config.realm_name, config.master_host_name, None) + # Detect the current domain level + try: + current = remote_api.Command['domainlevel_get']()['result'] + except errors.NotFound: + # If we're joining an older master, domain entry is not + # available + current = constants.DOMAIN_LEVEL_0 + + if current == constants.DOMAIN_LEVEL_0: + raise RuntimeError( + "You must provide a file generated by ipa-replica-prepare to " + "create a replica when the domain is at level 0." + ) + # Check authorization result = remote_api.Command['hostgroup_find']( cn=u'ipaservers', @@ -1029,20 +1043,6 @@ def promote_check(installer): config.host_name) sys.exit(3) - # Detect the current domain level - try: - current = remote_api.Command['domainlevel_get']()['result'] - except errors.NotFound: - # If we're joining an older master, domain entry is not - # available - current = constants.DOMAIN_LEVEL_0 - - if current == constants.DOMAIN_LEVEL_0: - raise RuntimeError( - "You must provide a file generated by ipa-replica-prepare to " - "create a replica when the domain is at level 0." - ) - # Detect if current level is out of supported range # for this IPA version under_lower_bound = current < constants.MIN_DOMAIN_LEVEL |