def activate(): """ Run some tests to ensure the module is ready to operate. """ config = MscConfig() config.init("msc") logger = logging.getLogger() if config.disable: logger.warning("Plugin msc: disabled by configuration.") return False if not os.path.isdir(config.qactionspath): logger.error("Quick Actions config is invalid: %s is not a directory. Please check msc.ini." % config.qactionspath) return False if not MscDatabase().activate(config): return False if config.check_db_enable: scheduleCheckStatus(config.check_db_interval) # Add convergence reschedule task in the task manager TaskManager().addTask("msc.convergence_reschedule", (convergence_reschedule,), cron_expression=config.convergence_reschedule) return True
def activate(): """ Run some tests to ensure the module is ready to operate. """ config = MscConfig() config.init("msc") logger = logging.getLogger() if config.disable: logger.warning("Plugin msc: disabled by configuration.") return False if not os.path.isdir(config.qactionspath): logger.error( "Quick Actions config is invalid: %s is not a directory. Please check msc.ini." % config.qactionspath) return False if not MscDatabase().activate(config): return False if config.check_db_enable: scheduleCheckStatus(config.check_db_interval) # Add convergence reschedule task in the task manager TaskManager().addTask("msc.convergence_reschedule", (convergence_reschedule, ), cron_expression=config.convergence_reschedule) return True
def activate_2(): conf = MscConfig() conf.init('msc') dldir = conf.download_directory_path # Clean all lock or error status file in the download directory pool if os.path.exists(dldir): logging.getLogger().info('Cleaning lock file in %s' % dldir) for root, dirs, files in os.walk(dldir): for name in files: if name.endswith(MscDownloadedFiles.LOCKEXT) or name.endswith(MscDownloadedFiles.ERROREXT): os.remove(os.path.join(root, name)) return True
def activate(): """ Run some tests to ensure the module is ready to operate. """ config = MscConfig() config.init("msc") logger = logging.getLogger() if config.disable: logger.warning("Plugin msc: disabled by configuration.") return False if not os.path.isdir(config.qactionspath): logger.error("Quick Actions config is invalid: %s is not a directory. Please check msc.ini." % config.qactionspath) return False if not MscDatabase().activate(config): return False return True