Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@app.cli.command()
def run_worker():
"""Run worker doing all sorts of background work"""
from asu.utils.garbagecollector import GarbageCollector
from asu.utils.boss import Boss
from asu.utils.updater import Updater
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
log.info("start garbage collector")
gaco = GarbageCollector()
gaco.start()
log.info("start boss")
boss = Boss()
boss.start()
@app.cli.command()
def build_worker():
"""Build image with worker package preinstalled"""
log.info("build worker image")
packages = [
"bash",
"bzip2",
"coreutils",
"coreutils-stat",
"diffutils",
"file",
"gawk",
"gcc",
"getopt",
"git",
"libncurses",
"make",
@app.cli.command()
def build_all():
"""Build all profiles of openwrt latest stable"""
for profile in database.get_all_profiles(
"openwrt", config.get("openwrt").get("latest")
):
target, profile = profile
params = {
"distro": "openwrt",
"version": config.get("openwrt").get("latest"),
"target": target,
"profile": profile,
}
params["request_hash"] = get_request_hash(params)
database.insert_dict("requests", params)
@app.cli.command()
def loaddb():
"""Fill database with content"""
fetch_targets()
load_tables()
insert_board_rename()
@app.cli.command()
def initdb():
"""Initiate database with tables.sql"""
database.init_db()