def __init__(self, sub_parsers): super(DbCommand, self).__init__(sub_parsers) self.parser = DbParser(self.parser) self.parser.add_argument("-n", "--dry-run", action="store_true") # TODO: Kind of duplicates Upgrade args.sym/args.server self.parser.add_argument('--serverdir', help='Root directory of the server') self.parser.add_argument("dbcommand", choices=['init', 'upgrade', 'dump'], help='Initialise or upgrade a database') self.parser.add_argument('--dumpfile', help='Database dump file')
class DbCommand(Command): """ Administer an OMERO database """ NAME = "db" def __init__(self, sub_parsers): super(DbCommand, self).__init__(sub_parsers) self.parser = DbParser(self.parser) self.parser.add_argument("-n", "--dry-run", action="store_true") Add = EnvDefault.add # TODO: Kind of duplicates Upgrade args.sym/args.server Add(self.parser, 'serverdir', 'Root directory of the server') self.parser.add_argument( "dbcommand", choices=['init', 'upgrade'], help='Initialise or upgrade a database') def __call__(self, args): super(DbCommand, self).__call__(args) self.configure_logging(args) # Since EnvDefault.__action__ is only called if a user actively passes # a variable, there's no way to do the string replacing in the action # itself. Instead, we're post-processing them here, but this could be # improved. names = sorted(x.dest for x in self.parser._actions) for dest in names: if dest in ("help", "verbose", "quiet"): continue value = getattr(args, dest) if value and isinstance(value, (str, unicode)): replacement = value % dict(args._get_kwargs()) log.debug("% 20s => %s" % (dest, replacement)) setattr(args, dest, replacement) if args.serverdir: d = args.serverdir else: raise Stop(1, 'OMERO server directory required') ext = External(d) ext.setup_omero_cli() DbAdmin(d, args.dbcommand, args, ext)
def __init__(self, sub_parsers): super(DbCommand, self).__init__(sub_parsers) self.parser = DbParser(self.parser) self.parser.add_argument("-n", "--dry-run", action="store_true", help=( "Simulation/check mode. In 'upgrade' mode exits with code 2 if an " "upgrade is required, 3 if database isn't initialised, 0 if " "database is up-to-date.")) # TODO: Kind of duplicates Upgrade args.sym/args.server self.parser.add_argument( '--serverdir', help='Root directory of the server') self.parser.add_argument( "dbcommand", choices=['init', 'upgrade', 'dump'], help='Initialise or upgrade a database') self.parser.add_argument('--dumpfile', help='Database dump file')
class DbCommand(Command): """ Administer an OMERO database """ NAME = "db" def __init__(self, sub_parsers): super(DbCommand, self).__init__(sub_parsers) self.parser = DbParser(self.parser) self.parser.add_argument("-n", "--dry-run", action="store_true", help=( "Simulation/check mode. In 'upgrade' mode exits with code 2 if an " "upgrade is required, 3 if database isn't initialised, 0 if " "database is up-to-date.")) # TODO: Kind of duplicates Upgrade args.sym/args.server self.parser.add_argument( '--serverdir', help='Root directory of the server') self.parser.add_argument( "dbcommand", choices=['init', 'upgrade', 'dump'], help='Initialise or upgrade a database') self.parser.add_argument('--dumpfile', help='Database dump file') def __call__(self, args): super(DbCommand, self).__call__(args) self.configure_logging(args) # Since EnvDefault.__action__ is only called if a user actively passes # a variable, there's no way to do the string replacing in the action # itself. Instead, we're post-processing them here, but this could be # improved. names = sorted(x.dest for x in self.parser._actions) for dest in names: if dest in ("help", "verbose", "quiet"): continue value = getattr(args, dest) if value and isinstance(value, basestring): replacement = value % dict(args._get_kwargs()) log.debug("% 20s => %s" % (dest, replacement)) setattr(args, dest, replacement) if args.serverdir: d = args.serverdir else: raise Stop(1, 'OMERO server directory required') ext = External(d) ext.setup_omero_cli() DbAdmin(d, args.dbcommand, args, ext)
def __init__(self, sub_parsers): super(DbCommand, self).__init__(sub_parsers) self.parser = DbParser(self.parser) self.parser.add_argument("-n", "--dry-run", action="store_true") Add = EnvDefault.add # TODO: Kind of duplicates Upgrade args.sym/args.server Add(self.parser, 'serverdir', 'Root directory of the server') self.parser.add_argument( "dbcommand", choices=['init', 'upgrade'], help='Initialise or upgrade a database')
def __init__(self, sub_parsers): super(InstallBaseCommand, self).__init__(sub_parsers) self.parser.add_argument("-n", "--dry-run", action="store_true") self.parser.add_argument("server", nargs="?", help="The server directory, or a server-zip, " "or the url of a server-zip") self.parser.add_argument( "--prestartfile", action="append", help="Run these OMERO commands before starting server, " "can be repeated") self.parser.add_argument( "--ignoreconfig", action="store_true", help="Don't copy the old configuration file when upgrading") self.parser = JenkinsParser(self.parser) self.parser = DbParser(self.parser) self.parser = FileUtilsParser(self.parser) Add = EnvDefault.add Add(self.parser, "sym", "OMERO-CURRENT") self.parser.add_argument("--no-start", action="store_true", help="Don't start any omero components") self.parser.add_argument("--no-web", action="store_true", help="Ignore OMERO.web, don't start or stop") self.parser.add_argument("--delete-old", action="store_true", help="Delete the old server directory") self.parser.add_argument("--keep-old-zip", action="store_true", help="Don't delete the old server zip") # Record the values of these environment variables in a file envvars = "ICE_HOME PATH DYLD_LIBRARY_PATH LD_LIBRARY_PATH PYTHONPATH" envvarsfile = os.path.join("%(sym)s", "omero.envvars") Add(self.parser, "savevars", envvars) Add(self.parser, "savevarsfile", envvarsfile)