def report_status()

in bigtop-packages/src/charm/hive/layer-hive/reactive/hive.py [0:0]


def report_status():
    hadoop_joined = is_state('hadoop.joined')
    hadoop_ready = is_state('hadoop.ready')
    hbase_joined = is_state('hbase.joined')
    hbase_ready = is_state('hbase.ready')
    database_joined = is_state('database.connected')
    database_ready = is_state('database.available')
    hive_installed = is_state('hive.installed')

    if not hadoop_joined:
        hookenv.status_set('blocked',
                           'waiting for relation to hadoop plugin')
    elif not hadoop_ready:
        hookenv.status_set('waiting',
                           'waiting for hadoop to become ready')
    elif database_joined and not database_ready:
        hookenv.status_set('waiting',
                           'waiting for database to become ready')
    elif hbase_joined and not hbase_ready:
        hookenv.status_set('waiting',
                           'waiting for hbase to become ready')
    elif hive_installed and not database_ready:
        hookenv.status_set('active',
                           'ready (local metastore)')
    elif hive_installed and database_ready:
        hookenv.status_set('active',
                           'ready (remote metastore)')