diff options
author | Karl MacMillan <kmacmillan@mentalrootkit.com> | 2007-08-01 11:09:12 -0400 |
---|---|---|
committer | Karl MacMillan <kmacmillan@mentalrootkit.com> | 2007-08-01 11:09:12 -0400 |
commit | b1831b4593b3d219b79830f3012e7ff07f17b1d8 (patch) | |
tree | 0fbe5738ffed28161b8c4402180f1a5cd7513b51 /ipa-server | |
parent | cef59d76eb46c1af448a718bd018e192a0b41a78 (diff) | |
download | freeipa-b1831b4593b3d219b79830f3012e7ff07f17b1d8.tar.gz freeipa-b1831b4593b3d219b79830f3012e7ff07f17b1d8.tar.xz freeipa-b1831b4593b3d219b79830f3012e7ff07f17b1d8.zip |
Fix typo / buglets in setup scripts.
Add fallback to ds_newinst.pl.
Diffstat (limited to 'ipa-server')
-rw-r--r-- | ipa-server/ipa-install/ipa-server-install | 4 | ||||
-rw-r--r-- | ipa-server/ipaserver/dsinstance.py | 19 | ||||
-rw-r--r-- | ipa-server/ipaserver/util.py | 22 |
3 files changed, 33 insertions, 12 deletions
diff --git a/ipa-server/ipa-install/ipa-server-install b/ipa-server/ipa-install/ipa-server-install index ca27c9b2a..7abcafd8f 100644 --- a/ipa-server/ipa-install/ipa-server-install +++ b/ipa-server/ipa-install/ipa-server-install @@ -34,7 +34,7 @@ import logging from optparse import OptionParser import ipaserver.dsinstance import ipaserver.krbinstance -import ipaserver.util.run as run +from ipaserver.util import run def parse_options(): parser = OptionParser(version=VERSION) @@ -117,7 +117,7 @@ def main(): ds.restart() # Restart apache - run(["/sbin/server", "httpd", "restart"]) + run(["/sbin/service", "httpd", "restart"]) return 0 diff --git a/ipa-server/ipaserver/dsinstance.py b/ipa-server/ipaserver/dsinstance.py index 33514fefc..775a2f2b3 100644 --- a/ipa-server/ipaserver/dsinstance.py +++ b/ipa-server/ipaserver/dsinstance.py @@ -24,8 +24,6 @@ import tempfile import shutil import logging import pwd -import os -import stat from util import * @@ -52,14 +50,11 @@ def realm_to_suffix(realm_name): return ",".join(terms) def find_server_root(): - try: - mode = os.stat(SERVER_ROOT_64)[ST_MODE] - if stat.IS_DIR(mode): - return SERVER_ROOT_64 - except: + if dir_exists(SERVER_ROOT_64): + return SERVER_ROOT_64 + else: return SERVER_ROOT_32 - INF_TEMPLATE = """ [General] FullMachineName= $FQHN @@ -137,8 +132,12 @@ class DsInstance: logging.debug(inf_txt) inf_fd = write_tmp_file(inf_txt) logging.debug("writing inf template") - args = ["/usr/sbin/setup-ds.pl", "--silent", "--logfile", "-", "-f", inf_fd.name, ] - logging.debug("calling ds_newinst.pl") + if file_exists("/usr/sbin/setup-ds.pl"): + args = ["/usr/sbin/setup-ds.pl", "--silent", "--logfile", "-", "-f", inf_fd.name] + logging.debug("calling setup-ds.pl") + else: + args = ["/usr/sbin/ds_newinst.pl", inf_fd.name] + logging.debug("calling ds_newinst.pl") run(args) logging.debug("completed creating ds instance") logging.debug("restarting ds instance") diff --git a/ipa-server/ipaserver/util.py b/ipa-server/ipaserver/util.py index 3dcfb760a..2f677dad5 100644 --- a/ipa-server/ipaserver/util.py +++ b/ipa-server/ipaserver/util.py @@ -24,6 +24,8 @@ import string import tempfile import logging import subprocess +import os +import stat def realm_to_suffix(realm_name): s = realm_name.split(".") @@ -56,3 +58,23 @@ def run(args, stdin=None): if p.returncode != 0: raise subprocess.CalledProcessError(p.returncode, args[0]) + +def file_exists(filename): + try: + mode = os.stat(filename)[stat.ST_MODE] + if stat.S_ISREG(mode): + return True + else: + return False + except: + return False + +def dir_exists(filename): + try: + mode = os.stat(filename)[stat.ST_MODE] + if stat.S_ISDIR(mode): + return True + else: + return False + except: + return False |