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

Improve dependency management output #140

Merged
merged 2 commits into from
Oct 3, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Enabled.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"NApp already installed and enabled." would be a bit better.


@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