def take_action(self, args): configp = self.fetch_config(args) options = merged_options(args, configp) # Parse if we have to check if running from root # XXX document this feature. if string_to_boolean(options.get('root_check', 'True').lower()): check_root_user(self) check_missing_parameters(options) check_missing_files(options) random_delay(options, logger=self.app.log) slapgrid_object = create_slapgrid_object(options, logger=self.app.log) pidfile = options.get('pidfile') or self.default_pidfile if pidfile: setRunning(logger=self.app.log, pidfile=pidfile) try: return getattr(slapgrid_object, self.method_name)() finally: if pidfile: setFinished(pidfile)
def take_action(self, args): configp = self.fetch_config(args) options = merged_options(args, configp) check_missing_parameters(options) check_missing_files(options) random_delay(options, logger=self.app.log) slapgrid_object = create_slapgrid_object(options, logger=self.app.log) pidfile = options.get('pidfile') or self.default_pidfile if pidfile: setRunning(logger=self.app.log, pidfile=pidfile) try: return getattr(slapgrid_object, self.method_name)() finally: if pidfile: setFinished(pidfile)
def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): """Returns a new instance of slapgrid.Slapgrid created with argument+config parameters. Also returns the pidfile path, and configures logger. """ args = parse_arguments(*argument_tuple) configp = ConfigParser.SafeConfigParser() configp.readfp(args.configuration_file) options = merged_options(args, configp) logger = setup_logger(options) check_missing_parameters(options) check_missing_files(options) random_delay(options, logger=logger) slapgrid_object = create_slapgrid_object(options, logger=logger) return slapgrid_object, options.get('pidfile')