Beispiel #1
0
    def setUp(self):
        fd, self.db_filename = tempfile.mkstemp(prefix='bodhi-testing-',
                                                suffix='.db')
        db_path = 'sqlite:///%s' % self.db_filename
        # The BUILD_ID environment variable is set by Jenkins and allows us to
        # detect if
        # we are running the tests in jenkins or not
        # https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-below
        if os.environ.get('BUILD_ID'):
            faitout = 'http://209.132.184.152/faitout/'
            try:
                import requests
                req = requests.get('%s/new' % faitout)
                if req.status_code == 200:
                    db_path = req.text
                    print 'Using faitout at: %s' % db_path
            except:
                pass
        engine = create_engine(db_path)
        Base.metadata.create_all(engine)
        self.db_factory = transactional_session_maker(engine)

        with self.db_factory() as session:
            populate(session)
            assert session.query(Update).count() == 1

        self.koji = buildsys.get_session()
        self.koji.clear()  # clear out our dev introspection

        self.msg = makemsg()
        self.tempdir = tempfile.mkdtemp('bodhi')
        self.masher = Masher(FakeHub(),
                             db_factory=self.db_factory,
                             mash_dir=self.tempdir)
Beispiel #2
0
    def __init__(self,
                 hub,
                 db_factory=None,
                 mash_dir=config.get('mash_dir'),
                 *args,
                 **kw):
        if not db_factory:
            config_uri = '/etc/bodhi/production.ini'
            settings = get_appsettings(config_uri)
            engine = engine_from_config(settings, 'sqlalchemy.')
            Base.metadata.create_all(engine)
            self.db_factory = transactional_session_maker(engine)
        else:
            self.db_factory = db_factory

        buildsys.setup_buildsystem(config)
        self.mash_dir = mash_dir
        prefix = hub.config.get('topic_prefix')
        env = hub.config.get('environment')
        self.topic = prefix + '.' + env + '.' + hub.config.get('masher_topic')
        self.valid_signer = hub.config.get('releng_fedmsg_certname')
        if not self.valid_signer:
            log.warn('No releng_fedmsg_certname defined'
                     'Cert validation disabled')
        super(Masher, self).__init__(hub, *args, **kw)
        log.info('Bodhi masher listening on topic: %s' % self.topic)
Beispiel #3
0
    def setUp(self):
        fd, self.db_filename = tempfile.mkstemp(prefix="bodhi-testing-", suffix=".db")
        db_path = "sqlite:///%s" % self.db_filename
        # The BUILD_ID environment variable is set by Jenkins and allows us to
        # detect if
        # we are running the tests in jenkins or not
        # https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-below
        if os.environ.get("BUILD_ID"):
            faitout = "http://209.132.184.152/faitout/"
            try:
                import requests

                req = requests.get("%s/new" % faitout)
                if req.status_code == 200:
                    db_path = req.text
                    print "Using faitout at: %s" % db_path
            except:
                pass
        engine = create_engine(db_path)
        Base.metadata.create_all(engine)
        self.db_factory = transactional_session_maker(engine)

        with self.db_factory() as session:
            populate(session)
            assert session.query(Update).count() == 1

        self.koji = buildsys.get_session()
        self.koji.clear()  # clear out our dev introspection

        self.msg = makemsg()
        self.tempdir = tempfile.mkdtemp("bodhi")
        self.masher = Masher(FakeHub(), db_factory=self.db_factory, mash_dir=self.tempdir)
Beispiel #4
0
    def __init__(self, hub, db_factory=None, mash_dir=config.get("mash_dir"), *args, **kw):
        if not db_factory:
            config_uri = "/etc/bodhi/production.ini"
            settings = get_appsettings(config_uri)
            engine = engine_from_config(settings, "sqlalchemy.")
            Base.metadata.create_all(engine)
            self.db_factory = transactional_session_maker(engine)
        else:
            self.db_factory = db_factory

        buildsys.setup_buildsystem(config)
        self.mash_dir = mash_dir
        prefix = hub.config.get("topic_prefix")
        env = hub.config.get("environment")
        self.topic = prefix + "." + env + "." + hub.config.get("masher_topic")
        self.valid_signer = hub.config.get("releng_fedmsg_certname")
        if not self.valid_signer:
            log.warn("No releng_fedmsg_certname defined" "Cert validation disabled")
        super(Masher, self).__init__(hub, *args, **kw)
        log.info("Bodhi masher listening on topic: %s" % self.topic)
Beispiel #5
0
    def __init__(self, hub, db_factory=None, mash_dir=config.get('mash_dir'),
                 *args, **kw):
        if not db_factory:
            config_uri = '/etc/bodhi/production.ini'
            settings = get_appsettings(config_uri)
            engine = engine_from_config(settings, 'sqlalchemy.')
            Base.metadata.create_all(engine)
            self.db_factory = transactional_session_maker(engine)
        else:
            self.db_factory = db_factory

        buildsys.setup_buildsystem(config)
        self.mash_dir = mash_dir
        prefix = hub.config.get('topic_prefix')
        env = hub.config.get('environment')
        self.topic = prefix + '.' + env + '.' + hub.config.get('masher_topic')
        self.valid_signer = hub.config.get('releng_fedmsg_certname')
        if not self.valid_signer:
            log.warn('No releng_fedmsg_certname defined'
                     'Cert validation disabled')
        super(Masher, self).__init__(hub, *args, **kw)
        log.info('Bodhi masher listening on topic: %s' % self.topic)
Beispiel #6
0
    def __init__(self, hub, db_factory=None, *args, **kwargs):
        if not db_factory:
            config_uri = '/etc/bodhi/production.ini'
            self.settings = get_appsettings(config_uri)
            engine = engine_from_config(self.settings, 'sqlalchemy.')
            Base.metadata.create_all(engine)
            self.db_factory = transactional_session_maker(engine)
        else:
            self.db_factory = db_factory

        prefix = hub.config.get('topic_prefix')
        env = hub.config.get('environment')
        self.topic = [
            prefix + '.' + env + '.bodhi.update.request.testing',
            prefix + '.' + env + '.bodhi.update.edit',
        ]

        self.handle_bugs = bool(self.settings.get('bodhi_email'))
        if not self.handle_bugs:
            log.warn("No bodhi_email defined; not fetching bug details")

        super(UpdatesHandler, self).__init__(hub, *args, **kwargs)
        log.info('Bodhi updates handler listening on:\n'
                 '%s' % pprint.pformat(self.topic))