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

lambda_info - only queries config info when function_name is omitted #1151

Closed
1 task done
jatorcasso opened this issue May 19, 2022 · 2 comments · Fixed by #1152
Closed
1 task done

lambda_info - only queries config info when function_name is omitted #1151

jatorcasso opened this issue May 19, 2022 · 2 comments · Fixed by #1152
Assignees
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type) python3

Comments

@jatorcasso
Copy link
Contributor

Summary

When trying to retrieve info on all lambda functions (by omitting function_name), module acts as if query = config

Issue Type

Bug Report

Component Name

lambda_info

Ansible Version

$ ansible --version

Collection Versions

$ ansible-galaxy collection list

AWS SDK versions

$ pip show boto boto3 botocore

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

  # Query the Lambda
  - name: lambda_info | Gather all infos for all lambda functions
    lambda_info:
    register: lambda_infos_all
    check_mode: yes
  - name: lambda_info | Assert successfull retrieval of all information
    assert:
      that:
      - lambda_infos_all | length > 0
      - lambda_infos_all is not failed
      - lambda_infos_all.function[lambda_function_name].function_name == lambda_function_name
      - lambda_infos_all.function[lambda_function_name].runtime == "python3.6"
      - lambda_infos_all.function[lambda_function_name].versions is defined
      - lambda_infos_all.function[lambda_function_name].aliases is defined
      - lambda_infos_all.function[lambda_function_name].policy is defined
      - lambda_infos_all.function[lambda_function_name].mappings is defined
      - lambda_infos_all.function[lambda_function_name].description == ""
      - lambda_infos_all.function[lambda_function_name].function_arn is defined
      - lambda_infos_all.function[lambda_function_name].handler == "mini_lambda.handler"
      - lambda_infos_all.function[lambda_function_name].tags is defined

Expected Results

"function": {
        "70f9dc46f894": {
            "aliases": [],
            "code_sha256": "LC/DkOB9wKYLWMSMqYoGPw8yyXUVHcDcdShg/MUKyYM=",
            "code_size": 854,
            "description": "",
            "function_arn": "arn:aws:lambda:us-east-1:721066863947:function:70f9dc46f894",
            "function_name": "70f9dc46f894",
            "handler": "mini_lambda.handler",
            "last_modified": "2022-05-19T19:46:15.375+0000",
            "mappings": [],
            "memory_size": 128,
            "package_type": "Zip",
            "policy": {},
            "response_metadata": {
                "http_headers": {
                    "connection": "keep-alive",
                    "content-length": "986",
                    "content-type": "application/json",
                    "date": "Thu, 19 May 2022 19:46:18 GMT",
                    "x-amzn-requestid": "0b50adea-e1ed-4f25-975f-f0eec9478282"
                },
                "http_status_code": 200,
                "request_id": "0b50adea-e1ed-4f25-975f-f0eec9478282",
                "retry_attempts": 0
            },
            "revision_id": "20bbfe78-8589-46ca-8fb3-6ff089ea7bab",
            "role": "arn:aws:iam::721066863947:role/ansible-test-70f9dc46f894-lambda",
            "runtime": "python3.6",
            "state": "Pending",
            "state_reason": "The function is being created.",
            "state_reason_code": "Creating",
            "tags": {},
            "timeout": 3,
            "tracing_config": {
                "mode": "PassThrough"
            },
            "version": "$LATEST",
            "versions": [
                {
                    "code_sha256": "LC/DkOB9wKYLWMSMqYoGPw8yyXUVHcDcdShg/MUKyYM=",
                    "code_size": 854,
                    "description": "",
                    "function_arn": "arn:aws:lambda:us-east-1:721066863947:function:70f9dc46f894:$LATEST",
                    "function_name": "70f9dc46f894",
                    "handler": "mini_lambda.handler",
                    "last_modified": "2022-05-19T19:46:15.375+0000",
                    "memory_size": 128,
                    "package_type": "Zip",
                    "revision_id": "20bbfe78-8589-46ca-8fb3-6ff089ea7bab",
                    "role": "arn:aws:iam::721066863947:role/ansible-test-70f9dc46f894-lambda",
                    "runtime": "python3.6",
                    "timeout": 3,
                    "tracing_config": {
                        "mode": "PassThrough"
                    },
                    "version": "$LATEST"
                },
                {
                    "code_sha256": "LC/DkOB9wKYLWMSMqYoGPw8yyXUVHcDcdShg/MUKyYM=",
                    "code_size": 854,
                    "description": "",
                    "function_arn": "arn:aws:lambda:us-east-1:721066863947:function:70f9dc46f894:1",
                    "function_name": "70f9dc46f894",
                    "handler": "mini_lambda.handler",
                    "last_modified": "2022-05-19T19:46:15.375+0000",
                    "memory_size": 128,
                    "package_type": "Zip",
                    "revision_id": "23d33d24-983b-47e2-92cd-142bc18b1833",
                    "role": "arn:aws:iam::721066863947:role/ansible-test-70f9dc46f894-lambda",
                    "runtime": "python3.6",
                    "timeout": 3,
                    "tracing_config": {
                        "mode": "PassThrough"
                    },
                    "version": "1"
                }
            ]
        }

Actual Results

    "function": {
        "7a603343767f": {
            "code_sha256": "HcAK+Oux100a8L18ww1SdRC1NgwU4CTn0RHIj65dHO4=",
            "code_size": 854,
            "description": "",
            "function_arn": "arn:aws:lambda:us-east-1:721066863947:function:7a603343767f",
            "function_name": "7a603343767f",
            "handler": "mini_lambda.handler",
            "last_modified": "2022-05-19T19:59:25.000+0000",
            "memory_size": 128,
            "package_type": "Zip",
            "revision_id": "d1d89e30-797d-453f-92ae-efc1f6ab7c34",
            "role": "arn:aws:iam::721066863947:role/ansible-test-7a603343767f-lambda",
            "runtime": "python3.6",
            "tags": {
                "camel_case": "ACamelCaseValue",
                "snake_case": "a_snake_case_value",
                "spaced key": "A value with spaces"
            },
            "timeout": 3,
            "tracing_config": {
                "mode": "PassThrough"
            },
            "version": "$LATEST"
        }

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@jatorcasso jatorcasso self-assigned this May 19, 2022
@jatorcasso jatorcasso changed the title lambda_info lambda_info - only queries config info when function_name is omitted May 19, 2022
@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 plugins plugin (any type) python3 labels May 19, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jun 1, 2022
lambda_info - refactor to fix bug when querying all lambdas

Depends-On: ansible/ansible-zuul-jobs#1558
SUMMARY

Fix bug that forces query: config when getting info for all lambdas. Refactored to return the expected info
Add extra cleanup at end of tests

Fixes #1151
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
lambda_info
ADDITIONAL INFORMATION
This module also currently returns a dict of dicts (as opposed to a list of dicts), but I wanted to keep the scope of this PR to fixing the bug.

Reviewed-by: Mark Chappell <None>
Reviewed-by: Joseph Torcasso <None>
Reviewed-by: Jill R <None>
patchback bot pushed a commit that referenced this issue Jun 1, 2022
lambda_info - refactor to fix bug when querying all lambdas

Depends-On: ansible/ansible-zuul-jobs#1558
SUMMARY

Fix bug that forces query: config when getting info for all lambdas. Refactored to return the expected info
Add extra cleanup at end of tests

Fixes #1151
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
lambda_info
ADDITIONAL INFORMATION
This module also currently returns a dict of dicts (as opposed to a list of dicts), but I wanted to keep the scope of this PR to fixing the bug.

Reviewed-by: Mark Chappell <None>
Reviewed-by: Joseph Torcasso <None>
Reviewed-by: Jill R <None>
(cherry picked from commit 0c76aed)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jun 3, 2022
…1188)

[PR #1152/0c76aedd backport][stable-3] lambda_info - refactor to fix bug when querying all lambdas

This is a backport of PR #1152 as merged into main (0c76aed).
Depends-On: ansible/ansible-zuul-jobs#1558
SUMMARY

Fix bug that forces query: config when getting info for all lambdas. Refactored to return the expected info
Add extra cleanup at end of tests

Fixes #1151
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
lambda_info
ADDITIONAL INFORMATION
This module also currently returns a dict of dicts (as opposed to a list of dicts), but I wanted to keep the scope of this PR to fixing the bug.

Reviewed-by: Mark Chappell <None>
abikouo pushed a commit to abikouo/community.aws that referenced this issue Oct 24, 2023
…collections#1152)

lambda_info - refactor to fix bug when querying all lambdas

Depends-On: ansible/ansible-zuul-jobs#1558
SUMMARY

Fix bug that forces query: config when getting info for all lambdas. Refactored to return the expected info
Add extra cleanup at end of tests

Fixes ansible-collections#1151
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
lambda_info
ADDITIONAL INFORMATION
This module also currently returns a dict of dicts (as opposed to a list of dicts), but I wanted to keep the scope of this PR to fixing the bug.

Reviewed-by: Mark Chappell <None>
Reviewed-by: Joseph Torcasso <None>
Reviewed-by: Jill R <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections@0c76aed
abikouo pushed a commit to abikouo/community.aws that referenced this issue Oct 24, 2023
…n if None (ansible-collections#1151)

ec2_instance - update build_run_instance_spec to skip TagSpecification if None

SUMMARY
fixes: ansible-collections#1148
When no tags are supplied, build_run_instance_spec currently includes 'TagSpecification': None.  This results in botocore throwing an exception.
Also renames instance_role to iam_instance_profile (keeping the original as an alias).  While this could be split off, I'll just perform a partial backport for the bugfix when backporting to 4.x, while working through some unit tests the inaccuracy of the parameter name was apparent.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/ec2_instance.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Gonéri Le Bouder <[email protected]>
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 module module plugins plugin (any type) python3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants