From: Adam Israel Date: Tue, 27 Sep 2016 12:48:37 +0000 (-0400) Subject: Update status messages to fix bug 49 X-Git-Tag: v2.0.2~7^2~20^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=0348098fa408da717eff7f0382f09c6bef327d21;p=osm%2Fdevops.git Update status messages to fix bug 49 Change-Id: Ia577db687cf2aa659d22afd18e316a73a85aae05 Signed-off-by: Adam Israel --- diff --git a/vpe-router/reactive/vpe_router.py b/vpe-router/reactive/vpe_router.py index c62983d8..e2be3276 100644 --- a/vpe-router/reactive/vpe_router.py +++ b/vpe-router/reactive/vpe_router.py @@ -39,6 +39,8 @@ def validate_config(): out, err = router.ssh(['whoami'], routerip, user, passwd) if out.strip() != user: + remove_state('vpe.configured') + status_set('blocked', 'vpe is not configured') raise Exception('invalid credentials') # Set the router's hostname @@ -56,15 +58,18 @@ def validate_config(): ], routerip, user, passwd) - + set_state('vpe.configured') + status_set('active', 'ready!') + else: + remove_state('vpe.configured') + status_set('blocked', 'vpe is not configured') except subprocess.CalledProcessError as e: + remove_state('vpe.configured') + status_set('blocked', 'validation failed: %s' % e) log('Command failed: %s (%s)' % (' '.join(e.cmd), str(e.output))) raise - set_state('vpe.configured') - status_set('active', 'ready!') - except Exception as e: log(repr(e)) remove_state('vpe.configured')