mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-03-10 11:35:20 +01:00
Compare commits
4 commits
1da58f2a24
...
6b2854f40f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b2854f40f | ||
|
|
e929aad539 | ||
|
|
da6c259fdd | ||
|
|
4537dbb7de |
3 changed files with 10 additions and 7 deletions
2
changelogs/fragments/421-remove-deprecation-warning.yml
Normal file
2
changelogs/fragments/421-remove-deprecation-warning.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
trivial:
|
||||||
|
- synchronize - instantiate the connection plugin without the ``new_stdin`` argument, which is deprecated in ansible-core 2.15 (https://github.com/ansible-collections/ansible.posix/pull/421).
|
||||||
|
|
@ -284,9 +284,6 @@ class ActionModule(ActionBase):
|
||||||
# told (via delegate_to) that a different host is the source of the
|
# told (via delegate_to) that a different host is the source of the
|
||||||
# rsync
|
# rsync
|
||||||
if not use_delegate and remote_transport:
|
if not use_delegate and remote_transport:
|
||||||
# Create a connection to localhost to run rsync on
|
|
||||||
new_stdin = self._connection._new_stdin
|
|
||||||
|
|
||||||
# Unlike port, there can be only one shell
|
# Unlike port, there can be only one shell
|
||||||
localhost_shell = None
|
localhost_shell = None
|
||||||
for host in C.LOCALHOST:
|
for host in C.LOCALHOST:
|
||||||
|
|
@ -315,7 +312,11 @@ class ActionModule(ActionBase):
|
||||||
localhost_executable = C.DEFAULT_EXECUTABLE
|
localhost_executable = C.DEFAULT_EXECUTABLE
|
||||||
self._play_context.executable = localhost_executable
|
self._play_context.executable = localhost_executable
|
||||||
|
|
||||||
new_connection = connection_loader.get('local', self._play_context, new_stdin)
|
try:
|
||||||
|
new_connection = connection_loader.get('local', self._play_context)
|
||||||
|
except TypeError:
|
||||||
|
# Needed for ansible-core < 2.15
|
||||||
|
new_connection = connection_loader.get('local', self._play_context, self._connection._new_stdin)
|
||||||
self._connection = new_connection
|
self._connection = new_connection
|
||||||
# Override _remote_is_local as an instance attribute specifically for the synchronize use case
|
# Override _remote_is_local as an instance attribute specifically for the synchronize use case
|
||||||
# ensuring we set local tmpdir correctly
|
# ensuring we set local tmpdir correctly
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ from ansible.module_utils._text import to_text
|
||||||
|
|
||||||
|
|
||||||
def locally_installed(module, pkgname):
|
def locally_installed(module, pkgname):
|
||||||
(rc, out, err) = module.run_command('{0} -q {1}'.format(module.get_bin_path("rpm"), pkgname).split())
|
(rc, stdout, stderr) = module.run_command('{0} -q --whatprovides {1}'.format(module.get_bin_path("rpm"), pkgname).split())
|
||||||
return (rc == 0)
|
return (rc == 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -97,9 +97,9 @@ def rpm_ostree_transaction(module):
|
||||||
module.exit_json(msg="No changes made.")
|
module.exit_json(msg="No changes made.")
|
||||||
else:
|
else:
|
||||||
if module.params['state'] in ['present', 'installed', 'latest']:
|
if module.params['state'] in ['present', 'installed', 'latest']:
|
||||||
module.fail_json(msg="The following packages are absent in the currently booted rpm-ostree commit: %s" ' '.join(pkgs))
|
module.fail_json(msg="The following packages are absent in the currently booted rpm-ostree commit: {}".format(' '.join(pkgs)))
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="The following packages are present in the currently booted rpm-ostree commit: %s" ' '.join(pkgs))
|
module.fail_json(msg="The following packages are present in the currently booted rpm-ostree commit: {}".format(' '.join(pkgs)))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue