From 0348098fa408da717eff7f0382f09c6bef327d21 Mon Sep 17 00:00:00 2001 From: Adam Israel Date: Tue, 27 Sep 2016 08:48:37 -0400 Subject: [PATCH] Update status messages to fix bug 49 Change-Id: Ia577db687cf2aa659d22afd18e316a73a85aae05 Signed-off-by: Adam Israel --- vpe-router/reactive/vpe_router.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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') -- 2.25.1