Skip to content

Commit

Permalink
Don't check Ansible version anymore
Browse files Browse the repository at this point in the history
(cherry picked from commit ffec3a4)
  • Loading branch information
drybjed committed Jun 2, 2021
1 parent 7de6360 commit 6ed841e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ General
DebOps repository cloned into the :file:`debops/` directory inside of the
project directory.

- The :command:`debops` script was updated to correctly detect version of
Ansible v4.0.0+.
- The :command:`debops` script will no longer check Ansible version to work
around an issue that was fixed in Ansible 2.0.

:ref:`debops.ansible_plugins` role
''''''''''''''''''''''''''''''''''
Expand Down
19 changes: 0 additions & 19 deletions bin/debops
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,11 @@ def gen_ansible_cfg(filename, config, project_root, playbooks_path,
os.path.join(playbooks_path, "roles"),
"/etc/ansible/roles")))

ansible_version_out = subprocess.check_output([ANSIBLE_PLAYBOOK,
"--version"]).decode()

# Ansible < 4: Get first line and split by spaces to get second 'word'.
# Ansible >= 4: Version line looks like 'ansible-playbook [core 2.11.0]'.
ansible_version_line = ansible_version_out.splitlines()[0].strip()
if ansible_version_line.endswith(']'):
ansible_version = ansible_version_line[:-1].split()[-1]
else:
ansible_version = str(ansible_version_line.split()[1])

for plugin_type in ('action', 'callback', 'connection',
'filter', 'lookup', 'vars'):
plugin_type = plugin_type+"_plugins"
defaults[plugin_type] = PATHSEP.join(custom_paths(plugin_type))

if (ver(ansible_version) >= ver("1.7") and
ver(ansible_version) < ver("2.0")):
# work around a bug obviously introduced in 1.7, see
# https://github.com/ansible/ansible/issues/8555
if ' ' in defaults[plugin_type]:
defaults[plugin_type] = PATHSEP.join(
'"%s"' % p for p in defaults[plugin_type].split(PATHSEP))

defaults['library'] = PATHSEP.join(custom_paths('library'))

write_config(filename, cfg)
Expand Down

0 comments on commit 6ed841e

Please sign in to comment.