Esempio n. 1
0
    def main_loop (self):

        self.header = HeaderWidget()
        self.items = []
        walker = urwid.SimpleListWalker(self.items)
        self.listbox = urwid.ListBox(walker)
        urwid.connect_signal(walker, 'modified', self.lazzy_load)
        foot = help_bar()
        self.main_frame = urwid.Frame(urwid.AttrWrap(self.listbox, 'body'), header=self.header, footer=foot)
        key_handle = Keys()
        urwid.connect_signal(key_handle, 'help_done', self.help_done)
        self.loop = urwid.MainLoop(self.main_frame, palette, unhandled_input=key_handle.keystroke)
        update = UpdateThread()
        update.start()
        self.loop.run()
        update.stop()
Esempio n. 2
0
def check_for_updates(frame, force=False):
    if (frame.upd_thread is not None):
        frame.upd_thread.exit_now = True
        frame.upd_thread.join()

    frame.upd_thread = UpdateThread(frame, force)
    frame.upd_thread.start()
Esempio n. 3
0
    def __init__(self, model_dir, broker_uris, database_dsn):
        self.model = MintModel(self, model_dir)
        self.model.sql_logging_enabled = False

        self.session = MintSession(self, broker_uris)
        self.database = MintDatabase(self, database_dsn)
        self.admin = CuminAdmin(self)
        self.update_thread = UpdateThread(self)

        self.expire_enabled = True
        self.expire_thread = ExpireThread(self)

        self.vacuum_enabled = True
        self.vacuum_thread = VacuumThread(self)

        self.print_event_level = 0

        # Space separated list of sasl authentication
        # mechanisms, according to the sasl documentation
        self.sasl_mech_list = None

        # List of agents to bind.  Referenced by session.
        self.qmf_agents = set()

        # List of classes to bind. Referenced by session and update thread.
        self.qmf_classes = set()

        # If binding was not done by class, this is the final list of
        # packages that were bound
        self.qmf_packages = set()

        # Things we know should not be bound.
        self.qmf_package_filter = ["com.redhat.cumin", "com.redhat.cumin.grid"]
Esempio n. 4
0
    def __init__(self, model_dir, server_host, server_port, database_dsn):

        # Can we just use a different model dir here?
        # That would control visible packages, vacuuming, etc.
        self.model = MintModel(self, model_dir)
        self.model.sql_logging_enabled = False

        self.database = MintDatabase(self, database_dsn)
        self.admin = CuminAdmin(self)
        self.update_thread = UpdateThread(self)
        self.session = PlumageSession(self, server_host, server_port)

        self.expire_enabled = True
        self.expire_thread = ExpireThread(self)

        self.vacuum_enabled = True
        self.vacuum_thread = VacuumThread(self)
        
        self.plumage_host = "localhost"
        self.plumage_port = 27017

        self.print_event_level = 0

        self.packages = set()

        self.classes = set()

        self.package_filter = ["com.redhat.cumin"]
Esempio n. 5
0
    def main_loop (self):

        self.header = HeaderWidget()
        foot = help_bar()
        self.listbox = self.select_current_timeline().timeline
        self.main_frame = urwid.Frame(urwid.AttrWrap(self.listbox, 'body'), header=self.header, footer=foot)
        key_handle = Keys()
        urwid.connect_signal(key_handle, 'help_done', self.help_done)
        self.loop = urwid.MainLoop(self.main_frame, palette, unhandled_input=key_handle.keystroke)
        update = UpdateThread()
        update.start()
        self.loop.run()
        update._Thread__stop()
        update.stop()
Esempio n. 6
0
    def main_loop (self):

        self.header = HeaderWidget()
        foot = help_bar()
        self.listbox = self.select_current_timeline().timeline
        self.main_frame = urwid.Frame(urwid.AttrWrap(self.listbox, 'body'), header=self.header, footer=foot)
        key_handle = Keys()
        urwid.connect_signal(key_handle, 'help_done', self.help_done)
        self.loop = urwid.MainLoop(self.main_frame, palette, unhandled_input=key_handle.keystroke)
        update = UpdateThread()
        update.start()
        self.loop.run()
        update._Thread__stop()
        update.stop()
Esempio n. 7
0
def init_thread():
    update = UpdateThread()
    update.start()
    init_keys()
    update.stop()
    container['interface'].tear_down()
