Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #140 from macartur/issue-#135
Browse files Browse the repository at this point in the history
Improve dependency management output
  • Loading branch information
diraol authored Oct 3, 2017
2 parents c87ca60 + 4458a0e commit 7aa3ca2
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions kytos/cli/commands/napps/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 installed and enabled.')

@classmethod
def install_napp(cls, mgr):
Expand All @@ -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.')
Expand Down

0 comments on commit 7aa3ca2

Please sign in to comment.