summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-01-11 09:43:09 -0500
committerSimo Sorce <ssorce@redhat.com>2012-01-11 12:04:23 -0500
commitd06acdbc9068ec5ff060cc9f941d5f348e36ed8c (patch)
treeae007931954bbb8a20a9699b68c90c98f521120c
parent843d116acbe312d082e30abd37b2f69771f9efaa (diff)
downloadfreeipa.git-d06acdbc9068ec5ff060cc9f941d5f348e36ed8c.tar.gz
freeipa.git-d06acdbc9068ec5ff060cc9f941d5f348e36ed8c.tar.xz
freeipa.git-d06acdbc9068ec5ff060cc9f941d5f348e36ed8c.zip
Remove buffer log handling.
This is properly handled by the new logging subsystem.
-rwxr-xr-xinstall/tools/ipa-ca-install1
-rwxr-xr-xinstall/tools/ipa-dns-install1
-rwxr-xr-xinstall/tools/ipa-replica-install1
-rwxr-xr-xinstall/tools/ipa-server-install2
-rw-r--r--ipaserver/install/installutils.py64
5 files changed, 0 insertions, 69 deletions
diff --git a/install/tools/ipa-ca-install b/install/tools/ipa-ca-install
index e91ca1e4..57f867e7 100755
--- a/install/tools/ipa-ca-install
+++ b/install/tools/ipa-ca-install
@@ -71,7 +71,6 @@ def get_dirman_password():
return installutils.read_password("Directory Manager (existing master)", confirm=False, validate=False)
def main():
- installutils.bootstrap_logging()
safe_options, options, filename = parse_options()
standard_logging_setup("/var/log/ipareplica-ca-install.log", debug=options.debug)
root_logger.debug('%s was invoked with argument "%s" and options: %s' % (sys.argv[0], filename, safe_options))
diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install
index 740c8746..5c02c20c 100755
--- a/install/tools/ipa-dns-install
+++ b/install/tools/ipa-dns-install
@@ -84,7 +84,6 @@ def parse_options():
return safe_options, options
def main():
- bootstrap_logging()
safe_options, options = parse_options()
if os.getegid() != 0:
diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install
index 701d0354..fd772e57 100755
--- a/install/tools/ipa-replica-install
+++ b/install/tools/ipa-replica-install
@@ -265,7 +265,6 @@ def check_bind():
sys.exit(1)
def main():
- installutils.bootstrap_logging()
safe_options, options, filename = parse_options()
standard_logging_setup("/var/log/ipareplica-install.log", debug=options.debug)
root_logger.debug('%s was invoked with argument "%s" and options: %s' % (sys.argv[0], filename, safe_options))
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index dceacce8..7a2e2aa1 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -526,8 +526,6 @@ def main():
global installation_cleanup
ds = None
- bootstrap_logging()
-
safe_options, options = parse_options()
if os.getegid() != 0:
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index f82d2ebc..817308f1 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -314,70 +314,6 @@ def port_available(port):
return rv
-class BufferingHandler(logging.Handler):
- log_queue = []
-
- def __init__(self):
- logging.Handler.__init__(self)
- self.level = logging.DEBUG
-
- def emit(self, record):
- self.log_queue.append(record)
-
- def flush(self):
- pass
-
-def bootstrap_logging():
- """
- Bootstrap logging and create special handler which will buffer any log
- emitted before standard_logging_setup is called. These will be later
- processed when the logging is set up.
- """
- root_logger = logging.getLogger()
- root_logger.setLevel(logging.DEBUG)
- root_logger.addHandler(BufferingHandler())
-
-def standard_logging_setup(log_filename, debug=False, filemode='w'):
- """
- Set up logging. bootstrap_logging() should be called earlier if there
- is a chance that a log is emitted before this setup.
- """
- root_logger = logging.getLogger()
- log_queue = []
-
- if root_logger.handlers:
- # Remove any handlers that may have been set and which may cause
- # problems with logging in install utils
- handler_list = list(logging.getLogger().handlers)
-
- for handler in handler_list:
- if isinstance(handler, BufferingHandler):
- log_queue.extend(handler.log_queue)
- root_logger.removeHandler(handler)
-
- old_umask = os.umask(077)
- # Always log everything (i.e., DEBUG) to the log
- # file.
- logging.basicConfig(level=logging.DEBUG,
- format='%(asctime)s %(levelname)s %(message)s',
- filename=log_filename,
- filemode=filemode)
- os.umask(old_umask)
-
- console = logging.StreamHandler()
- # If the debug option is set, also log debug messages to the console
- if 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)
-
- for log_record in log_queue:
- root_logger.handle(log_record)
-
def get_password(prompt):
if os.isatty(sys.stdin.fileno()):
return getpass.getpass(prompt)