X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=juju-charms%2Flayers%2Fpingpong%2Freactive%2Fpingpong.py;h=ae18076cb5915148ff0a70a5951289bc6ba957d1;hb=83976034623fadc32551ef389928482910b3797f;hp=2bcbc143254dfc57faf21912a58746d770e2af0f;hpb=5a0f6e4464da00bb45d2573f6317a75f753d2dc1;p=osm%2Fdevops.git diff --git a/juju-charms/layers/pingpong/reactive/pingpong.py b/juju-charms/layers/pingpong/reactive/pingpong.py index 2bcbc143..ae18076c 100755 --- a/juju-charms/layers/pingpong/reactive/pingpong.py +++ b/juju-charms/layers/pingpong/reactive/pingpong.py @@ -23,16 +23,29 @@ import charms.sshproxy cfg = config() +@when_not('pingpong.configured') +def not_configured(): + """Check the current configuration. + + Check the current values in config to see if we have enough + information to continue. + """ + config_changed() + + @when('config.changed', 'sshproxy.configured') def config_changed(): """Verify the configuration. + Verify that the charm has been configured """ + status_set('maintenance', 'Verifying configuration data...') (validated, output) = charms.sshproxy.verify_ssh_credentials() if not validated: status_set('blocked', 'Unable to verify SSH credentials: {}'.format( output )) + return if all(k in cfg for k in ['mode']): if cfg['mode'] in ['ping', 'pong']: set_flag('pingpong.configured')