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

module fails with TypeError: a bytes-like object is required, not 'str' #332

Closed
rituparnop opened this issue Apr 20, 2021 · 5 comments
Closed
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type) python3

Comments

@rituparnop
Copy link

rituparnop commented Apr 20, 2021

SUMMARY

This issue is there for 2-3 years now I guess. There is an issue with Boto "connection.py" for SSL Proxy with string headers (suppose to be encoded). As "amazon.aws" uses boto and not boto3 (like community.aws) so its fails in env where SSL Proxy enabled.
Refer below issue links.
ansible-collections/community.aws#313

boto/boto#3699
boto/boto#2718

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ec2_vol

ANSIBLE VERSION
ansible 2.10.8
  config file = None
  configured module search path = ['/home/ansible_runner_users/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/venv/lib/python3.7/site-packages/ansible
  executable location = /opt/venv/bin/ansible
  python version = 3.7.7 (default, Apr 30 2020, 09:28:25) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

CONFIGURATION
DEFAULT_GATHERING(env: ANSIBLE_GATHERING) = explicit
OS / ENVIRONMENT

RedHat UBI image for Docker "Linux 83b33a6a8c4c 4.18.0-240.15.1.el8_3.x86_64" running ansible 2.10

STEPS TO REPRODUCE
---
- name: use manage disk role playbook
  hosts: localhost
  vars:
    proxy_env:
      http_proxy: "{{ lookup('env', 'HTTP_PROXY') | default('', True) }}"
      https_proxy: "{{ lookup('env', 'HTTPS_PROXY') | default('', True) }}"
  gather_facts: no
  tasks:
      - name: Add disk to vm
        amazon.aws.ec2_vol:
          aws_access_key: "{{ AWS_ACCESS_KEY_ID }}"
          aws_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}"
          instance: "{{ instance_id }}"
          region: "{{ region }}"
          device_name: "{{ device_name }}"
          volume_size: "{{ volume_size }}"
          delete_on_termination: "{{ delete_on_termination }}"
        environment: "{{ proxy_env }}"
EXPECTED RESULTS

Volume attached

ACTUAL RESULTS

Module failing to connect via proxy with below message.

connection.py", line 796, in proxy_ssl, sock.sendall("CONNECT %s HTTP/1.0\r\n" % host), TypeError: a bytes-like object is required, not 'str',
@ansibullbot
Copy link

Files identified in the description:
None

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 ansibullbot added bug This issue/PR relates to a bug needs_triage python3 labels Apr 20, 2021
@tremble
Copy link
Contributor

tremble commented Apr 20, 2021

The latest version of the collection includes a migration of ec2_vol to boto3 instead of boto. Please would you try version 1.4.0 of the collection.

@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 module module plugins plugin (any type) and removed needs_triage labels Apr 20, 2021
@rituparnop
Copy link
Author

Upgrading to the latest ansible version 3.2.0 resolved the issue. Thanks

alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 16, 2022
ec2_eip tagging support

SUMMARY
Add support for tagging EIPs on creation.
Todo:

 EIP Tagging
 Tests
 Retry decorator

Note: While it's now possible to pass tagging information into the association call this was only added Dec 2020 so won't work for most folks.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_eip
ec2_eip_info
ADDITIONAL INFORMATION
fixes: ansible-collections#331

Reviewed-by: Rick Mendes <None>
Reviewed-by: None <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@02836f3
goneri pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 21, 2022
ec2_eip tagging support

SUMMARY
Add support for tagging EIPs on creation.
Todo:

 EIP Tagging
 Tests
 Retry decorator

Note: While it's now possible to pass tagging information into the association call this was only added Dec 2020 so won't work for most folks.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_eip
ec2_eip_info
ADDITIONAL INFORMATION
fixes: ansible-collections#331

Reviewed-by: Rick Mendes <None>
Reviewed-by: None <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@02836f3
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
ec2_eip tagging support

SUMMARY
Add support for tagging EIPs on creation.
Todo:

 EIP Tagging
 Tests
 Retry decorator

Note: While it's now possible to pass tagging information into the association call this was only added Dec 2020 so won't work for most folks.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_eip
ec2_eip_info
ADDITIONAL INFORMATION
fixes: ansible-collections#331

Reviewed-by: Rick Mendes <None>
Reviewed-by: None <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
ec2_eip tagging support

SUMMARY
Add support for tagging EIPs on creation.
Todo:

 EIP Tagging
 Tests
 Retry decorator

Note: While it's now possible to pass tagging information into the association call this was only added Dec 2020 so won't work for most folks.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_eip
ec2_eip_info
ADDITIONAL INFORMATION
fixes: ansible-collections#331

Reviewed-by: Rick Mendes <None>
Reviewed-by: None <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
ec2_eip tagging support

SUMMARY
Add support for tagging EIPs on creation.
Todo:

 EIP Tagging
 Tests
 Retry decorator

Note: While it's now possible to pass tagging information into the association call this was only added Dec 2020 so won't work for most folks.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_eip
ec2_eip_info
ADDITIONAL INFORMATION
fixes: ansible-collections#331

Reviewed-by: Rick Mendes <None>
Reviewed-by: None <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 module module plugins plugin (any type) python3
Projects
None yet
Development

No branches or pull requests

3 participants