|
|
@@ -1,7 +1,9 @@ |
|
|
+#!/usr/bin/env python3
|
|
|
from charms.reactive import when
|
|
|
from charms.reactive import when_not
|
|
|
from charms.reactive import when_any
|
|
|
from charms.reactive import is_state
|
|
|
+from charms.reactive import RelationBase
|
|
|
from charmhelpers.core import hookenv
|
|
|
from jujubigdata import utils
|
|
|
from charms.layer.apache_hadoop_namenode import get_cluster_nodes
|
|
|
@@ -48,18 +50,25 @@ def report_status(datanode): |
|
|
else:
|
|
|
role = 'extra'
|
|
|
if not degraded:
|
|
|
- extra = '{}, with {} fail-over'.format(role, failover)
|
|
|
+ extra = 'HA {}, with {} fail-over'.format(role, failover)
|
|
|
else:
|
|
|
missing = ' and '.join(filter(None, [
|
|
|
'NameNode' if not clustered else None,
|
|
|
'JournalNodes' if not quorum else None,
|
|
|
'active' if not active else None,
|
|
|
'standby' if not standby else None,
|
|
|
]))
|
|
|
- extra = 'degraded {} (missing: {}), with {} fail-over'.format(
|
|
|
+ extra = 'HA degraded {} (missing: {}), with {} fail-over'.format(
|
|
|
role, missing, failover)
|
|
|
hookenv.status_set('active', 'Ready ({count} DataNode{s}, {extra})'.format(
|
|
|
count=num_slaves,
|
|
|
s='s' if num_slaves > 1 else '',
|
|
|
extra=extra,
|
|
|
))
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ if is_state('datanode.joined'):
|
|
|
+ report_status(RelationBase.from_state('datanode.joined'))
|
|
|
+ else:
|
|
|
+ report_blocked()
|
ktsakalozos repliedApr 26, 2016
LGTM (not tested)
kwmonroe repliedApr 26, 2016
I'm with the Jackal. +1 assuming it works ;)