i.kojid.cert = builder_user.pem else: log.info("Builder credentials already exist") def shutdown(*args): log.info("Stopping") log.info("Attempting to disable host {0}".format(builder_name)) if remote.is_up(kojihub_name, 80): subprocess.call(["koji", "-d", "disable-host", builder_name]) cleanup.register_excepthook(shutdown) cleanup.register_sig_handler(shutdown) remote.wait_if_not_up(kojihub_name, 80) log.info("Configuring host data on kojihub") # subprocess.check_output doesn't exist in RHEL 6's Python (v2.6) cmd = ["koji", "-d", "add-host", builder_name, "i386", "x86_64"] process = subprocess.Popen(cmd, stdout=subprocess.PIPE) output, unused_err = process.communicate() retcode = process.poll() if retcode == 0: log.info("Added new host {0}".format(builder_name)) host_is_new = True elif retcode == 1 and "is already in the database" in output: log.info("Host {0} already is configured".format(builder_name)) host_is_new = False else: raise subprocess.CalledProcessError(retcode, cmd)
#!/usr/bin/env python2 import util.cleanup as cleanup import util.tail as tail import util.system as system import util.remote as remote from util.log import log import sys kojidatabase_name = "kojidatabase" remote.require_container(kojidatabase_name) remote.wait_if_not_up(kojidatabase_name, 5432) services = ["httpd"] if not "nokojira" in sys.argv: services.append("kojira") def shutdown(*args): for service in reversed(services): log.info("Stopping {0}".format(service)) system.service(service, "stop") cleanup.register_excepthook(shutdown) cleanup.register_sig_handler(shutdown) for service in services: log.info("Starting {0}".format(service)) system.service(service, "start") log.info("Monitoring httpd log")
#!/usr/bin/env python2 import util.cleanup as cleanup import util.tail as tail import util.system as system import util.remote as remote from util.log import log import sys kojidatabase_name = "kojidatabase" remote.require_container(kojidatabase_name) remote.wait_if_not_up(kojidatabase_name, 5432) services = ["httpd"] if not "nokojira" in sys.argv: services.append("kojira") def shutdown(*args): for service in reversed(services): log.info("Stopping {0}".format(service)) system.service(service, "stop") cleanup.register_excepthook(shutdown) cleanup.register_sig_handler(shutdown) for service in services: log.info("Starting {0}".format(service)) system.service(service, "start")
log.info("Creating builder credentials") openssl.make_user_certificate(builder_user, koji_ca) log.info("Configure Koji Builder") with cfg.mod_ini("/etc/kojid/kojid.conf") as i: i.kojid.cert = builder_user.pem else: log.info("Builder credentials already exist") def shutdown(*args): log.info("Stopping") cleanup.register_excepthook(shutdown) cleanup.register_sig_handler(shutdown) remote.wait_if_not_up(kojihub_name, 80) log.info("Configuring host data on kojihub") # subprocess.check_output doesn't exist in RHEL 6's Python (v2.6) cmd = ["koji", "-d", "add-host", builder_name, "i386", "x86_64"] process = subprocess.Popen(cmd, stdout=subprocess.PIPE) output, unused_err = process.communicate() retcode = process.poll() if retcode == 0: log.info("Added new host {0}".format(builder_name)) host_is_new = True elif retcode == 1 and "is already in the database" in output: log.info("Host {0} already is configured".format(builder_name)) host_is_new = False else: raise subprocess.CalledProcessError(retcode, cmd)