Exemplo n.º 1
0
def install_kafka(*args):

    kafka = Kafka(DistConfig())
    if kafka.verify_resources():
        hookenv.status_set('maintenance', 'Installing Kafka')
        kafka.install()
        kafka.open_ports()
        set_state('kafka.installed')
Exemplo n.º 2
0
def configure_kafka(zk):
    hookenv.status_set('maintenance', 'setting up kafka')
    data_changed(  # Prime data changed for network interface
        'kafka.network_interface', hookenv.config().get('network_interface'))
    log_dir = unitdata.kv().get('kafka.storage.log_dir')
    data_changed('kafka.storage.log_dir', log_dir)
    kafka = Kafka()
    zks = zk.zookeepers()
    kafka.configure_kafka(zks, log_dir=log_dir)
    kafka.open_ports()
    set_state('kafka.started')
    hookenv.status_set('active', 'ready')
    # set app version string for juju status output
    kafka_version = get_package_version(KAFKA_SNAP) or 'unknown'
    hookenv.application_version_set(kafka_version)
Exemplo n.º 3
0
def configure_kafka(zk):
    hookenv.status_set('maintenance', 'setting up kafka')
    log_dir = unitdata.kv().get('kafka.storage.log_dir')
    data_changed('kafka.storage.log_dir', log_dir)
    kafka = Kafka()
    zks = zk.zookeepers()
    if log_dir:
        kafka.install(zk_units=zks, log_dir=log_dir)
    else:
        hookenv.status_set('blocked', 'unable to get storage dir')
    kafka.open_ports()
    set_state('kafka.started')
    hookenv.status_set('active', 'ready')
    # set app version string for juju status output
    kafka_version = kafka.version()
    hookenv.application_version_set(kafka_version)