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

fix AWS plugin credential precedence for environment variables #52945

Open
wants to merge 6 commits into
base: devel
from

Conversation

Projects
None yet
4 participants
@s-hertel
Copy link
Contributor

s-hertel commented Feb 25, 2019

SUMMARY

The environment variable precedence was incorrectly reversed

This is the way the precedence works:

env:
    - name: fallback
    - name: highest_precedence
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

AWS plugins

s-hertel added some commits Mar 6, 2019

Allow aliases in direct plugins options
Consolidate precedence fix just in the doc fragment using aliases for mismatched options

@s-hertel s-hertel requested a review from bcoca Mar 6, 2019

@s-hertel

This comment has been minimized.

Copy link
Contributor Author

s-hertel commented Mar 6, 2019

@bcoca I could fix this without adding alias support, just 159e28a, but it feels like a lot of duplicating. Do you mind taking a look at the alias stuff I added for config/manager?

@ansibot

This comment was marked as resolved.

Copy link
Contributor

ansibot commented Mar 6, 2019

The test ansible-test sanity --test pylint [explain] failed with 2 errors:

lib/ansible/plugins/doc_fragments/aws_credentials.py:10:0: syntax-error invalid syntax (<unknown>, line 10)
lib/ansible/plugins/doc_fragments/aws_region.py:10:0: syntax-error invalid syntax (<unknown>, line 10)

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 4 errors:

lib/ansible/plugins/inventory/aws_ec2.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/inventory/aws_rds.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_account_attribute.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_secret.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 4 errors:

lib/ansible/plugins/inventory/aws_ec2.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/inventory/aws_rds.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_account_attribute.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_secret.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 4 errors:

lib/ansible/plugins/inventory/aws_ec2.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/inventory/aws_rds.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_account_attribute.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_secret.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 4 errors:

lib/ansible/plugins/inventory/aws_ec2.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/inventory/aws_rds.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_account_attribute.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_secret.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 4 errors:

lib/ansible/plugins/inventory/aws_ec2.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/inventory/aws_rds.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_account_attribute.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_secret.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.8 [explain] failed with 4 errors:

lib/ansible/plugins/inventory/aws_ec2.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/inventory/aws_rds.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_account_attribute.py:0:0: has a documentation error formatting or is missing documentation.
lib/ansible/plugins/lookup/aws_secret.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test docs-build [explain] failed with 25 errors:

docs/docsite/rst/dev_guide/developing_inventory.rst:14:0: undefined-label: undefined label: script_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:35:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:37:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:39:0: undefined-label: undefined label: constructed_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:41:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:43:0: undefined-label: undefined label: virtualbox_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:45:0: undefined-label: undefined label: script_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:109:0: undefined-label: undefined label: virtualbox_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:111:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:290:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/plugins/connection.rst:39:0: undefined-label: undefined label: inventory_hostnames_lookup (if the link has no caption the label must precede a section header)
docs/docsite/rst/plugins/inventory.rst:146:0: toc-tree-glob-pattern-no-match: toctree glob pattern 'inventory/*' didn't match any documents
docs/docsite/rst/plugins/lookup.rst:49:0: undefined-label: undefined label: items_lookup (if the link has no caption the label must precede a section header)
docs/docsite/rst/plugins/lookup.rst:150:0: toc-tree-glob-pattern-no-match: toctree glob pattern 'lookup/*' didn't match any documents
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:332:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:332:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:332:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/reference_appendices/faq.rst:617:0: undefined-label: undefined label: vars_lookup (if the link has no caption the label must precede a section header)
docs/docsite/rst/scenario_guides/guide_infoblox.rst:46:0: undefined-label: undefined label: nios_lookup (if the link has no caption the label must precede a section header)
docs/docsite/rst/scenario_guides/guide_infoblox.rst:47:0: undefined-label: undefined label: nios_next_ip_lookup (if the link has no caption the label must precede a section header)
docs/docsite/rst/scenario_guides/guide_infoblox.rst:48:0: undefined-label: undefined label: nios_next_network_lookup (if the link has no caption the label must precede a section header)
docs/docsite/rst/scenario_guides/guide_infoblox.rst:56:0: undefined-label: undefined label: nios_lookup (if the link has no caption the label must precede a section header)
docs/docsite/rst/scenario_guides/guide_infoblox.rst:156:0: undefined-label: undefined label: nios_lookup (if the link has no caption the label must precede a section header)
docs/docsite/rst/scenario_guides/guide_infoblox.rst:208:0: undefined-label: undefined label: nios_next_ip_lookup (if the link has no caption the label must precede a section header)
docs/docsite/rst/scenario_guides/guide_scaleway.rst:176:0: undefined-label: undefined label: scaleway_inventory (if the link has no caption the label must precede a section header)

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 2 errors:

lib/ansible/plugins/doc_fragments/aws_credentials.py:10:13: SyntaxError: DOCUMENTATION = r'''
lib/ansible/plugins/doc_fragments/aws_region.py:10:13: SyntaxError: DOCUMENTATION = r'''

The test ansible-test sanity --test compile --python 2.7 [explain] failed with 2 errors:

lib/ansible/plugins/doc_fragments/aws_credentials.py:10:13: SyntaxError: DOCUMENTATION = r'''
lib/ansible/plugins/doc_fragments/aws_region.py:10:13: SyntaxError: DOCUMENTATION = r'''

The test ansible-test sanity --test compile --python 3.5 [explain] failed with 2 errors:

lib/ansible/plugins/doc_fragments/aws_credentials.py:10:13: SyntaxError: DOCUMENTATION = r'''
lib/ansible/plugins/doc_fragments/aws_region.py:10:13: SyntaxError: DOCUMENTATION = r'''

The test ansible-test sanity --test compile --python 3.6 [explain] failed with 2 errors:

lib/ansible/plugins/doc_fragments/aws_credentials.py:10:13: SyntaxError: DOCUMENTATION = r'''
lib/ansible/plugins/doc_fragments/aws_region.py:10:13: SyntaxError: DOCUMENTATION = r'''

The test ansible-test sanity --test compile --python 3.7 [explain] failed with 2 errors:

lib/ansible/plugins/doc_fragments/aws_credentials.py:10:13: SyntaxError: DOCUMENTATION = r'''
lib/ansible/plugins/doc_fragments/aws_region.py:10:13: SyntaxError: DOCUMENTATION = r'''

The test ansible-test sanity --test compile --python 3.8 [explain] failed with 2 errors:

lib/ansible/plugins/doc_fragments/aws_credentials.py:10:1: SyntaxError: DOCUMENTATION = r'''
lib/ansible/plugins/doc_fragments/aws_region.py:10:1: SyntaxError: DOCUMENTATION = r'''

The test ansible-test sanity --test pep8 [explain] failed with 6 errors:

lib/ansible/plugins/doc_fragments/aws_credentials.py:9:1: E115 expected an indented block (comment)
lib/ansible/plugins/doc_fragments/aws_credentials.py:10:1: E112 expected an indented block
lib/ansible/plugins/doc_fragments/aws_credentials.py:10:1: E305 expected 2 blank lines after class or function definition, found 1
lib/ansible/plugins/doc_fragments/aws_region.py:9:1: E115 expected an indented block (comment)
lib/ansible/plugins/doc_fragments/aws_region.py:10:1: E112 expected an indented block
lib/ansible/plugins/doc_fragments/aws_region.py:10:1: E305 expected 2 blank lines after class or function definition, found 1

The test ansible-test sanity --test yamllint [explain] failed with 2 errors:

lib/ansible/plugins/doc_fragments/aws_credentials.py:10:13: python-syntax-error expected an indented block (<unknown>, line 10)
lib/ansible/plugins/doc_fragments/aws_region.py:10:13: python-syntax-error expected an indented block (<unknown>, line 10)

click here for bot help

@ansibot ansibot added needs_revision and removed core_review labels Mar 6, 2019

@ansibot ansibot removed the ci_verified label Mar 8, 2019

@ansibot ansibot added core_review and removed needs_revision labels Mar 11, 2019

if config in direct:
value = direct[config]
else:
value = direct_aliases[0]

This comment has been minimized.

@bcoca

bcoca Mar 14, 2019

Member

won't you get an error when no aliases?

This comment has been minimized.

@s-hertel

s-hertel Mar 14, 2019

Author Contributor

I'm checking direct_aliases is truthy or config in direct above, so this shouldn't error.

This comment has been minimized.

@s-hertel

s-hertel Mar 14, 2019

Author Contributor

I could clarify with an elif if it helps readability, i.e.

            if direct and config in direct:
                value = direct[config]
            elif direct and direct_aliases:
                value = direct_aliases[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.