From: Jokin Garay Date: Fri, 3 Mar 2017 09:12:23 +0000 (+0100) Subject: FlowNAC plugtest charms: fixed israelad's comments X-Git-Tag: v1.1.0~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=4e7c99aebb6d87822355203630151d54647cc23f;p=osm%2Fjuju-charms.git FlowNAC plugtest charms: fixed israelad's comments Change-Id: I94286f45e449e3f5903dc0cbec90be2f584fe963 Signed-off-by: Jokin Garay --- diff --git a/layers/flownac/reactive/flownac.py b/layers/flownac/reactive/flownac.py index ca31bff..893377e 100644 --- a/layers/flownac/reactive/flownac.py +++ b/layers/flownac/reactive/flownac.py @@ -4,6 +4,7 @@ from charmhelpers.core.hookenv import ( action_set, config, status_set, + log, ) from charms.reactive import ( @@ -20,7 +21,12 @@ cfg = config() def config_changed(): if all(k in cfg for k in ['mode']): if cfg['mode'] in ['fnc', 'fne', 'fnd', 'fnu']: - print("Configuring: FlowNAC", cfg['mode'].upper()) + log('Configuring: FlowNAC' + cfg['mode'].upper(), 'INFO') + else: + log('Unsupported mode' + cfg['mode'].upper(), 'WARN') + else: + log('Undefined mode', 'WARN') + cfg['mode']='Undefined' set_flag('flownac.configured') status_set('active', 'VNF ready!') return @@ -101,9 +107,11 @@ def restart(): def check_serv(): err = '' try: - #if is_fnu(): - cmd = "./check.sh" - result, err = charms.sshproxy._run(cmd) + if is_fnu(): + cmd = "sudo check.sh" + result, err = charms.sshproxy._run(cmd) + else: + action_fail('Check-serv not available for:' + cfg['mode']) except: action_fail('command failed:' + err) else: @@ -116,11 +124,11 @@ def check_serv(): def start_client(): err = '' try: - #if is_fnu(): - # Client not prepared for charm execution - #cmd = "./client.sh" - cmd = "ls" - result, err = charms.sshproxy._run(cmd) + if is_fnu(): + cmd = "sudo start_fnu.sh -c" + result, err = charms.sshproxy._run(cmd) + else: + action_fail('Check-serv not available for:' + cfg['mode']) except: action_fail('command failed:' + err) else: