mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Inject the ansible functions into Salt's ansiblegate module.
This was broken in 3001(92438882a9 (diff-519146c38c0ed7bc961ffc5f408d3dd380abb8760d48e839743dbd38dc28ba15R323)
).
Fixes #60207
This commit is contained in:
parent
fc352b4b1e
commit
e466589a6e
11 changed files with 94 additions and 7 deletions
1
changelog/60207.fixed
Normal file
1
changelog/60207.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
Inject the Ansible functions into Salt's ``ansiblegate`` module which was broken on the 3001 release.
|
|
@ -2,3 +2,4 @@
|
|||
pyiface
|
||||
pygit2<1.1.0; python_version <= '3.8'
|
||||
pygit2>=1.4.0; python_version > '3.8'
|
||||
ansible
|
||||
|
|
|
@ -10,6 +10,10 @@ adal==1.2.3
|
|||
# via
|
||||
# azure-datalake-store
|
||||
# msrestazure
|
||||
ansible-base==2.10.9
|
||||
# via ansible
|
||||
ansible==3.4.0
|
||||
# via -r requirements/static/ci/linux.in
|
||||
apache-libcloud==2.5.0 ; sys_platform != "win32"
|
||||
# via -r requirements/static/ci/common.in
|
||||
appdirs==1.4.4
|
||||
|
@ -413,6 +417,7 @@ cryptography==3.3.2
|
|||
# via
|
||||
# -r requirements/static/pkg/py3.10/linux.txt
|
||||
# adal
|
||||
# ansible-base
|
||||
# azure-cosmosdb-table
|
||||
# azure-keyvault
|
||||
# azure-storage-common
|
||||
|
@ -484,6 +489,7 @@ jaraco.functools==2.0
|
|||
jinja2==2.11.3
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.10/linux.txt
|
||||
# ansible-base
|
||||
# junos-eznc
|
||||
# moto
|
||||
# napalm
|
||||
|
@ -669,7 +675,9 @@ oauthlib==3.1.0
|
|||
oscrypto==1.2.0
|
||||
# via certvalidator
|
||||
packaging==19.2
|
||||
# via pytest
|
||||
# via
|
||||
# ansible-base
|
||||
# pytest
|
||||
paramiko==2.7.1 ; sys_platform != "win32" and sys_platform != "darwin"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -785,6 +793,7 @@ pyvmomi==6.7.1.2018.12
|
|||
pyyaml==5.4.1
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.10/linux.txt
|
||||
# ansible-base
|
||||
# cfn-lint
|
||||
# clustershell
|
||||
# junos-eznc
|
||||
|
|
|
@ -10,6 +10,10 @@ adal==1.2.3
|
|||
# via
|
||||
# azure-datalake-store
|
||||
# msrestazure
|
||||
ansible-base==2.10.9
|
||||
# via ansible
|
||||
ansible==3.4.0
|
||||
# via -r requirements/static/ci/linux.in
|
||||
apache-libcloud==2.5.0 ; sys_platform != "win32"
|
||||
# via -r requirements/static/ci/common.in
|
||||
appdirs==1.4.4
|
||||
|
@ -408,6 +412,7 @@ cryptography==3.0
|
|||
# via
|
||||
# -r requirements/static/pkg/py3.5/linux.txt
|
||||
# adal
|
||||
# ansible-base
|
||||
# azure-cosmosdb-table
|
||||
# azure-keyvault
|
||||
# azure-storage-common
|
||||
|
@ -488,6 +493,7 @@ jaraco.functools==2.0
|
|||
jinja2==2.11.3
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.5/linux.txt
|
||||
# ansible-base
|
||||
# junos-eznc
|
||||
# moto
|
||||
jmespath==0.9.4
|
||||
|
@ -663,7 +669,9 @@ oauthlib==3.1.0
|
|||
oscrypto==1.2.0
|
||||
# via certvalidator
|
||||
packaging==19.2
|
||||
# via pytest
|
||||
# via
|
||||
# ansible-base
|
||||
# pytest
|
||||
paramiko==2.7.1 ; sys_platform != "win32" and sys_platform != "darwin"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -773,6 +781,7 @@ pyvmomi==6.7.1.2018.12
|
|||
pyyaml==5.3.1
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.5/linux.txt
|
||||
# ansible-base
|
||||
# cfn-lint
|
||||
# clustershell
|
||||
# junos-eznc
|
||||
|
|
|
@ -10,6 +10,10 @@ adal==1.2.3
|
|||
# via
|
||||
# azure-datalake-store
|
||||
# msrestazure
|
||||
ansible-base==2.10.9
|
||||
# via ansible
|
||||
ansible==3.4.0
|
||||
# via -r requirements/static/ci/linux.in
|
||||
apache-libcloud==2.5.0 ; sys_platform != "win32"
|
||||
# via -r requirements/static/ci/common.in
|
||||
appdirs==1.4.4
|
||||
|
@ -408,6 +412,7 @@ cryptography==3.3.2
|
|||
# via
|
||||
# -r requirements/static/pkg/py3.6/linux.txt
|
||||
# adal
|
||||
# ansible-base
|
||||
# azure-cosmosdb-table
|
||||
# azure-keyvault
|
||||
# azure-storage-common
|
||||
|
@ -488,6 +493,7 @@ jaraco.functools==2.0
|
|||
jinja2==2.11.3
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.6/linux.txt
|
||||
# ansible-base
|
||||
# junos-eznc
|
||||
# moto
|
||||
jmespath==0.9.4
|
||||
|
@ -663,7 +669,9 @@ oauthlib==3.1.0
|
|||
oscrypto==1.2.0
|
||||
# via certvalidator
|
||||
packaging==19.2
|
||||
# via pytest
|
||||
# via
|
||||
# ansible-base
|
||||
# pytest
|
||||
paramiko==2.7.1 ; sys_platform != "win32" and sys_platform != "darwin"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -771,6 +779,7 @@ pyvmomi==6.7.1.2018.12
|
|||
pyyaml==5.4.1
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.6/linux.txt
|
||||
# ansible-base
|
||||
# cfn-lint
|
||||
# clustershell
|
||||
# junos-eznc
|
||||
|
|
|
@ -10,6 +10,10 @@ adal==1.2.3
|
|||
# via
|
||||
# azure-datalake-store
|
||||
# msrestazure
|
||||
ansible-base==2.10.9
|
||||
# via ansible
|
||||
ansible==3.4.0
|
||||
# via -r requirements/static/ci/linux.in
|
||||
apache-libcloud==2.5.0 ; sys_platform != "win32"
|
||||
# via -r requirements/static/ci/common.in
|
||||
appdirs==1.4.4
|
||||
|
@ -411,6 +415,7 @@ cryptography==3.3.2
|
|||
# via
|
||||
# -r requirements/static/pkg/py3.7/linux.txt
|
||||
# adal
|
||||
# ansible-base
|
||||
# azure-cosmosdb-table
|
||||
# azure-keyvault
|
||||
# azure-storage-common
|
||||
|
@ -489,6 +494,7 @@ jaraco.functools==2.0
|
|||
jinja2==2.11.3
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.7/linux.txt
|
||||
# ansible-base
|
||||
# junos-eznc
|
||||
# moto
|
||||
# napalm
|
||||
|
@ -675,7 +681,9 @@ oauthlib==3.1.0
|
|||
oscrypto==1.2.0
|
||||
# via certvalidator
|
||||
packaging==19.2
|
||||
# via pytest
|
||||
# via
|
||||
# ansible-base
|
||||
# pytest
|
||||
paramiko==2.7.1 ; sys_platform != "win32" and sys_platform != "darwin"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -791,6 +799,7 @@ pyvmomi==6.7.1.2018.12
|
|||
pyyaml==5.4.1
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.7/linux.txt
|
||||
# ansible-base
|
||||
# cfn-lint
|
||||
# clustershell
|
||||
# junos-eznc
|
||||
|
|
|
@ -10,6 +10,10 @@ adal==1.2.3
|
|||
# via
|
||||
# azure-datalake-store
|
||||
# msrestazure
|
||||
ansible-base==2.10.9
|
||||
# via ansible
|
||||
ansible==3.4.0
|
||||
# via -r requirements/static/ci/linux.in
|
||||
apache-libcloud==2.5.0 ; sys_platform != "win32"
|
||||
# via -r requirements/static/ci/common.in
|
||||
appdirs==1.4.4
|
||||
|
@ -411,6 +415,7 @@ cryptography==3.3.2
|
|||
# via
|
||||
# -r requirements/static/pkg/py3.8/linux.txt
|
||||
# adal
|
||||
# ansible-base
|
||||
# azure-cosmosdb-table
|
||||
# azure-keyvault
|
||||
# azure-storage-common
|
||||
|
@ -482,6 +487,7 @@ jaraco.functools==2.0
|
|||
jinja2==2.11.3
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.8/linux.txt
|
||||
# ansible-base
|
||||
# junos-eznc
|
||||
# moto
|
||||
# napalm
|
||||
|
@ -667,7 +673,9 @@ oauthlib==3.1.0
|
|||
oscrypto==1.2.0
|
||||
# via certvalidator
|
||||
packaging==19.2
|
||||
# via pytest
|
||||
# via
|
||||
# ansible-base
|
||||
# pytest
|
||||
paramiko==2.7.1 ; sys_platform != "win32" and sys_platform != "darwin"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -783,6 +791,7 @@ pyvmomi==6.7.1.2018.12
|
|||
pyyaml==5.4.1
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.8/linux.txt
|
||||
# ansible-base
|
||||
# cfn-lint
|
||||
# clustershell
|
||||
# junos-eznc
|
||||
|
|
|
@ -10,6 +10,10 @@ adal==1.2.3
|
|||
# via
|
||||
# azure-datalake-store
|
||||
# msrestazure
|
||||
ansible-base==2.10.9
|
||||
# via ansible
|
||||
ansible==3.4.0
|
||||
# via -r requirements/static/ci/linux.in
|
||||
apache-libcloud==2.5.0 ; sys_platform != "win32"
|
||||
# via -r requirements/static/ci/common.in
|
||||
appdirs==1.4.4
|
||||
|
@ -413,6 +417,7 @@ cryptography==3.3.2
|
|||
# via
|
||||
# -r requirements/static/pkg/py3.9/linux.txt
|
||||
# adal
|
||||
# ansible-base
|
||||
# azure-cosmosdb-table
|
||||
# azure-keyvault
|
||||
# azure-storage-common
|
||||
|
@ -484,6 +489,7 @@ jaraco.functools==2.0
|
|||
jinja2==2.11.3
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.9/linux.txt
|
||||
# ansible-base
|
||||
# junos-eznc
|
||||
# moto
|
||||
# napalm
|
||||
|
@ -669,7 +675,9 @@ oauthlib==3.1.0
|
|||
oscrypto==1.2.0
|
||||
# via certvalidator
|
||||
packaging==19.2
|
||||
# via pytest
|
||||
# via
|
||||
# ansible-base
|
||||
# pytest
|
||||
paramiko==2.7.1 ; sys_platform != "win32" and sys_platform != "darwin"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -785,6 +793,7 @@ pyvmomi==6.7.1.2018.12
|
|||
pyyaml==5.4.1
|
||||
# via
|
||||
# -r requirements/static/pkg/py3.9/linux.txt
|
||||
# ansible-base
|
||||
# cfn-lint
|
||||
# clustershell
|
||||
# junos-eznc
|
||||
|
|
|
@ -256,7 +256,7 @@ def __virtual__():
|
|||
global _caller
|
||||
_resolver = AnsibleModuleResolver(__opts__).resolve().install()
|
||||
_caller = AnsibleModuleCaller(_resolver)
|
||||
_set_callables(list())
|
||||
_set_callables(list_())
|
||||
return __virtualname__
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@ salt/modules/(debian_service|freebsdservice|gentoo_service|launchctl_service|mac
|
|||
- integration.modules.test_service
|
||||
- integration.states.test_service
|
||||
|
||||
|
||||
salt/modules/ansiblegate.py:
|
||||
- unit.states.test_ansiblegate
|
||||
- integration.states.test_ansiblegate
|
||||
- pytests.functional.modules.test_ansiblegate
|
||||
|
||||
salt/modules/*apache.py:
|
||||
- pytests.unit.states.apache.test_apache
|
||||
- pytests.unit.states.apache.test_conf
|
||||
|
|
25
tests/pytests/functional/modules/test_ansiblegate.py
Normal file
25
tests/pytests/functional/modules/test_ansiblegate.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import pytest
|
||||
import salt.modules.ansiblegate as ansiblegate
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skipif(ansiblegate.ansible is None, reason="Ansible is not installed"),
|
||||
pytest.mark.skip_on_windows(reason="Not supported on Windows"),
|
||||
]
|
||||
|
||||
|
||||
def test_ansible_functions_loaded(modules):
|
||||
"""
|
||||
Test that the ansible functions are actually loaded
|
||||
"""
|
||||
if "ansible.system.ping" in modules:
|
||||
# we need to go by getattr() because salt's loader will try to find "system" in the dictionary and fail
|
||||
# The ansible hack injects, in this case, "system.ping" as an attribute to the loaded module
|
||||
ret = getattr(modules.ansible, "system.ping")()
|
||||
elif "ansible.ping" in modules:
|
||||
# Ansible >= 2.10
|
||||
ret = modules.ansible.ping()
|
||||
else:
|
||||
pytest.fail("Where is the ping function these days in Ansible?!")
|
||||
|
||||
ret.pop("timeout", None)
|
||||
assert ret == {"ping": "pong"}
|
Loading…
Add table
Reference in a new issue