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

ec2_metadata_facts may fail with ansible-core 2.13+ #942

Closed
1 task done
cmbrad opened this issue Jul 26, 2022 · 2 comments · Fixed by #943
Closed
1 task done

ec2_metadata_facts may fail with ansible-core 2.13+ #942

cmbrad opened this issue Jul 26, 2022 · 2 comments · Fixed by #943
Labels
bug This issue/PR relates to a bug has_pr module module needs_triage plugins plugin (any type)

Comments

@cmbrad
Copy link
Contributor

cmbrad commented Jul 26, 2022

Summary

When using ansible-core 2.13+ (ansible 6.0.0+) ec2_metadata_facts may fail.

This occurs when an endpoint (such as http://169.254.169.254/latest/meta-data/public-keys/) is enumerated and results in endpoints that return 404. This occurs for public-keys specifically as the enumeration returns the name of the public key, but the name is not valid as an endpoint - just the ID.

A breaking change in fetch_url (https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/porting_guides/porting_guide_core_2.13.rst) means that URLs that return 404 now result in response.read being None, which results in fact fetching throwing an exception instead of returning None as it did in prior versions of ansible.

Issue Type

Bug Report

Component Name

ec2_metadata_facts

Ansible Version

$ ansible --version

ansible [core 2.13.2]
python version = 3.9.13 (main, Jul 20 2022, 13:16:06) [GCC 4.8.5 20150623 (Red Hat 4.8.5044)]
jinja version = 3.1.2
libyaml = True

Collection Versions

$ ansible-galaxy collection list

amazon.aws 3.3.1

AWS SDK versions

$ pip show boto boto3 botocore

boto3 = 1.24.33
botocore = 1.27.33
boto = 2.49.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

RHEL 7

Steps to Reproduce

- hosts: all
  tasks:
    - ec2_metadata_facts:

Expected Results

Return data successfully!

Actual Results

File ec2_metadata-facts.py, line 481 in _fetch
TypeError: 'NoneType' object is not callable

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link

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

@ansibullbot
Copy link

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module needs_triage plugins plugin (any type) labels Jul 26, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jul 27, 2022
ec2_metadata_facts - Fix read failure in ansible 2.13+

SUMMARY
Ansible 2.13+ changes the return conventions of fetch_url when an error occurs. Add a guard to prevent calling read which will be None.
Fixes #942
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_metadata_facts
ADDITIONAL INFORMATION

Reviewed-by: Vinay Dandekar <None>
Reviewed-by: Mark Chappell <None>
patchback bot pushed a commit that referenced this issue Sep 19, 2022
ec2_metadata_facts - Fix read failure in ansible 2.13+

SUMMARY
Ansible 2.13+ changes the return conventions of fetch_url when an error occurs. Add a guard to prevent calling read which will be None.
Fixes #942
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ec2_metadata_facts
ADDITIONAL INFORMATION

Reviewed-by: Vinay Dandekar <None>
Reviewed-by: Mark Chappell <None>
(cherry picked from commit 8f83de5)
patchback bot pushed a commit that referenced this issue Sep 19, 2022
ec2_metadata_facts - Fix read failure in ansible 2.13+

SUMMARY
Ansible 2.13+ changes the return conventions of fetch_url when an error occurs. Add a guard to prevent calling read which will be None.
Fixes #942
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ec2_metadata_facts
ADDITIONAL INFORMATION

Reviewed-by: Vinay Dandekar <None>
Reviewed-by: Mark Chappell <None>
(cherry picked from commit 8f83de5)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Sep 19, 2022
[PR #943/8f83de52 backport][stable-3] ec2_metadata_facts - Fix read failure in ansible 2.13+

This is a backport of PR #943 as merged into main (8f83de5).
SUMMARY
Ansible 2.13+ changes the return conventions of fetch_url when an error occurs. Add a guard to prevent calling read which will be None.
Fixes #942
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_metadata_facts
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell <None>
tremble pushed a commit that referenced this issue Sep 19, 2022
ec2_metadata_facts - Fix read failure in ansible 2.13+

SUMMARY
Ansible 2.13+ changes the return conventions of fetch_url when an error occurs. Add a guard to prevent calling read which will be None.
Fixes #942
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ec2_metadata_facts
ADDITIONAL INFORMATION

Reviewed-by: Vinay Dandekar <None>
Reviewed-by: Mark Chappell <None>

(cherry picked from commit 8f83de5)
tremble pushed a commit that referenced this issue Sep 19, 2022
ec2_metadata_facts - Fix read failure in ansible 2.13+

SUMMARY
Ansible 2.13+ changes the return conventions of fetch_url when an error occurs. Add a guard to prevent calling read which will be None.
Fixes #942
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ec2_metadata_facts
ADDITIONAL INFORMATION

Reviewed-by: Vinay Dandekar <None>
Reviewed-by: Mark Chappell <None>

(cherry picked from commit 8f83de5)

Co-authored-by: Christopher Bradley
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
New module aws_eks_fargate_profile

SUMMARY
(this is a copy of ansible-collections#941 because i messed up my original branch)
New Module - aws_eks_fargate_profile
This create a new module to manage fargate profiles in EKS clusters.
Requires: ansible-collections#651
ISSUE TYPE

New Module Pull Request

COMPONENT NAME
aws_eks_fargate_profile
ADDITIONAL INFORMATION
community.aws.aws_eks_fargate_profile
- name: create Fargate Profile 
  aws_eks_fargate_profile:
    name: 'my-profile'
    state: present
    cluster_name: 'my-eks-cluster'
    role_arn: 'arn:aws:iam::999999999999:role/eks-FargatePodExecutionRole'
    subnets:
        - subnet-aaaa1111
    selectors:
        - namespace: 'test_nm'
          labels:
              label1: test
    wait: true
    tags:
        env: test
        foo: bar

Reviewed-by: Markus Bergholz <git@osuv.de>
Reviewed-by: Mark Woolley <mw@marknet15.com>
Reviewed-by: None <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: Jill R <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
New module aws_eks_fargate_profile

SUMMARY
(this is a copy of ansible-collections#941 because i messed up my original branch)
New Module - aws_eks_fargate_profile
This create a new module to manage fargate profiles in EKS clusters.
Requires: ansible-collections#651
ISSUE TYPE

New Module Pull Request

COMPONENT NAME
aws_eks_fargate_profile
ADDITIONAL INFORMATION
community.aws.aws_eks_fargate_profile
- name: create Fargate Profile 
  aws_eks_fargate_profile:
    name: 'my-profile'
    state: present
    cluster_name: 'my-eks-cluster'
    role_arn: 'arn:aws:iam::999999999999:role/eks-FargatePodExecutionRole'
    subnets:
        - subnet-aaaa1111
    selectors:
        - namespace: 'test_nm'
          labels:
              label1: test
    wait: true
    tags:
        env: test
        foo: bar

Reviewed-by: Markus Bergholz <git@osuv.de>
Reviewed-by: Mark Woolley <mw@marknet15.com>
Reviewed-by: None <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: Jill R <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
New module aws_eks_fargate_profile

SUMMARY
(this is a copy of ansible-collections#941 because i messed up my original branch)
New Module - aws_eks_fargate_profile
This create a new module to manage fargate profiles in EKS clusters.
Requires: ansible-collections#651
ISSUE TYPE

New Module Pull Request

COMPONENT NAME
aws_eks_fargate_profile
ADDITIONAL INFORMATION
community.aws.aws_eks_fargate_profile
- name: create Fargate Profile 
  aws_eks_fargate_profile:
    name: 'my-profile'
    state: present
    cluster_name: 'my-eks-cluster'
    role_arn: 'arn:aws:iam::999999999999:role/eks-FargatePodExecutionRole'
    subnets:
        - subnet-aaaa1111
    selectors:
        - namespace: 'test_nm'
          labels:
              label1: test
    wait: true
    tags:
        env: test
        foo: bar

Reviewed-by: Markus Bergholz <git@osuv.de>
Reviewed-by: Mark Woolley <mw@marknet15.com>
Reviewed-by: None <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: Jill R <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module module needs_triage plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants