Skip to content

Commit

Permalink
Do the checks at the tool level as well
Browse files Browse the repository at this point in the history
  • Loading branch information
muffato committed Nov 9, 2022
1 parent 9d789b2 commit bdfdf32
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions shpc/main/modules/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,17 +493,28 @@ def _reinstall(self, module_name, version, when_missing):
"""
Reinstall (and possibly upgrade) all the current modules, possibly filtered by pattern.
"""
config = self.load_registry_config(module_name)
if version in config.tags:
self.install(module_name + ":" + version, allow_reinstall=True)
elif when_missing == "ignore":
pass
elif when_missing == "uninstall":
self.uninstall(module_name + ":" + version, force=True)
result = self.registry.find(module_name)
if result:
config = container.ContainerConfig(result)
if version in config.tags:
return self.install(module_name + ":" + version, allow_reinstall=True)
else:
missing = module_name + ":" + version
else:
missing = module_name

if when_missing:
if when_missing == "ignore":
logger.info(
"%s is not in the Registry any more. Ignoring as instructed."
% missing
)
elif when_missing == "uninstall":
self.uninstall(module_name + ":" + version, force=True)
else:
logger.exit(
"%s is not in the Registry any more. Add --uninstall-missing or --ignore-missing."
% module_name
% missing
)

def _upgrade(self, module_name, versions, upgrade=False, force=False):
Expand Down

0 comments on commit bdfdf32

Please sign in to comment.