Esempio n. 8
0
class Mint(object):
    def __init__(self, model_dir, broker_uris, database_dsn):
        self.model = MintModel(self, model_dir)
        self.model.sql_logging_enabled = False

        self.session = MintSession(self, broker_uris)
        self.database = MintDatabase(self, database_dsn)
        self.admin = CuminAdmin(self)
        self.update_thread = UpdateThread(self)

        self.expire_enabled = True
        self.expire_thread = ExpireThread(self)

        self.vacuum_enabled = True
        self.vacuum_thread = VacuumThread(self)

        self.print_event_level = 0

        # Space separated list of sasl authentication
        # mechanisms, according to the sasl documentation
        self.sasl_mech_list = None

        # List of agents to bind.  Referenced by session.
        self.qmf_agents = set()

        # List of classes to bind. Referenced by session and update thread.
        self.qmf_classes = set()

        # If binding was not done by class, this is the final list of
        # packages that were bound
        self.qmf_packages = set()

        # Things we know should not be bound.
        self.qmf_package_filter = ["com.redhat.cumin", "com.redhat.cumin.grid"]

    def check(self):
        log.info("Checking %s", self)

        self.model.check()
        self.session.check()
        self.database.check()

    def init(self):
        log.info("Initializing %s", self)

        def state(cond):
            return cond and "enabled" or "disabled"

        log.info("Expiration is %s", state(self.expire_enabled))
        log.info("Vacuum is %s", state(self.vacuum_enabled))

        self.model.init()
        self.session.init()
        self.database.init()

        self.update_thread.init()
        self.expire_thread.init()
        self.vacuum_thread.init()

    def start(self):
        log.info("Starting %s", self)

        # Scan the qmf class/package binding list
        # and do any necessary preprocessing
        self.session.init_qmf_classes()
        
        self.update_thread.start()

        self.session.start()

        if self.expire_enabled:
            self.expire_thread.start()

        if self.vacuum_enabled:
            self.vacuum_thread.start()

    def stop(self, skip_vacuum=False):
        log.info("Stopping %s", self)

        self.update_thread.stop()

        if self.expire_enabled:
            self.expire_thread.stop()
        
        if self.vacuum_enabled and not skip_vacuum:
            self.vacuum_thread.stop()

        self.session.stop()
        log.info("Session stopped")

    def __repr__(self):
        return self.__class__.__name__
Esempio n. 9
0
class Plumage(object):
    def __init__(self, model_dir, server_host, server_port, database_dsn):

        # Can we just use a different model dir here?
        # That would control visible packages, vacuuming, etc.
        self.model = MintModel(self, model_dir)
        self.model.sql_logging_enabled = False

        self.database = MintDatabase(self, database_dsn)
        self.admin = CuminAdmin(self)
        self.update_thread = UpdateThread(self)
        self.session = PlumageSession(self, server_host, server_port)

        self.expire_enabled = True
        self.expire_thread = ExpireThread(self)

        self.vacuum_enabled = True
        self.vacuum_thread = VacuumThread(self)
        
        self.plumage_host = "localhost"
        self.plumage_port = 27017

        self.print_event_level = 0

        self.packages = set()

        self.classes = set()

        self.package_filter = ["com.redhat.cumin"]

    def check(self):
        log.info("Checking %s", self)

        self.model.check()
        self.database.check()
        self.model.init()

    def init(self):
        log.info("Initializing %s", self)

        def state(cond):
            return cond and "enabled" or "disabled"

        log.info("Expiration is %s", state(self.expire_enabled))
        log.info("Vacuum is %s", state(self.vacuum_enabled))

        self.database.init()

        self.update_thread.init()
        self.session.init()        
        # The package and class lists will be
        # processed here
        self.session.init_classes()

        if self.expire_enabled:
            self.expire_thread.init()

        if self.vacuum_enabled:
            self.vacuum_thread.init()

    def start(self):
        log.info("Starting %s", self)

        self.update_thread.start()

        self.session.start()

        if self.expire_enabled:
            # If we set these values here, we can have each cumin-report
            # instance run expiration for its own classes...
            # Default is like cumin-data, where a single instance runs
            # expiration across all classes in the model
            #self.expire_thread.packages = self.packages
            #self.expire_thread.classes = self.classes
            self.expire_thread.start()

        if self.vacuum_enabled:
            self.vacuum_thread.start()

    def stop(self):
        log.info("Stopping %s", self)

        self.update_thread.stop()
        self.session.stop()

        if self.expire_enabled:
            self.expire_thread.stop()

        if self.vacuum_enabled:
            self.vacuum_thread.stop()

    def __repr__(self):
        return self.__class__.__name__