to users)
- Figure out a way of collecting blacklist data from .scripts/blacklisted
and aggregate it together
- - Failed migrations should be wired to have wizard commands in them
- automatically log to the relevant file. In addition, the seen file
- should get updated when one of them gets fixed.
- Let users use Wizard when ssh'ed into Scripts
- Make single user mass-migrate work when not logged in as root
echo "this is a bad file" > "$TESTDIR/$FROB"
# attempt an upgrade, this will fail
-RESULT=`! wizard upgrade "$TESTDIR"`
+RESULT=`! wizard upgrade "$TESTDIR" --log-file=/tmp/testboo`
TMPTESTDIR=`echo "$RESULT" | awk '{print $2}'`
# resolve the upgrade
stderr.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
if not options.quiet: logger.addHandler(stderr)
else: logger.addHandler(NullLogHandler()) # prevent default
- if options.log_file:
- file = logging.FileHandler(options.log_file)
- logformatter = logging.Formatter("%(asctime)s %(levelname)s: %(message)s", "%Y-%m-%d %H:%M")
- file.setFormatter(logformatter)
- logger.addHandler(file)
+ if options.log_file: addFileLogger(options.log_file, options.debug)
if options.debug:
logger.setLevel(logging.DEBUG)
else:
stderr.setLevel(logging.WARNING)
if options.verbose:
stderr.setLevel(logging.INFO)
- if options.log_file:
- file.setLevel(logging.INFO)
def our_excepthook(type, value, tb):
logging.error("".join(traceback.format_exception(type,value,tb)))
sys.exit(1)
logging_setup = True
return logger
+def addFileLogger(log_file, debug):
+ logger = logging.getLogger()
+ file = logging.FileHandler(log_file)
+ logformatter = logging.Formatter("%(asctime)s %(levelname)s: %(message)s", "%Y-%m-%d %H:%M")
+ file.setFormatter(logformatter)
+ logger.addHandler(file)
+ if not debug:
+ file.setLevel(logging.INFO)
+ return file
+
def makeBaseArgs(options, **grab):
"""Takes parsed options, and breaks them back into a command
line string that we can pass into a subcommand"""
user_commit, next_commit = open(".git/WIZARD_PARENTS", "r").read().split()
repo = open(".git/WIZARD_REPO", "r").read()
version = open(".git/WIZARD_UPGRADE_VERSION", "r").read()
+ if not options.log_file and os.path.exists(".git/WIZARD_LOG_FILE"):
+ options.log_file = open(".git/WIZARD_LOG_FILE", "r").read()
+ # reload logging
+ command.addFileLogger(options.log_file, options.debug)
+ logging.info("Continuing upgrade...")
util.chdir(sh.eval("git", "config", "remote.origin.url"))
d = deploy.Deployment(".")
try:
open(".git/WIZARD_REPO", "w").write(repo)
open(".git/WIZARD_UPGRADE_VERSION", "w").write(version)
open(".git/WIZARD_PARENTS", "w").write("%s\n%s" % (user_commit, next_commit))
+ if options.log_file: open(".git/WIZARD_LOG_FILE", "w").write(options.log_file)
perform_merge(sh, repo, d, version, use_shm)
# variables: version, user_commit, next_commit, temp_wc_dir
with util.ChangeDirectory(temp_wc_dir):