- Checks should also be performed against the partition
X with the new --shared flag this may not be necessary
as repos weighs less than 200K
+- Should write to a "processed" file to make resuming with
+ unexpected failure faster.
- Check how many autoinstalls are missing w bits for
daemon.scripts
- Whiteboard the flow for performing an upgrade on a single
command = args[0] # shouldn't fail
if command == "help":
try:
- getattr(wizard.command, rest_argv[0])(['-h'], options)
+ getattr(wizard.command, rest_argv[0]).main(['-h'], options)
except AttributeError:
parser.error("invalid action")
except IndexError:
raise SystemExit(-1)
# Dispatch commands
try:
- command_fn = getattr(wizard.command, command)
+ command_module = getattr(wizard.command, command)
except AttributeError:
parser.error("invalid action")
- command_fn(rest_argv, options)
+ command_module.main(rest_argv, options)
if __name__ == "__main__":
main()
-from info import info
-from migrate import migrate
-from summary import summary
-from massmigrate import massmigrate
-
+import migrate
+import massmigrate
+import info
+import summary
# There should be a built-in
return "\n".join([" " * indent + x for x in text.split("\n")])
-def info(argv, global_options):
+def main(argv, global_options):
usage = """usage: %prog info [ARGS] DIR
Prints information about an autoinstalled directory,
import optparse
+import wizard
from wizard import deploy
from wizard.command import _base
from wizard.command import migrate
-def massmigrate(argv, global_options, logger = None):
+def main(argv, global_options, logger = None):
usage = """usage: %prog massmigrate [ARGS] APPLICATION
Mass migrates an application to the new repository format.
sub_argv = base_args + [d.location]
logger.info("$ wizard migrate " + " ".join(sub_argv))
try:
- migrate.migrate(sub_argv, global_options, logger)
+ migrate.main(sub_argv, global_options, logger)
except migrate.AlreadyMigratedError as e:
logger.info("Skipped already migrated %s" % d.location)
- except migrate.Error as e:
- name = e.__class__.__name__
+ except wizard.Error as e:
+ name = e.__module__ + "." + e.__class__.__name__
if name not in errors: errors[name] = []
- errors[name].append(d)
+ errors[name].append((d, e))
logger.error("ERROR [%s] in %s" % (name, d.location))
+ logger.info("Backtrace:\n" + str(e))
for name, deploys in errors.items():
logger.warning("ERROR [%s] from %d installs" % (name, len(deploys)))
the repository was prepared with all necessary tags!
""" % (self.version.version, self.version.application.name)
-def migrate(argv, global_options, logger = None):
+def main(argv, global_options, logger = None):
usage = """usage: %prog migrate [ARGS] DIR
Migrates a directory to our Git-based autoinstall format.
self._hang()
print str
-def summary(argv, global_options):
+def main(argv, global_options):
usage = """usage: %prog summary [ARGS] APPS
Scans all of the collected data from parallel-find.pl, and
import dateutil.parser
import distutils.version
-def getInstallLines(global_options):
- """Retrieves a list of lines from the version directory that
- can be passed to Deployment.parse()"""
- vd = global_options.version_dir
- try:
- return fileinput.input([vd + "/" + f for f in os.listdir(vd)])
- except OSError:
- print "No permissions; check if AFS is mounted"
- raise SystemExit(-1)
+import wizard
-class NoSuchApplication(Exception):
+class Error(wizard.Error):
+ """Base error class for deploy errors"""
pass
-class DeploymentParseError(Exception):
+class NoSuchApplication(Error):
pass
+class DeploymentParseError(Error):
+ pass
+
+class ScriptsVersionTooManyFieldsError(Error):
+ def __str__(self):
+ return """
+
+ERROR: Could not parse .scripts-version file. It
+contained too many fields.
+"""
+
+def getInstallLines(global_options):
+ """Retrieves a list of lines from the version directory that
+ can be passed to Deployment.parse()"""
+ vd = global_options.version_dir
+ return fileinput.input([vd + "/" + f for f in os.listdir(vd)])
+
class Deployment(object):
"""Represents a deployment of an autoinstall; i.e. a concrete
directory in web_scripts that has .scripts-version in it."""
rev.version = ApplicationVersion.parse(line)
else:
# ruh oh
- raise NotImplementedError
+ raise ScriptsVersionTooManyFieldsError()
i += 1
if i: revs.append(rev)
return DeployLog(revs)