Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assemble documentation is wrong/outdated about decrypt parameters #65450

Closed
Duponin opened this issue Dec 3, 2019 · 8 comments · Fixed by #70465
Closed

assemble documentation is wrong/outdated about decrypt parameters #65450

Duponin opened this issue Dec 3, 2019 · 8 comments · Fixed by #70465

Comments

@Duponin
Copy link

@Duponin Duponin commented Dec 3, 2019

SUMMARY

I would like to assemble files into one with assemble module. Documentation said it can decrypt files. After a few tests with Ansible 2.9 I discover that parameter not implemented.

That argument should be available since Ansible 2.4. Which is wrong, documentation or the module?

ISSUE TYPE
  • Bug Report
  • Documentation
COMPONENT NAME

assemble, core module.

ANSIBLE VERSION
ansible 2.9.0
  config file = None
  configured module search path = ['/home/antonin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /bin/ansible
  python version = 3.6.9 (default, Nov 26 2019, 16:36:51) [GCC 9.2.0]
CONFIGURATION
n/a — Empty
OS / ENVIRONMENT

Local task on Voidlinux with linux 5.3.14_1.

STEPS TO REPRODUCE
- name: Tinker certificate
  delegate_to: localhost
  assemble:
    decrypt: true
    src: 'certificates/'
    dest: 'generated/foo.pem'

With encrypted files in certificates/ directory.

EXPECTED RESULTS

A file should be created from other files assemble, like cat file1 file2 file3 > new_file but uncrypted.

ACTUAL RESULTS
"msg": "Unsupported parameters for (assemble) module: decrypt Supported parameters include: attributes, backup, content, delimiter, dest, directory_mode, follow, force, group, ignore_hidden, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"
@ansibot
Copy link
Contributor

@ansibot ansibot commented Dec 3, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

@ansibot ansibot commented Dec 3, 2019

@sivel
Copy link
Member

@sivel sivel commented Dec 4, 2019

This appears to be a bug, it should work as documented. I think the fix is basically:

diff --git a/lib/ansible/plugins/action/assemble.py b/lib/ansible/plugins/action/assemble.py
index d874c7090b..6ec456b586 100644
--- a/lib/ansible/plugins/action/assemble.py
+++ b/lib/ansible/plugins/action/assemble.py
@@ -97,7 +97,7 @@ class ActionModule(ActionBase):
         regexp = self._task.args.get('regexp', None)
         follow = self._task.args.get('follow', False)
         ignore_hidden = self._task.args.get('ignore_hidden', False)
-        decrypt = self._task.args.get('decrypt', True)
+        decrypt = self._task.args.pop('decrypt', True)
 
         try:
             if src is None or dest is None:

But this will need tested, a PR created with a changelog and integration tests to validate the functionality.

@quartin
Copy link

@quartin quartin commented Dec 16, 2019

Hi @sivel, how did you get to that conclusion? Where are then args passed that would make the pop make it work?
New to ansible, so sorry if i'm saying nonsense. Isn't it missing here the decrypt argument?

@sivel
Copy link
Member

@sivel sivel commented Dec 16, 2019

@quartin the actual module doesn't care about decrypt and has no use for it. Allowing the module to accept decrypt could be done, but since it has no use for that argument, popping it and only using it where it is needed seems the best approach.

But I can see from a validate-modules perspective (CI test), that we would have to continue to ignoring a mismatch between DOCUMENTATION and argument_spec.

@kareemhageali
Copy link

@kareemhageali kareemhageali commented Jan 31, 2020

Hey @sivel , I was wondering if I can work on this?

@Soldann
Copy link

@Soldann Soldann commented Mar 12, 2020

Making the above change or adding decrypt to argument_spec both remove the error. However, decryption doesn't actually occur unless remote_src is explicitly set to no. Is this expected behaviour?

@ansibot
Copy link
Contributor

@ansibot ansibot commented May 16, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jul 29, 2020
v2.9.11
=======

Minor Changes
-------------
- The ``items2dict`` filter can now create a dict whose values are the original elements of the input list, and whose keys are the value of some key in each dict. When the resulting dict is stored, this allows for O(1) lookup of a particular key without having to scan the entire list each time.
- k8s - update openshift requirements in documentation
- pipe lookup - update docs for Popen with shell=True usages (ansible/ansible#70159).

Bugfixes
--------
- Allow TypeErrors on Undefined variables in filters to be handled or deferred when processing for loops.
- Fix ``delegate_facts: true`` when ``ansible_python_interpreter`` is not set. (ansible/ansible#70168)
- Support check mode in NXOS BGP modules (ansible/ansible#57360).
- TaskExecutor - Handle unexpected errors as failed while post validating loops (ansible/ansible#70050).
- The `ansible_become` value was not being treated as a boolean value when set in an INI format inventory file (fixes bug ansible/ansible#70476).
- To fix ios_l2_interfaces facts parsing issue (ansible-collections/cisco.ios#59)
- To fix ios_user and ios_command test case failure fix (ansible-collections/cisco.ios#82)
- Vault - Allow single vault encrypted values to be used directly as module parameters. (ansible/ansible#68275)
- add constraints file for ``anisble_runner`` test since an update to ``psutil`` is now causing test failures
- ansible-galaxy - Instead of assuming the first defined server is galaxy, filter based on the servers that support the v1 API, and return the first of those (ansible/ansible#65440)
- ansible-test no longer tracebacks during change analysis due to processing an empty python file
- ansible-test now correctly recognizes imports in collections when using the ``--changed`` option.
- ansible-test now ignores empty ``*.py`` files when analyzing module_utils imports for change detection
- assemble - fix decrypt argument in the module (ansible/ansible#65450).
- docker_container - various error fixes in string handling for Python 2 to avoid crashes when non-ASCII characters are used in strings (ansible-collections/community.general#640).
- eos_eapi - enable eapi by default
- group_by now should correctly refect changed status.
- json callback - Fix host result to task references in the resultant JSON output for non-lockstep strategy plugins such as free (ansible/ansible#65931)
- nmcli - Add compatibility for new networkmanager library (ansible/ansible#65726).
- puppet - fix command line construction for check mode and ``manifest:`` (ansible/ansible#60576).
- selective callback - mark task failed correctly (ansible/ansible#63767).
- windows async - use full path when calling PowerShell to reduce reliance on environment vars being correct - ansible/ansible#70655
- winrm - preserve winrm forensic data on put_file failures
@ansible ansible locked and limited conversation to collaborators Aug 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants