summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl MacMillan <kmacmillan@mentalrootkit.com>2007-07-18 14:34:40 -0400
committerKarl MacMillan <kmacmillan@mentalrootkit.com>2007-07-18 14:34:40 -0400
commita53a4e71bb3e8710fd5373f9ac80c258c9f08e3d (patch)
tree0e2c2933a03dcb21a3918addfd0ed75335b77ee2
parent89c85f06d9a428bb0590cba3ebf2b3830802931e (diff)
downloadfreeipa.git-a53a4e71bb3e8710fd5373f9ac80c258c9f08e3d.tar.gz
freeipa.git-a53a4e71bb3e8710fd5373f9ac80c258c9f08e3d.tar.xz
freeipa.git-a53a4e71bb3e8710fd5373f9ac80c258c9f08e3d.zip
Added additional debugging information.
-rw-r--r--ipa-install/src/ipa-server-install23
-rw-r--r--ipa-install/src/ipa/dsinstance.py16
2 files changed, 38 insertions, 1 deletions
diff --git a/ipa-install/src/ipa-server-install b/ipa-install/src/ipa-server-install
index 5a611468..67fba74f 100644
--- a/ipa-install/src/ipa-server-install
+++ b/ipa-install/src/ipa-server-install
@@ -43,6 +43,8 @@ def parse_options():
help="admin password")
parser.add_option("-m", "--master-password", dest="master_password",
help="kerberos master password")
+ parser.add_option("-d", "--debug", dest="debug", action="store_true",
+ dest="debug", default=False, help="print debugging information")
options, args = parser.parse_args()
@@ -51,15 +53,34 @@ def parse_options():
return options
-def main():
+def logging_setup(options):
+ # Always log everything (i.e., DEBUG) to the log
+ # file.
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(message)s',
filename='ipa-install.log',
filemode='w')
+
+ console = logging.StreamHandler()
+ # If the debug option is set, also log debug messages to the console
+ if options.debug:
+ console.setLevel(logging.DEBUG)
+ else:
+ # Otherwise, log critical and error messages
+ console.setLevel(logging.ERROR)
+ formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
+ console.setFormatter(formatter)
+ logging.getLogger('').addHandler(console)
+
+def main():
options = parse_options()
+ logging_setup(options)
+
+ # Create a directory server instance
ds = ipa.dsinstance.DsInstance()
ds.create_instance(options.ds_user, options.realm_name, options.host_name, options.password)
+ # Create a kerberos instance
krb = ipa.krbinstance.KrbInstance()
krb.create_instance(options.ds_user, options.realm_name, options.host_name, options.password, options.master_password)
#restart ds after the krb instance have add the sasl map
diff --git a/ipa-install/src/ipa/dsinstance.py b/ipa-install/src/ipa/dsinstance.py
index a275bf40..f99563dd 100644
--- a/ipa-install/src/ipa/dsinstance.py
+++ b/ipa-install/src/ipa/dsinstance.py
@@ -59,6 +59,7 @@ def write_tmp_file(txt):
return fd
def run(args, stdin=None):
+ logging.debug("running command [%s]" % (" ".join(args)))
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if stdin:
stdout,stderr = p.communicate(stdin)
@@ -133,15 +134,26 @@ class DsInstance:
def __create_ds_user(self):
try:
pwd.getpwnam(self.ds_user)
+ logging.debug("ds user %s exists" % self.ds_user)
except KeyError:
+ logging.debug("adding ds user %s" % self.ds_user)
args = ["/usr/sbin/useradd", "-c", "DS System User", "-d", "/var/lib/fedora-ds", "-M", "-r", "-s", "/sbin/nologin", self.ds_user]
run(args)
+ logging.debug("done adding user")
def __create_instance(self):
+ logging.debug("creating ds instance . . . ")
inf_txt = template_str(INF_TEMPLATE, self.sub_dict)
+ logging.debug(inf_txt)
inf_fd = write_tmp_file(inf_txt)
+ logging.debug("writing inf template")
args = ["/usr/bin/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")
+ self.restart()
+ logging.debug("done restarting ds instance")
def __add_default_schemas(self):
shutil.copyfile(SHARE_DIR + "60kerberos.ldif",
@@ -150,14 +162,18 @@ class DsInstance:
self.schema_dirname() + "60samba.ldif")
def __enable_ssl(self):
+ logging.debug("configuring ssl for ds instance")
dirname = self.config_dirname()
args = ["/usr/sbin/ipa-server-setupssl", self.admin_password,
dirname, self.host_name]
run(args)
+ logging.debug("done configuring ssl for ds instance")
def __add_default_layout(self):
txt = template_file(SHARE_DIR + "bootstrap-template.ldif", self.sub_dict)
inf_fd = write_tmp_file(txt)
+ logging.debug("adding default ds layout")
args = ["/usr/bin/ldapmodify", "-xv", "-D", "cn=Directory Manager",
"-w", self.admin_password, "-f", inf_fd.name]
run(args)
+ logging.debug("done adding default ds layout")