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

Deleting record not working? #20

Closed
raidenii opened this issue Aug 13, 2022 · 3 comments · Fixed by #23
Closed

Deleting record not working? #20

raidenii opened this issue Aug 13, 2022 · 3 comments · Fixed by #23

Comments

@raidenii
Copy link

raidenii commented Aug 13, 2022

Hi,

I'm using the latest inwx module (1.3.0) from Ansible galaxy but seems deleting records is not working?

A sample playbook:

- hosts: localhost
  vars:
    domains:
      - domain1:
        tld: "my.domain.com"

  tasks:
    - name: delete acme challenge dns
      inwx.collection.dns:
        domain: "{{ item.tld }}"
        type: TXT  
        record: "_acme_challenge"
        username: "username"
        value: "removed"
        password: 'somepass'
        state: absent
      loop: "{{ domains | flatten(levels=1) }}"

If the parameter does not specify value, the module will return a

 "result": {
        "api_response": {
            "code": 2005,
            "msg": "Parameter value syntax error",
            "reason": "The given parameter value for 'content' does not match the expected parameter type 'text1024'",
            "reasonCode": "The given parameter value for 'content' does not match the expected parameter type 'text1024'"
        }
    }

which does not match what the documentation said - when state is absent it should not need a value.

But even with value defined, it returns changed = False and the TXT records are not deleted. Also tried record: "_acme_challenge.my.domain.com" but still the records are not deleted.

@raidenii
Copy link
Author

Looks like when content is included in the payload for get_records, INWX API will do an exact match against it (and throws an error if it's "").

A naive way to fix would be changing the get_records function slightly:

...
    elif content != "":
        result = call_api_authenticated(module, 'nameserver.info', {
            'domain': str(module.params['domain']),
            'type': str(module.params['type']),
            'name': get_record_fqdn(module),
            'content': content
        })
    else:
        result = call_api_authenticated(module, 'nameserver.info', {
            'domain': str(module.params['domain']),
            'type': str(module.params['type']),
            'name': get_record_fqdn(module)
        })
...

@solick
Copy link

solick commented Oct 18, 2022

I can confirm this issue. Trying to delete wildcard records but debug information also shows changed:false.

@clahil-linum
Copy link

I can also confirm this issue and also the recommend quick fix.

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

Successfully merging a pull request may close this issue.

3 participants