|
|
23d70a |
From e4fae653daa2fc66f5aee63ab4b523f79809fb19 Mon Sep 17 00:00:00 2001
|
|
|
23d70a |
From: Michael Scherer <mscherer@users.noreply.github.com>
|
|
|
23d70a |
Date: Fri, 21 Apr 2017 13:40:47 +0200
|
|
|
23d70a |
Subject: [PATCH] Fix --force for unversionned requirements (#23391)
|
|
|
23d70a |
|
|
|
23d70a |
In current stable (2.2), ansible galaxy install --force do erase
|
|
|
23d70a |
a role, even if the version is not set. This commit should restore
|
|
|
23d70a |
that specific behavior, in accordance to people reports:
|
|
|
23d70a |
https://github.com/ansible/ansible/issues/11266#issuecomment-273801480
|
|
|
23d70a |
|
|
|
23d70a |
It was also the behavior planned in the initial discussion:
|
|
|
23d70a |
"if you're not fixing versions in your roles file, then it's fine
|
|
|
23d70a |
to expect that the role will be reinstalled each time you run
|
|
|
23d70a |
ansible-galaxy install.", cf https://github.com/ansible/ansible/pull/12904
|
|
|
23d70a |
(cherry picked from commit 78836ec0b9719a62fa0f8619707a9f411ed4a4f0)
|
|
|
23d70a |
---
|
|
|
23d70a |
lib/ansible/cli/galaxy.py | 5 +++--
|
|
|
23d70a |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
23d70a |
|
|
|
23d70a |
diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py
|
|
|
23d70a |
index 143fd80..da371e4 100644
|
|
|
23d70a |
--- a/lib/ansible/cli/galaxy.py
|
|
|
23d70a |
+++ b/lib/ansible/cli/galaxy.py
|
|
|
23d70a |
@@ -379,8 +379,9 @@ class GalaxyCLI(CLI):
|
|
|
23d70a |
(role.name, role.install_info['version'], role.version or "unspecified"))
|
|
|
23d70a |
continue
|
|
|
23d70a |
else:
|
|
|
23d70a |
- display.display('- %s is already installed, skipping.' % str(role))
|
|
|
23d70a |
- continue
|
|
|
23d70a |
+ if not force:
|
|
|
23d70a |
+ display.display('- %s is already installed, skipping.' % str(role))
|
|
|
23d70a |
+ continue
|
|
|
23d70a |
|
|
|
23d70a |
try:
|
|
|
23d70a |
installed = role.install()
|
|
|
23d70a |
--
|
|
|
23d70a |
2.9.4
|
|
|
23d70a |
|