diff options
author | Tomas Babej <tbabej@redhat.com> | 2012-10-02 09:15:33 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-10-31 11:54:15 -0400 |
commit | e7c99e7d21f7923c92cf9dae9fd8c7d5ae4aa8cd (patch) | |
tree | b150a2142a9b2022f6edddc24ebfc3f60fbab43c /ipapython | |
parent | fe66fbe637132ac5eb22eea388e2261f33497bf5 (diff) | |
download | freeipa-e7c99e7d21f7923c92cf9dae9fd8c7d5ae4aa8cd.tar.gz freeipa-e7c99e7d21f7923c92cf9dae9fd8c7d5ae4aa8cd.tar.xz freeipa-e7c99e7d21f7923c92cf9dae9fd8c7d5ae4aa8cd.zip |
IPA Server check in ipa-replica-manage
When executing ipa-replica-manage connect to an master that raises
NotFound error we now check if the master is at least IPA server.
If so, we inform the user that it is probably foreign or previously
deleted master. If not, we inform the user that the master is not
an IPA server at all.
https://fedorahosted.org/freeipa/ticket/3105
Diffstat (limited to 'ipapython')
-rw-r--r-- | ipapython/ipautil.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index e76d87d3d..c444d8c9e 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -810,6 +810,19 @@ def is_host_resolvable(fqdn): return False +def host_exists(host): + """ + Resolve the host to see if it exists. + + Returns True/False + """ + try: + socket.getaddrinfo(host, 80) + except socket.gaierror: + return False + else: + return True + def get_ipa_basedn(conn): """ Get base DN of IPA suffix in given LDAP server. |