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

rds_instance fails with type error when optional storage params not set #1443

Closed
1 task done
zaepho opened this issue Mar 24, 2023 · 3 comments
Closed
1 task done

Comments

@zaepho
Copy link
Contributor

zaepho commented Mar 24, 2023

Summary

When trying to update an AWS RDS Instance without setting any storage parameters, results in a TypeError Exception.

"Traceback (most recent call last):\n File "/home/runner/.ansible/tmp/ansible-tmp-1679518518.4951844-70-202176230274494/AnsiballZ_rds_instance.py", line 107, in \n _ansiballz_main()\n File "/home/runner/.ansible/tmp/ansible-tmp-1679518518.4951844-70-202176230274494/AnsiballZ_rds_instance.py", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/home/runner/.ansible/tmp/ansible-tmp-1679518518.4951844-70-202176230274494/AnsiballZ_rds_instance.py", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.rds_instance', init_globals=dict(_module_fqn='ansible_collections.amazon.aws.plugins.modules.rds_instance', _modlib_path=modlib_path),\n File "/usr/lib64/python3.9/runpy.py", line 225, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code\n exec(code, run_globals)\n File "/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py", line 1476, in \n File "/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py", line 1433, in main\n File "/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py", line 977, in get_parameters\n File "/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py", line 1037, in get_options_with_changing_values\nTypeError: '>=' not supported between instances of 'NoneType' and 'int'\n",

Issue Type

Bug Report

Component Name

rds_instance

Ansible Version

ansible-playbook [core 2.13.6]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/requirements_collections:/home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-playbook
  python version = 3.9.13 (main, Nov  9 2022, 13:16:24) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)]
  jinja version = 3.0.3
  libyaml = True

Collection Versions

"stdout_lines": [
      "",
      "# /runner/requirements_collections/ansible_collections",
      "Collection         Version",
      "------------------ -------",
      "amazon.aws         5.3.0  ",
      "ansible.controller 4.2.1  ",
      "ansible.windows    1.13.0 ",
      "community.aws      5.2.0  ",
      "community.general  6.4.0  ",
      "community.windows  1.12.0 ",
      "",
      "# /usr/share/ansible/collections/ansible_collections",
      "Collection              Version",
      "----------------------- -------",
      "amazon.aws              5.2.0  ",
      "ansible.controller      4.2.1  ",
      "ansible.netcommon       3.1.1  ",
      "ansible.network         1.2.0  ",
      "ansible.posix           1.3.0  ",
      "ansible.security        1.0.0  ",
      "ansible.utils           2.6.1  ",
      "ansible.windows         1.9.0  ",
      "ansible.yang            1.0.0  ",
      "arista.eos              5.0.0  ",
      "chocolatey.chocolatey   1.4.0  ",
      "cisco.asa               3.0.0  ",
      "cisco.ios               3.0.0  ",
      "cisco.iosxr             3.0.0  ",
      "cisco.nxos              3.0.0  ",
      "cloud.common            2.1.1  ",
      "community.aws           5.2.0  ",
      "community.crypto        2.10.0 ",
      "community.general       6.3.0  ",
      "community.postgresql    2.3.2  ",
      "community.vmware        3.3.0  ",
      "community.windows       1.12.0 ",
      "frr.frr                 2.0.0  ",
      "ibm.qradar              2.0.0  ",
      "junipernetworks.junos   3.0.0  ",
      "kubernetes.core         2.2.3  ",
      "openvswitch.openvswitch 2.1.0  ",
      "redhat.insights         1.0.7  ",
      "redhat.openshift        2.1.0  ",
      "redhat.rhv              1.6.5  ",
      "redhat.satellite        3.3.0  ",
      "servicenow.itsm         1.3.3  ",
      "splunk.es               2.0.0  ",
      "trendmicro.deepsec      2.0.0  ",
      "vmware.vmware_rest      2.1.5  ",
      "vyos.vyos               3.0.0  "
    ],

AWS SDK versions

"stdout_lines": [
      "Name: boto",
      "Version: 2.49.0",
      "Summary: Amazon Web Services Library",
      "Home-page: https://github.com/boto/boto/",
      "Author: Mitch Garnaat",
      "Author-email: mitch@garnaat.com",
      "License: MIT",
      "Location: /usr/local/lib/python3.9/site-packages",
      "Requires: ",
      "Required-by: ",
      "---",
      "Name: boto3",
      "Version: 1.26.68",
      "Summary: The AWS SDK for Python",
      "Home-page: https://github.com/boto/boto3",
      "Author: Amazon Web Services",
      "Author-email: None",
      "License: Apache License 2.0",
      "Location: /usr/local/lib/python3.9/site-packages",
      "Requires: s3transfer, jmespath, botocore",
      "Required-by: ",
      "---",
      "Name: botocore",
      "Version: 1.29.68",
      "Summary: Low-level, data-driven core of boto 3.",
      "Home-page: https://github.com/boto/botocore",
      "Author: Amazon Web Services",
      "Author-email: None",
      "License: Apache License 2.0",
      "Location: /usr/local/lib/python3.9/site-packages",
      "Requires: python-dateutil, jmespath, urllib3",
      "Required-by: s3transfer, boto3"
    ],

Configuration

"stdout_lines": [
      "\u001b[0;33mANSIBLE_FORCE_COLOR(env: ANSIBLE_FORCE_COLOR) = True\u001b[0m",
      "\u001b[0;33mCOLLECTIONS_PATHS(env: ANSIBLE_COLLECTIONS_PATHS) = ['/runner/requirements_collections', '/home/runner/.ansible/collections', '/usr/share/ansible/collections']\u001b[0m",
      "\u001b[0;33mDEFAULT_CALLBACK_PLUGIN_PATH(env: ANSIBLE_CALLBACK_PLUGINS) = ['/runner/artifacts/18711/callback']\u001b[0m",
      "\u001b[0;33mDEFAULT_ROLES_PATH(env: ANSIBLE_ROLES_PATH) = ['/runner/requirements_roles', '/runner/project/roles', '/home/runner/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles']\u001b[0m",
      "\u001b[0;33mDEFAULT_STDOUT_CALLBACK(env: ANSIBLE_STDOUT_CALLBACK) = awx_display\u001b[0m",
      "\u001b[0;33mHOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False\u001b[0m",
      "\u001b[0;33mINVENTORY_UNPARSED_IS_FAILED(env: ANSIBLE_INVENTORY_UNPARSED_FAILED) = True\u001b[0m",
      "\u001b[0;33mRETRY_FILES_ENABLED(env: ANSIBLE_RETRY_FILES_ENABLED) = False\u001b[0m"
    ],

OS / Environment

No response

Steps to Reproduce

    - name: Get RDS Instance Info
      amazon.aws.rds_instance_info:
        aws_access_key: "{{ assumed_role.sts_creds.access_key }}"
        aws_secret_key: "{{ assumed_role.sts_creds.secret_key }}"
        session_token: "{{ assumed_role.sts_creds.session_token }}"
        db_instance_identifier: "{{ hostvars[inventory_hostname].db_instance_identifier }}"
        region: "{{ hostvars[inventory_hostname].region }}"
      delegate_to: localhost
      connection: local
      register: rds_info

    - name: Apply Tag to Instance
      amazon.aws.rds_instance:
        access_key: "{{ assumed_role.sts_creds.access_key }}"
        secret_key: "{{ assumed_role.sts_creds.secret_key }}"
        session_token: "{{ assumed_role.sts_creds.session_token }}"
        db_instance_identifier: "{{ hostvars[inventory_hostname].db_instance_identifier }}"
        region: "{{ hostvars[inventory_hostname].region }}"
        state: present
        purge_tags: false
        tags:
          parking_exempt: "false"
      delegate_to: localhost
      connection: local
      register: apply_parkingexempt_tag

Expected Results

AWS RDS Instance tag parking_exempt exists with the value "false"

Actual Results

{
  "module_stdout": "",
  "module_stderr": "Traceback (most recent call last):\n  File \"/home/runner/.ansible/tmp/ansible-tmp-1679518518.4951844-70-202176230274494/AnsiballZ_rds_instance.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/runner/.ansible/tmp/ansible-tmp-1679518518.4951844-70-202176230274494/AnsiballZ_rds_instance.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/runner/.ansible/tmp/ansible-tmp-1679518518.4951844-70-202176230274494/AnsiballZ_rds_instance.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.rds_instance', init_globals=dict(_module_fqn='ansible_collections.amazon.aws.plugins.modules.rds_instance', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py\", line 1476, in <module>\n  File \"/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py\", line 1433, in main\n  File \"/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py\", line 977, in get_parameters\n  File \"/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py\", line 1037, in get_options_with_changing_values\nTypeError: '>=' not supported between instances of 'NoneType' and 'int'\n",
  "exception": "Traceback (most recent call last):\n  File \"/home/runner/.ansible/tmp/ansible-tmp-1679518518.4951844-70-202176230274494/AnsiballZ_rds_instance.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/runner/.ansible/tmp/ansible-tmp-1679518518.4951844-70-202176230274494/AnsiballZ_rds_instance.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/runner/.ansible/tmp/ansible-tmp-1679518518.4951844-70-202176230274494/AnsiballZ_rds_instance.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.rds_instance', init_globals=dict(_module_fqn='ansible_collections.amazon.aws.plugins.modules.rds_instance', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py\", line 1476, in <module>\n  File \"/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py\", line 1433, in main\n  File \"/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py\", line 977, in get_parameters\n  File \"/tmp/ansible_amazon.aws.rds_instance_payload_u6xcndjt/ansible_amazon.aws.rds_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/rds_instance.py\", line 1037, in get_options_with_changing_values\nTypeError: '>=' not supported between instances of 'NoneType' and 'int'\n",
  "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
  "rc": 1,
  "_ansible_no_log": null,
  "changed": false,
  "_ansible_delegated_vars": {
    "ansible_host": "localhost",
    "ansible_port": null,
    "ansible_user": "root",
    "ansible_connection": "local"
  }
}

Code of Conduct

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

tremble commented Mar 24, 2023

I suspect this will be fixed by #1437 if possible could you try that code.

@tremble
Copy link
Contributor

tremble commented Mar 27, 2023

amazon.aws 5.4.0 has just been released and is believed to fix this issue.

Please beware: the the output of ansible-galaxy list indicates that there are multiple copies of the collection installed. Under certain circumstances it's possible for the old version to be used by default.

@tremble tremble closed this as completed Mar 27, 2023
@zaepho
Copy link
Contributor Author

zaepho commented Mar 27, 2023

This is in fact resolved by 5.4.0. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants