summaryrefslogtreecommitdiffstats
path: root/ipapython/sysrestore.py
diff options
context:
space:
mode:
authorJohn Dennis <jdennis@redhat.com>2011-11-15 14:39:31 -0500
committerMartin Kosek <mkosek@redhat.com>2011-11-23 09:36:18 +0100
commit56401c1abe7d4c78650acfcd9bbe8c8edc1dac57 (patch)
treea759f9fb51d4e2e110c55dbecc45f436386ee30f /ipapython/sysrestore.py
parent730f1228a91ec9c6e575181807da2ab994a38071 (diff)
downloadfreeipa-56401c1abe7d4c78650acfcd9bbe8c8edc1dac57.tar.gz
freeipa-56401c1abe7d4c78650acfcd9bbe8c8edc1dac57.tar.xz
freeipa-56401c1abe7d4c78650acfcd9bbe8c8edc1dac57.zip
ticket 2022 - modify codebase to utilize IPALogManager, obsoletes logging
change default_logger_level to debug in configure_standard_logging add new ipa_log_manager module, move log_mgr there, also export root_logger from log_mgr. change all log_manager imports to ipa_log_manager and change log_manager.root_logger to root_logger. add missing import for parse_log_level()
Diffstat (limited to 'ipapython/sysrestore.py')
-rw-r--r--ipapython/sysrestore.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/ipapython/sysrestore.py b/ipapython/sysrestore.py
index e22b4d4fa..8177a1bf2 100644
--- a/ipapython/sysrestore.py
+++ b/ipapython/sysrestore.py
@@ -26,7 +26,7 @@
import os
import os.path
import shutil
-import logging
+from ipapython.ipa_log_manager import *
import ConfigParser
import random
import string
@@ -61,7 +61,7 @@ class FileStore:
be an empty dictionary if the file doesn't exist.
"""
- logging.debug("Loading Index file from '%s'", self._index)
+ root_logger.debug("Loading Index file from '%s'", self._index)
self.files = {}
@@ -78,10 +78,10 @@ class FileStore:
"""Save the file list to @_index. If @files is an empty
dict, then @_index should be removed.
"""
- logging.debug("Saving Index File to '%s'", self._index)
+ root_logger.debug("Saving Index File to '%s'", self._index)
if len(self.files) == 0:
- logging.debug(" -> no files, removing file")
+ root_logger.debug(" -> no files, removing file")
if os.path.exists(self._index):
os.remove(self._index)
return
@@ -101,13 +101,13 @@ class FileStore:
does not already exist - which will be restored to its
original location by restore_files().
"""
- logging.debug("Backing up system configuration file '%s'", path)
+ root_logger.debug("Backing up system configuration file '%s'", path)
if not os.path.isabs(path):
raise ValueError("Absolute path required")
if not os.path.isfile(path):
- logging.debug(" -> Not backing up - '%s' doesn't exist", path)
+ root_logger.debug(" -> Not backing up - '%s' doesn't exist", path)
return
(reldir, backupfile) = os.path.split(path)
@@ -120,7 +120,7 @@ class FileStore:
backup_path = os.path.join(self._path, filename)
if os.path.exists(backup_path):
- logging.debug(" -> Not backing up - already have a copy of '%s'", path)
+ root_logger.debug(" -> Not backing up - already have a copy of '%s'", path)
return
shutil.copy2(path, backup_path)
@@ -151,7 +151,7 @@ class FileStore:
was no backup file to restore
"""
- logging.debug("Restoring system configuration file '%s'", path)
+ root_logger.debug("Restoring system configuration file '%s'", path)
if not os.path.isabs(path):
raise ValueError("Absolute path required")
@@ -172,7 +172,7 @@ class FileStore:
backup_path = os.path.join(self._path, filename)
if not os.path.exists(backup_path):
- logging.debug(" -> Not restoring - '%s' doesn't exist", backup_path)
+ root_logger.debug(" -> Not restoring - '%s' doesn't exist", backup_path)
return False
shutil.move(backup_path, path)
@@ -203,7 +203,7 @@ class FileStore:
backup_path = os.path.join(self._path, filename)
if not os.path.exists(backup_path):
- logging.debug(" -> Not restoring - '%s' doesn't exist", backup_path)
+ root_logger.debug(" -> Not restoring - '%s' doesn't exist", backup_path)
continue
shutil.move(backup_path, path)
@@ -257,7 +257,7 @@ class StateFile:
"""Load the modules from the file @_path. @modules will
be an empty dictionary if the file doesn't exist.
"""
- logging.debug("Loading StateFile from '%s'", self._path)
+ root_logger.debug("Loading StateFile from '%s'", self._path)
self.modules = {}
@@ -277,14 +277,14 @@ class StateFile:
"""Save the modules to @_path. If @modules is an empty
dict, then @_path should be removed.
"""
- logging.debug("Saving StateFile to '%s'", self._path)
+ root_logger.debug("Saving StateFile to '%s'", self._path)
for module in self.modules.keys():
if len(self.modules[module]) == 0:
del self.modules[module]
if len(self.modules) == 0:
- logging.debug(" -> no modules, removing file")
+ root_logger.debug(" -> no modules, removing file")
if os.path.exists(self._path):
os.remove(self._path)
return