Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
WIP - let already_installed check be vague
Browse files Browse the repository at this point in the history
This lets 'install --force' force install
older or newer versions of a collection.

Fixes ansible#266
  • Loading branch information
alikins committed May 30, 2019
1 parent 740db5e commit 8b4ef92
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ansible_galaxy/actions/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ def install_repository(galaxy_context,

log.debug('found_repository_spec: %s', found_repository_spec)

display_callback('Found %s for spec %s' % (found_repository_spec, requirement_spec_to_install.label))

# See if the found collection spec is already installed and either warn or 'force_overwrite'
# to remove existing first.

Expand All @@ -417,9 +419,13 @@ def install_repository(galaxy_context,

# potential_repository_spec is a repo spec for the install candidate we potentially found.
irdb = installed_repository_db.InstalledRepositoryDatabase(galaxy_context)
log.debug('Checking to see if %s is already installed', requirement_spec_to_install)
# log.debug('Checking to see if %s is already installed', requirement_spec_to_install)
log.debug('Checking to see if a collection named %s is already installed', found_repository_spec.label)

repository_spec_match_filter = matchers.MatchRepositorySpecNamespaceName([found_repository_spec])

already_installed_iter = irdb.by_requirement_spec(requirement_spec_to_install)
# already_installed_iter = irdb.by_requirement_spec(requirement_spec_to_install)
already_installed_iter = irdb.select(repository_spec_match_filter=repository_spec_match_filter)
already_installed = sorted(list(already_installed_iter))

log.debug('already_installed: %s', already_installed)
Expand Down

0 comments on commit 8b4ef92

Please sign in to comment.