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

Backport/2.11/74476 #74520

Closed
wants to merge 28 commits into from

Conversation

maximmasiutin
Copy link
Contributor

SUMMARY

The error message about the failure to import a 'gpg' key by the 'ansible.builtin.apt_key' module was incorrect.

This is a backport of #74476 into the 2.11.

The backport to 2.10 is not needed, since this bug didn't yet exist in 2.10.

When importing a key by the apt_key module, in case of error, the error message was incorrect, because the logic to distinguish between the file name and the explicit data was inversed.

The error message was:

Unable to extract key from '-'

While it should have been:

Unable to extract key from 'inline data'

The relevant code is in the following line from: /lib/ansible/modules/apt_key.py

module.fail_json(msg="Unable to extract key from '%s'" % ('inline data' if data is None else filename), stdout=out, stderr=err)

(it should have been if data is None)

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/modules/apt_key

ADDITIONAL INFORMATION

Fixes: #74423

To reproduce this error, see the associated test .yml from the present commit.

Alternatively, you can reproduce the error by the following files:

The Vagrantfile file:

Vagrant.configure("2") do |config|
  config.vm.synced_folder ".", "/vagrant", disabled: false

  config.vm.define "test-host" do |n|
    n.vm.box = "ubuntu/bionic64"
    n.vm.hostname = "test-host"
    n.vm.provision :ansible do |ansible|
      ansible.limit = "all"
      ansible.playbook = "test.yaml"
    end
  end
end

The test.yaml file:

- name: Test Playbook
  hosts: test-host
  become: yes
  tasks:
    - name: Add binary key
      apt_key: url=https://packages.cloud.google.com/apt/doc/apt-key.gpg

and run vagrant up

Expected Results:

Unable to extract key from 'inline data'

Actual Results:

Unable to extract key from '-'

@Akasurde - please review

mattclay and others added 28 commits April 5, 2021 17:00
(cherry picked from commit f436058)

Co-authored-by: Matt Clay <matt@mystile.com>
…ansible#74167)

* Update distro test containers to version 2.0.2.

* Update the default test containers.
(cherry picked from commit 459ea5a)

Co-authored-by: Matt Clay <mclay@redhat.com>
…ble#74204)

(cherry picked from commit becf941)

Co-authored-by: Matt Clay <matt@mystile.com>
…onnection unit test target (ansible#74176) (ansible#74180)

For connection units tests, if the `__init__.py` file is modified, the trailing separator was
not added, making the target invalid.
(cherry picked from commit 7b79b69)

Co-authored-by: Sam Doran <sdoran@redhat.com>
(cherry picked from commit 4819e93)

Co-authored-by: Alexander Sowitzki <asowitzk@redhat.com>
) (ansible#74375)

(cherry picked from commit a3e7cf0)

Co-authored-by: Matt Martz <matt@sivel.net>
(cherry picked from commit cb7f4f1)

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 14ff5e2)

