Skip to content
Snippets Groups Projects
Commit 8363571d authored by marchettim's avatar marchettim Committed by Gerrit Code Review
Browse files

Merge "Add better status messages"

parents 0d20edf9 5a0f6e44
No related branches found
No related tags found
No related merge requests found
......@@ -10,20 +10,29 @@ from charms.reactive import (
remove_state as remove_flag,
set_state as set_flag,
when,
when_not,
)
import charms.sshproxy
from subprocess import (
Popen,
CalledProcessError,
PIPE,
)
# from subprocess import (
# Popen,
# CalledProcessError,
# PIPE,
# )
cfg = config()
@when('config.changed')
@when('config.changed', 'sshproxy.configured')
def config_changed():
"""Verify the configuration.
Verify that the charm has been configured
"""
(validated, output) = charms.sshproxy.verify_ssh_credentials()
if not validated:
status_set('blocked', 'Unable to verify SSH credentials: {}'.format(
output
))
if all(k in cfg for k in ['mode']):
if cfg['mode'] in ['ping', 'pong']:
set_flag('pingpong.configured')
......@@ -32,6 +41,13 @@ def config_changed():
status_set('blocked', 'Waiting for configuration')
@when('config.changed')
@when_not('sshproxy.configured')
def invalid_credentials():
status_set('blocked', 'Waiting for SSH credentials.')
pass
def is_ping():
if cfg['mode'] == 'ping':
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment