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

Route53 module no longer supports 0 weights #1378

Closed
1 task done
wp-davisona opened this issue Aug 1, 2022 · 2 comments · Fixed by #1379
Closed
1 task done

Route53 module no longer supports 0 weights #1378

wp-davisona opened this issue Aug 1, 2022 · 2 comments · Fixed by #1379
Labels
bug This issue/PR relates to a bug module module needs_triage plugins plugin (any type) python3

Comments

@wp-davisona
Copy link
Contributor

Summary

When trying to create a Route53 DNS record with a weight of 0, I receive the error:

"You have specified identifier which makes sense only if you specify one of: weight, region, geo_location or failover."

This appears to have been caused by this commit:

59f06ed#diff-39a0039c8f787ef918e13c9e34de717b42890a4baada9448cd80a76242bffee4L570-R632

this is changing the weight comparison from weight_in is None to not any([weight_in....
A weight of zero returns false to the first comparison, but true to the latter.

Issue Type

Bug Report

Component Name

route53

Ansible Version

ansible [core 2.13.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/centos/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/centos/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.13 (default, Jul 26 2022, 16:15:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
  jinja version = 3.1.2
  libyaml = True

Collection Versions

Collection                    Version
----------------------------- -------
amazon.aws                    3.3.1
ansible.netcommon             3.0.1
ansible.posix                 1.4.0
ansible.utils                 2.6.1
ansible.windows               1.10.0
arista.eos                    5.0.1
awx.awx                       21.2.0
azure.azcollection            1.13.0
check_point.mgmt              2.3.0
chocolatey.chocolatey         1.3.0
cisco.aci                     2.2.0
cisco.asa                     3.1.0
cisco.dnac                    6.5.0
cisco.intersight              1.0.19
cisco.ios                     3.2.0
cisco.iosxr                   3.2.0
cisco.ise                     2.5.0
cisco.meraki                  2.10.0
cisco.mso                     2.0.0
cisco.nso                     1.0.3
cisco.nxos                    3.1.0
cisco.ucs                     1.8.0
cloud.common                  2.1.2
cloudscale_ch.cloud           2.2.2
community.aws                 3.4.0
community.azure               1.1.0
community.ciscosmb            1.0.5
community.crypto              2.4.0
community.digitalocean        1.21.0
community.dns                 2.2.1
community.docker              2.7.0
community.fortios             1.0.0
community.general             5.3.0
community.google              1.0.0
community.grafana             1.5.0
community.hashi_vault         3.0.0
community.hrobot              1.4.0
community.libvirt             1.1.0
community.mongodb             1.4.1
community.mysql               3.3.0
community.network             4.0.1
community.okd                 2.2.0
community.postgresql          2.1.5
community.proxysql            1.4.0
community.rabbitmq            1.2.1
community.routeros            2.1.0
community.sap                 1.0.0
community.sap_libs            1.1.0
community.skydive             1.0.0
community.sops                1.2.3
community.vmware              2.7.0
community.windows             1.10.0
community.zabbix              1.7.0
containers.podman             1.9.4
cyberark.conjur               1.1.0
cyberark.pas                  1.0.14
dellemc.enterprise_sonic      1.1.1
dellemc.openmanage            5.5.0
dellemc.os10                  1.1.1
dellemc.os6                   1.0.7
dellemc.os9                   1.0.4
f5networks.f5_modules         1.18.0
fortinet.fortimanager         2.1.5
fortinet.fortios              2.1.6
frr.frr                       2.0.0
gluster.gluster               1.0.2
google.cloud                  1.0.2
hetzner.hcloud                1.8.1
hpe.nimble                    1.1.4
ibm.qradar                    2.0.0
infinidat.infinibox           1.3.3
infoblox.nios_modules         1.3.0
inspur.sm                     2.0.0
junipernetworks.junos         3.1.0
kubernetes.core               2.3.2
mellanox.onyx                 1.0.0
netapp.aws                    21.7.0
netapp.azure                  21.10.0
netapp.cloudmanager           21.18.0
netapp.elementsw              21.7.0
netapp.ontap                  21.20.0
netapp.storagegrid            21.10.0
netapp.um_info                21.8.0
netapp_eseries.santricity     1.3.0
netbox.netbox                 3.7.1
ngine_io.cloudstack           2.2.4
ngine_io.exoscale             1.0.0
ngine_io.vultr                1.1.2
openstack.cloud               1.8.0
openvswitch.openvswitch       2.1.0
ovirt.ovirt                   2.1.0
purestorage.flasharray        1.13.0
purestorage.flashblade        1.9.0
purestorage.fusion            1.0.2
sensu.sensu_go                1.13.1
servicenow.servicenow         1.0.6
splunk.es                     2.0.0
t_systems_mms.icinga_director 1.30.0
theforeman.foreman            3.4.0
vmware.vmware_rest            2.2.0
vyos.vyos                     3.0.1
wti.remote                    1.0.4

AWS SDK versions

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

Configuration

[DEPRECATION WARNING]: [defaults]callback_whitelist option, normalizing names to new standard, use callbacks_enabled instead.
This feature will be removed from ansible-core in version 2.15. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
CALLBACKS_ENABLED(/etc/ansible/ansible.cfg) = ['profile_tasks']
DEFAULT_GATHERING(/etc/ansible/ansible.cfg) = smart
DEFAULT_GATHER_TIMEOUT(/etc/ansible/ansible.cfg) = 60
DEFAULT_HASH_BEHAVIOUR(/etc/ansible/ansible.cfg) = merge

OS / Environment

CentOS 7 and Mac OS 12.5

Steps to Reproduce

- name: Bug demo
  hosts: localhost
  tasks:
    - name: Set 0 weight for old env
      route53:
        wait: yes
        ttl: '5'
        type: 'CNAME'
        identifier: old
        overwrite: yes
        record: 'record.example.com.'
        zone: 'example.com.'
        value: 'record-old.example.com.'
        weight: '0'
        state: present

Expected Results

I expect the DNS record to be created with a weight of zero.

Actual Results

TASK [Set 0 weight for old env] ***********************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "You have specified identifier which makes sense only if you specify one of: weight, region, geo_location or failover."}

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) python3 labels Aug 1, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Aug 2, 2022
route53: Restore support for zero weighted DNS records

SUMMARY
In #1117 (comment) and https://github.com/ansible-collections/community.aws/pull/1117/files#r869391659 this line was recommended to be simplified, but not any will also return true if weight_in has a value of 0, not only when it is None
Fixes #1378
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
route53
ADDITIONAL INFORMATION


Previously it was possible to create weighted records with a weight of 0. Currently the playbook below returns the error:
You have specified identifier which makes sense only if you specify one of: weight, region, geo_location or failover.


- name: Bug demo
  hosts: localhost
  tasks:
    - name: Set 0 weight for old env
      route53:
        wait: yes
        ttl: '5'
        type: 'CNAME'
        identifier: old
        overwrite: yes
        record: 'record.example.com.'
        zone: 'example.com.'
        value: 'record-old.example.com.'
        weight: '0'
        state: present

Reviewed-by: Mark Chappell <None>
patchback bot pushed a commit that referenced this issue Aug 2, 2022
route53: Restore support for zero weighted DNS records

SUMMARY
In #1117 (comment) and https://github.com/ansible-collections/community.aws/pull/1117/files#r869391659 this line was recommended to be simplified, but not any will also return true if weight_in has a value of 0, not only when it is None
Fixes #1378
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
route53
ADDITIONAL INFORMATION

Previously it was possible to create weighted records with a weight of 0. Currently the playbook below returns the error:
You have specified identifier which makes sense only if you specify one of: weight, region, geo_location or failover.

- name: Bug demo
  hosts: localhost
  tasks:
    - name: Set 0 weight for old env
      route53:
        wait: yes
        ttl: '5'
        type: 'CNAME'
        identifier: old
        overwrite: yes
        record: 'record.example.com.'
        zone: 'example.com.'
        value: 'record-old.example.com.'
        weight: '0'
        state: present

Reviewed-by: Mark Chappell <None>
(cherry picked from commit 9195021)
patchback bot pushed a commit that referenced this issue Aug 2, 2022
route53: Restore support for zero weighted DNS records

SUMMARY
In #1117 (comment) and https://github.com/ansible-collections/community.aws/pull/1117/files#r869391659 this line was recommended to be simplified, but not any will also return true if weight_in has a value of 0, not only when it is None
Fixes #1378
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
route53
ADDITIONAL INFORMATION

Previously it was possible to create weighted records with a weight of 0. Currently the playbook below returns the error:
You have specified identifier which makes sense only if you specify one of: weight, region, geo_location or failover.

- name: Bug demo
  hosts: localhost
  tasks:
    - name: Set 0 weight for old env
      route53:
        wait: yes
        ttl: '5'
        type: 'CNAME'
        identifier: old
        overwrite: yes
        record: 'record.example.com.'
        zone: 'example.com.'
        value: 'record-old.example.com.'
        weight: '0'
        state: present

Reviewed-by: Mark Chappell <None>
(cherry picked from commit 9195021)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Aug 2, 2022
[PR #1379/9195021f backport][stable-4] route53: Restore support for zero weighted DNS records

This is a backport of PR #1379 as merged into main (9195021).
SUMMARY
In #1117 (comment) and https://github.com/ansible-collections/community.aws/pull/1117/files#r869391659 this line was recommended to be simplified, but not any will also return true if weight_in has a value of 0, not only when it is None
Fixes #1378
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
route53
ADDITIONAL INFORMATION


Previously it was possible to create weighted records with a weight of 0. Currently the playbook below returns the error:
You have specified identifier which makes sense only if you specify one of: weight, region, geo_location or failover.


- name: Bug demo
  hosts: localhost
  tasks:
    - name: Set 0 weight for old env
      route53:
        wait: yes
        ttl: '5'
        type: 'CNAME'
        identifier: old
        overwrite: yes
        record: 'record.example.com.'
        zone: 'example.com.'
        value: 'record-old.example.com.'
        weight: '0'
        state: present

Reviewed-by: Mark Chappell <None>
softwarefactory-project-zuul bot pushed a commit that referenced this issue Aug 2, 2022
[PR #1379/9195021f backport][stable-3] route53: Restore support for zero weighted DNS records

This is a backport of PR #1379 as merged into main (9195021).
SUMMARY
In #1117 (comment) and https://github.com/ansible-collections/community.aws/pull/1117/files#r869391659 this line was recommended to be simplified, but not any will also return true if weight_in has a value of 0, not only when it is None
Fixes #1378
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
route53
ADDITIONAL INFORMATION


Previously it was possible to create weighted records with a weight of 0. Currently the playbook below returns the error:
You have specified identifier which makes sense only if you specify one of: weight, region, geo_location or failover.


- name: Bug demo
  hosts: localhost
  tasks:
    - name: Set 0 weight for old env
      route53:
        wait: yes
        ttl: '5'
        type: 'CNAME'
        identifier: old
        overwrite: yes
        record: 'record.example.com.'
        zone: 'example.com.'
        value: 'record-old.example.com.'
        weight: '0'
        state: present

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

route53: Restore support for zero weighted DNS records

SUMMARY
In ansible-collections#1117 (comment) and https://github.com/ansible-collections/community.aws/pull/1117/files#r869391659 this line was recommended to be simplified, but not any will also return true if weight_in has a value of 0, not only when it is None
Fixes ansible-collections#1378
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
route53
ADDITIONAL INFORMATION

Previously it was possible to create weighted records with a weight of 0. Currently the playbook below returns the error:
You have specified identifier which makes sense only if you specify one of: weight, region, geo_location or failover.

- name: Bug demo
  hosts: localhost
  tasks:
    - name: Set 0 weight for old env
      route53:
        wait: yes
        ttl: '5'
        type: 'CNAME'
        identifier: old
        overwrite: yes
        record: 'record.example.com.'
        zone: 'example.com.'
        value: 'record-old.example.com.'
        weight: '0'
        state: present

Reviewed-by: Mark Chappell <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections@9195021
abikouo pushed a commit to abikouo/community.aws that referenced this issue Oct 24, 2023
Add full path to the awx_ec2 inv example

SUMMARY

The current example does not work, since it uses the default namespace and collection names.
This fixes the problem and allows anyone who installs the collection to use it outside of the collection scope.

ISSUE TYPE


Docs Pull Request

COMPONENT NAME


inventory: aws_ec2

Reviewed-by: Alina Buzachis
Reviewed-by: Mark Chappell
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 needs_triage plugins plugin (any type) python3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants