jenkins 我试图弄清楚如何正确处理boto3的错误

wko9yo5t  于 2023-06-21  发布在  Jenkins
关注(0)|答案(1)|浏览(164)

我试图使用ansible创建dns条目,但出现以下错误。

/tmp/ansible_route53_payload_oyijp456/ansible_route53_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 144, in retry_func
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 530, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.7/site-packages/botocore/client.py", line 960, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidInput: An error occurred (InvalidInput) when calling the ChangeResourceRecordSets operation: Invalid request: Missing field 'SetIdentifier' in Change with [Action=UPSERT, Name=test.xdp.comcast.net., Type=A, SetIdentifier=null]
fatal: [xdpeksbuild-e1a-02-devops.xdp.comcast.net]: FAILED! => {
    "boto3_version": "1.26.62",
    "botocore_version": "1.29.100",
    "changed": false,
    "error": {
        "code": "InvalidInput",
        "message": "Invalid request: Missing field 'SetIdentifier' in Change with [Action=UPSERT, Name=test.xdp.comcast.net., Type=A, SetIdentifier=null]

示例:

- name: "Create/update dns record for green env"
  route53:
      state: present
      zone: ""
      record: ""
      type: A
      value: ""
      identifier: "east"
      region: "east"
      overwrite: yes
      alias: True
      alias_hosted_zone_id: ""

我看到了Python 3的问题,但同样适用于Python 2.7。

sdnqo3pr

sdnqo3pr1#

您提供的Ansible playbook正在尝试使用Route53模块创建DNS记录。但是,错误消息指示更改请求中缺少必需的字段“SetIdentifier”。
您需要为“SetIdentifier”字段提供一个值。

- name: Create/update DNS record for green env
  route53:
    state: present
    zone: "<zone_name>"
    record: "<record_name>"
    type: A
    value: "<IP_address>"
    set_identifier: "east"  # Add SetIdentifier field with a value
    region: "east"
    overwrite: yes
    alias: True
    alias_hosted_zone_id: "<alias_hosted_zone_id>"

相关问题