Skip to content

Commit bdfdf32

Browse files
committed
Do the checks at the tool level as well
1 parent 9d789b2 commit bdfdf32

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

shpc/main/modules/base.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,17 +493,28 @@ def _reinstall(self, module_name, version, when_missing):
493493
"""
494494
Reinstall (and possibly upgrade) all the current modules, possibly filtered by pattern.
495495
"""
496-
config = self.load_registry_config(module_name)
497-
if version in config.tags:
498-
self.install(module_name + ":" + version, allow_reinstall=True)
499-
elif when_missing == "ignore":
500-
pass
501-
elif when_missing == "uninstall":
502-
self.uninstall(module_name + ":" + version, force=True)
496+
result = self.registry.find(module_name)
497+
if result:
498+
config = container.ContainerConfig(result)
499+
if version in config.tags:
500+
return self.install(module_name + ":" + version, allow_reinstall=True)
501+
else:
502+
missing = module_name + ":" + version
503+
else:
504+
missing = module_name
505+
506+
if when_missing:
507+
if when_missing == "ignore":
508+
logger.info(
509+
"%s is not in the Registry any more. Ignoring as instructed."
510+
% missing
511+
)
512+
elif when_missing == "uninstall":
513+
self.uninstall(module_name + ":" + version, force=True)
503514
else:
504515
logger.exit(
505516
"%s is not in the Registry any more. Add --uninstall-missing or --ignore-missing."
506-
% module_name
517+
% missing
507518
)
508519

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

0 commit comments

Comments
 (0)