summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-10-29 14:34:47 -0400
committerRob Crittenden <rcritten@redhat.com>2008-10-29 17:09:55 -0400
commit19ba6ead8a376778b68c5d389473bb73c329b1bb (patch)
treed7b53cc4770cbd9f9b41ebf62d512bbf439c46a9
parentb7f338f2c939c3c145bb440b4d469097c795699c (diff)
downloadfreeipa-19ba6ead8a376778b68c5d389473bb73c329b1bb.zip
freeipa-19ba6ead8a376778b68c5d389473bb73c329b1bb.tar.gz
freeipa-19ba6ead8a376778b68c5d389473bb73c329b1bb.tar.xz
Don't report spurious upgrade message if IPA has not been configured yet.
This was throwing the error "Unable to determine hostname from ipa-rewrite.conf" during RPM %post on unconfigured servers where there is nothing to do. 468947
-rw-r--r--ipa-server/ipa-upgradeconfig21
1 files changed, 12 insertions, 9 deletions
diff --git a/ipa-server/ipa-upgradeconfig b/ipa-server/ipa-upgradeconfig
index 2fa2901..9f2c6cb 100644
--- a/ipa-server/ipa-upgradeconfig
+++ b/ipa-server/ipa-upgradeconfig
@@ -42,14 +42,13 @@ def update_conf(sub_dict, filename, template_filename):
def find_hostname():
"""Find the hostname currently configured in ipa-rewrite.conf"""
filename="/etc/httpd/conf.d/ipa-rewrite.conf"
- if os.path.exists(filename):
- pattern = "^[\s#]*.*https:\/\/([A-Za-z0-9\.\-]*)\/.*"
- p = re.compile(pattern)
- for line in fileinput.input(filename):
- if p.search(line):
- fileinput.close()
- return p.search(line).group(1)
- fileinput.close()
+ pattern = "^[\s#]*.*https:\/\/([A-Za-z0-9\.\-]*)\/.*"
+ p = re.compile(pattern)
+ for line in fileinput.input(filename):
+ if p.search(line):
+ fileinput.close()
+ return p.search(line).group(1)
+ fileinput.close()
return None
@@ -92,7 +91,11 @@ def main():
print "Unable to get default kerberos realm: %s" % e[1]
sys.exit(1)
- fqdn = find_hostname()
+ try:
+ fqdn = find_hostname()
+ except IOError:
+ # ipa-rewrite.conf doesn't exist, nothing to do
+ sys.exit(0)
if fqdn is None:
print "Unable to determine hostname from ipa-rewrite.conf"