← Back to team overview

nagios-charmers team mailing list archive

Re: [Merge] ~shaner/thruk-agent-charm:master into thruk-agent-charm:master

 

Review: Approve

This charm needs to be reworked into charms.reactive, but that is beyond the scope of this MP. From my recollection of ServiceManager, this is the cleanest way to wait for the socket.

This all looks good. Per inline comment, I suspect you should be using 'waiting' instead of 'blocked' when the socket is not available. 'waiting' is when the charm is expected to resolve itself. 'blocked' means an action needs to be performed by somebody before things will resolve.

Confirm and/or change the pending status, and good for landing.

Diff comments:

> diff --git a/hooks/thruk_helpers.py b/hooks/thruk_helpers.py
> index df208e5..70619ce 100644
> --- a/hooks/thruk_helpers.py
> +++ b/hooks/thruk_helpers.py
> @@ -45,6 +47,18 @@ class ThrukInfo(dict):
>          self['thruk_id'] = m.hexdigest()
>  
>  
> +class CheckLivestatusSocket(dict):
> +    def __bool__(self):
> +        if not os.path.exists(hookenv.config('livestatus_path')):
> +            hookenv.status_set('blocked',
> +                               'nagios livestatus socket missing')

'blocked' means an operator may need to perform some action before the charm can continue. Assuming this state is going to fix itself in a few minutes, you should use 'waiting' instead of 'blocked'.

> +            return False
> +        return True
> +
> +    def __nonzero__(self):
> +        return self.__bool__()
> +
> +
>  class NEMRelation(helpers.RelationContext):
>      name = 'nrpe-external-master'
>      interface = 'nrpe-external-master'


-- 
https://code.launchpad.net/~shaner/thruk-agent-charm/+git/thruk-agent-charm/+merge/361690
Your team Nagios Charm developers is subscribed to branch thruk-agent-charm:master.


References