From bd7838354f02bb3d012192b0d5bd05962db668cf Mon Sep 17 00:00:00 2001 From: Macartur Sousa Date: Fri, 29 Sep 2017 15:27:31 -0300 Subject: [PATCH 1/2] Improve dependency management output Fix #135 --- kytos/cli/commands/napps/api.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/kytos/cli/commands/napps/api.py b/kytos/cli/commands/napps/api.py index 6774458..6b27767 100644 --- a/kytos/cli/commands/napps/api.py +++ b/kytos/cli/commands/napps/api.py @@ -63,7 +63,6 @@ def enable_napp(cls, mgr): LOG.info(' Enabling...') mgr.enable() LOG.info(' Enabled.') - cls.enable_napps(mgr.dependencies()) except (FileNotFoundError, PermissionError) as exception: LOG.error(' %s', exception) @@ -130,16 +129,18 @@ def install_napps(cls, napps): for napp in napps: mgr.set_napp(*napp) LOG.info('NApp %s:', mgr.napp_id) + if not mgr.is_installed(): cls.install_napp(mgr) - LOG.info(' Installed.') - else: - LOG.warning(' Napp already Installed.') + + if not mgr.is_enabled(): cls.enable_napp(mgr) - napp_dependencies = mgr.dependencies() - if napp_dependencies: - LOG.info('Installing Dependencies:') - cls.install_napps(napp_dependencies) + napp_dependencies = mgr.dependencies() + if napp_dependencies: + LOG.info('Installing Dependencies:') + cls.install_napps(napp_dependencies) + else: + LOG.warning(' Napp already Enabled.') @classmethod def install_napp(cls, mgr): @@ -148,13 +149,11 @@ def install_napp(cls, mgr): LOG.info(' Searching local NApp...') mgr.install_local() LOG.info(' Found and installed.') - cls.enable_napp(mgr) except FileNotFoundError: LOG.info(' Not found. Downloading from NApps Server...') try: mgr.install_remote() LOG.info(' Downloaded and installed.') - cls.enable_napp(mgr) except HTTPError as exception: if exception.code == 404: LOG.error(' NApp not found.') From 4458a0ed923d7dc0a3dff803eef451256e3f784b Mon Sep 17 00:00:00 2001 From: Macartur Sousa Date: Tue, 3 Oct 2017 11:11:08 -0300 Subject: [PATCH 2/2] Fix messages indentation --- kytos/cli/commands/napps/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kytos/cli/commands/napps/api.py b/kytos/cli/commands/napps/api.py index 6b27767..f530da0 100644 --- a/kytos/cli/commands/napps/api.py +++ b/kytos/cli/commands/napps/api.py @@ -137,10 +137,10 @@ def install_napps(cls, napps): cls.enable_napp(mgr) napp_dependencies = mgr.dependencies() if napp_dependencies: - LOG.info('Installing Dependencies:') + LOG.info(' Installing Dependencies:') cls.install_napps(napp_dependencies) else: - LOG.warning(' Napp already Enabled.') + LOG.warning(' NApp already installed and enabled.') @classmethod def install_napp(cls, mgr):