def configure_flume(sink): hookenv.status_set("maintenance", "Configuring Flume") flume = Flume() flume.configure_flume({"agents": sink.agents()}) if any_file_changed([flume.config_file]): flume.restart() hookenv.status_set("active", "Ready") set_state("flume-twitter.started")
def configure_flume(sink): hookenv.status_set('maintenance', 'Configuring Flume') flume = Flume() flume.configure_flume({'agents': sink.agents()}) if any_file_changed([flume.config_file]): flume.restart() hookenv.status_set('active', 'Ready') set_state('flume-twitter.started')
def configure_flume(sink, kafka): hookenv.status_set('maintenance', 'Configuring Flume') flume = Flume() flume.configure_flume({ 'agents': sink.agents(), 'zookeepers': kafka.zookeepers(), }) flume.configure_zookeeper() if any_file_changed([flume.config_file]): flume.restart() hookenv.status_set('active', 'Ready') set_state('flume-kafka.started')
def configure_flume(sink): flume = Flume() flume.configure_flume({'agents': sink.agents()}) if any_file_changed([flume.config_file]): # the port is currently hard-coded in the rsyslog-forwarder-ha charm # must run as root to listen on low-number UDP port hookenv.status_set('maintenance', 'Configuring Flume') hookenv.open_port(hookenv.config('source_port')) flume.restart(user='******') set_state('flume-syslog.started') syslog = RelationBase.from_state('syslog.joined') if syslog is None: hookenv.status_set('active', 'Ready') else: count = syslog.client_count() hookenv.status_set('active', 'Ready (Syslog sources: %s)' % count)
def configure_flume(sink): flume = Flume() flume.configure_flume({'agents': sink.agents()}) if any_file_changed([flume.config_file]): # the port is currently hard-coded in the rsyslog-forwarder-ha charm # must run as root to listen on low-number UDP port hookenv.status_set('maintenance', 'Configuring Flume') hookenv.open_port(hookenv.config('source_port')) flume.restart(user='******') set_state('flume-syslog.started') syslog = RelationBase.from_state('syslog.joined') if syslog is None: hookenv.status_set('active', 'Ready') else: hookenv.status_set('active', 'Ready (Syslog souces: {})' .format(syslog.client_count()))