Co-authored-by: Matt Clay <matt@mystile.com>
* Docs: clarify role docs - vars vs params, dependencies (ansible#74104)

(cherry picked from commit 05662fd)

* pin docutils to 0.16 until theme problem is fixed (ansible#74193)

(cherry picked from commit 7443e9d)

* Docs: Remove duplicate word (ansible#74223)

The word "to" was erroneously used twice consecutively.

Signed-off-by: Matthew Cengia <mattcen@mattcen.com>
(cherry picked from commit c747382)

* Change look and feel of the `ansible-core` docs (ansible#74200)

(cherry picked from commit d7f826c)

* fix see_also formatting (ansible#74252)

(cherry picked from commit 270f109)

* Update the porting guide for ansible package 4.0.0 alpha4 (ansible#74280)

(cherry picked from commit ee38202)

* Typo fix in help output (ansible#74277)

Should still fit in 80 chars

(cherry picked from commit 8e5dc73)

* update intersphinx links for Ansible 3

(cherry picked from commit 481c036)

Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
Co-authored-by: Matthew Cengia <mattcen+github@mattcen.com>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
Co-authored-by: Richlv <richlv@nakts.net>
* Fix issue with version 3 in docs version list (ansible#74089)

Previously would subsitute the "3" in "s3" instead of the version location in the URL

(cherry picked from commit 325ccf2)

* corrected epmhasis line (ansible#74254)

need to be careful when adding lines as you create a different offset

(cherry picked from commit 7b39ee3)

* correct how to install Docker SDK for Python (ansible#74288)

* docs: correct guide for the latest Docker SDK for Python
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: Daeseok Youn <daeseok.youn@navercorp.com>
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>

(cherry picked from commit 9369bd6)

* Provide results to examples (ansible#73984)

(cherry picked from commit 99a2b5f)

* remove deprecated ansible.module_utils._text from documentation (ansible#73211)

According to comment in ansible.module_utils._text it is deprecated and
should not be used. This is now reflected in the documentation.

(cherry picked from commit 5e5bfa8)

* Update playbooks_filters.rst (ansible#74242)

##### SUMMARY
Make the `random` filter description more clear.

(cherry picked from commit 5f391a7)

* Docs: Fix k8s_config_resource_name YAML example (ansible#74129)

The `name` key should be beneath `metadata`:

(cherry picked from commit c9c8459)

* Update lookup.rst (ansible#73716)

Document that users must pass `allow_unsafe=True` as an option in the lookup to allow templating, with a note about security implications.

Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
(cherry picked from commit c0cc574)

* vmware: Add a note about known issue (ansible#73273)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
(cherry picked from commit 6e56e72)

Co-authored-by: Scott Sinclair <252082+pwae@users.noreply.github.com>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: daeseokyoun <daeseok.youn@gmail.com>
Co-authored-by: Baptiste Mille-Mathias <baptiste.millemathias@gmail.com>
Co-authored-by: schurzi <github@drachen-server.de>
Co-authored-by: yuri <1969yuri1969@gmail.com>
Co-authored-by: ml <6209465+ml-@users.noreply.github.com>
Co-authored-by: sry9681 <sry9681@users.noreply.github.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Also remove some other unncessary code from CI scripts.
(cherry picked from commit be7de98)

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 877e5b3)

Co-authored-by: Matt Clay <matt@mystile.com>
* Add description for COLLECTIONS_SCAN_SYS_PATH (ansible#74351)

Fixes: ansible#74275

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 567361b)

* lighten navigation background to make section labels easier to read for core docs (ansible#74356)

* make section labels for /ansible-core/ docs easier to read, with black text and lighter gray background

(cherry picked from commit 6119fb0)

* Correct splitext() description, and example (ansible#74377)

`splitext()` returns a 2-tuple of strings, and the last element of the return value includes the `.`

(cherry picked from commit c295de6)

* Using "~" instead of "+" for concatination (ansible#74364)

Changed FAQ examples to conform with the Jinja documentation:
If both values on either side of a plus/+ are numbers, they will be added whereas using "~" will convert all operands into strings and then concatenate them. Closes ansible#73799.

(cherry picked from commit e6a5245)

* Docs - Split Developing collections page, add info on optional module_utils (ansible#74105)

*

(cherry picked from commit c90922e)

* Add weos4 network platform to documentation (ansible#74088)

* Add weos4 network platform to documentation

* Fix small format issues

(cherry picked from commit 7ca5ded)

* Fix typo in Makefile (ansible#74396)

Fixed minor typo specfic -> specific

(cherry picked from commit 4880fee)

* Update complex_data_manipulation.rst (ansible#72509)

(cherry picked from commit c2985c4)

* Update VMware library installation docs (ansible#71219)

Depending upon OS/distro, please use pip/pip3.

(cherry picked from commit ddfc648)

* Update AWS dev guides to use collections utils and fragments (ansible#72312)

(cherry picked from commit cf08c23)

* Use is_boto3_error_code in 'standard' example (ansible#72313)

Use is_boto3_error_code in 'standard' example rather than e.response['Error']['Code'] (ansible#72313)

Co-authored-by: Sloane Hertel <shertel@redhat.com>
(cherry picked from commit 63afb33)

* Update Kubernetes collection name in docs (ansible#74440)

(cherry picked from commit 8d499bb)

* Update argcomplete docs links on installation guide (ansible#74410)

Link on installation docs is outdated. Switch to currently docs at: https://kislyuk.github.io/argcomplete/

(cherry picked from commit f97787c)

* fix spacing to fix header, reorg contributing page (ansible#74421)

Co-authored-by: John R Barker <john@johnrbarker.com>
(cherry picked from commit 9d9b08b)

* Update first_found documentation (ansible#70502)

* import_tasks do not work with loop, use use include_tasks instead
* update documentation

(cherry picked from commit bacede7)

* Product-related updates. (ansible#74454)

(cherry picked from commit 34c9ed8)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: Hublerho <43293510+Hublerho@users.noreply.github.com>
Co-authored-by: Ernst Oudhof <17832702+ernst-s@users.noreply.github.com>
Co-authored-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
Co-authored-by: dhx-mike-palandra <45608336+dhx-mike-palandra@users.noreply.github.com>
Co-authored-by: jakelevinez <31458570+jakelevinez@users.noreply.github.com>
Co-authored-by: Mark Chappell <mchappel@redhat.com>
Co-authored-by: Lidiane Taquehara <lidi.mayra@gmail.com>
Co-authored-by: Alex Domoradov <alex.hha@gmail.com>
Co-authored-by: Bill Nottingham <notting@redhat.com>
Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com>
Due to the recent security incident, use our own copy hosted in S3
to mitigate future risk from running an arbitrary script downloaded from a
remote and untrtusted server.
(cherry picked from commit aa12af1)

Co-authored-by: Sam Doran <sdoran@redhat.com>
…ment spec validation (ansible#74268) (ansible#74353)

* Add ArgumentSpecValidator to docs
* Improve docs for ArgumentSpecValidator
* Document removal of private methods

* Update module_utils documentation
    - Add docs for argument spec classes as well as validation and parameters files.
    - preserve the order in the source for errors.py
    - document DEFAULT_TYPE_VALIDATORS so it can be referenced elsewhere
    - fix automodule directive for validation.py

* Update docs in arg_spec and paremeters
    - This improves the generated documentation.

* Document breaking changes in porting guide.
* Update formatting in porting guide and add a Deprecated section
* Fine tune module_utils documentation

* Move instance docstring to the __init__ method
  Remove optional description since it fails the sanity test and I am not 100% it is valid anyway.

* Remove incorrect parameter from docstring
  This was changed a while ago but wasn't removed from the docstring.

* Use attr rather than attribute
  The py:attribute: domain only exists in newer Sphinx >= 3.1.

* Improve documentation on exceptions
* Final pass
    - use args/kwargs instead of param
    - fix formatting errors that didn't display examples correctly
    - format TypeErrors so they are referenced as classes
    - specify complex types
(cherry picked from commit 2cbfd1e)

Co-authored-by: Sam Doran <sdoran@redhat.com>
…ible.builtin.apt_key' module was incorrect (ansible#74423)

Co-authored-by: Sam Doran <sdoran@redhat.com>

(cherry picked from commit e4d7fc9)
@maximmasiutin
Copy link
Contributor Author

Sorry, pulled too many commits

@maximmasiutin maximmasiutin deleted the backport/2.11/74476 branch April 30, 2021 18:14
@ansible ansible locked and limited conversation to collaborators May 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid error message on GnuPG key import error in the apt_key module
10 participants