saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.1k stars 5.47k forks source link

delete_dns_record broken with digitalocean (pagination) #55143

Open CosmicToast opened 4 years ago

CosmicToast commented 4 years ago

Description of Issue

When querying digitalocean for domain records (both for deletion and stale checks) via https://api.digitalocean.com/v2/domains<DOMAIN>/records, the API now returns at most 20 records in .domain_records. To access further records, one must call it with a page=<PAGE> GET parameter. This change has not been documented (and it is thus not surprising that it broke within salt), but it is rather simple to verify. The .meta.total key contains the total amount of records, and .links.pages contains various keys such as "first", "next", "last" and "prev" that give the URLs to use to get the appropriate information/page.

Setup & Steps to Reproduce Issue

  1. Set up a digitalocean-based salt-cloud environment, with domains, create_dns_domain and delete_dns_domain.
  2. Create a large amount (currently >20) unrelated domain names.
  3. Bootstrap a salt client with a name that will trigger create_dns_domain.
  4. Delete the salt client.
  5. Observe that it does not see the whole set of dns domains and does not find the client's record to delete.

Attached is a log with any identifiable information ripped out:

Proceed? [N/y] ... proceeding do:

digital_ocean:
    ----------
    id.example.com:
        True
### Versions Report

Salt Version: Salt: 2019.2.2

Dependency Versions: cffi: Not Installed cherrypy: unknown dateutil: 2.6.1 docker-py: Not Installed gitdb: 2.0.3 gitpython: 2.1.8 ioflo: Not Installed Jinja2: 2.10 libgit2: Not Installed libnacl: Not Installed M2Crypto: Not Installed Mako: 1.0.7 msgpack-pure: Not Installed msgpack-python: 0.5.6 mysql-python: Not Installed pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: Not Installed Python: 2.7.15+ (default, Oct 7 2019, 17:39:04) python-gnupg: 0.4.1 PyYAML: 3.12 PyZMQ: 16.0.2 RAET: Not Installed smmap: 2.0.3 timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.2.5

System Versions: dist: Ubuntu 18.04 bionic locale: UTF-8 machine: x86_64 release: 4.15.0-66-generic system: Linux version: Ubuntu 18.04 bionic


### P.S.

This move is obviously unacceptable on the side of DigitalOcean, as no warning was provided to anyone, as far as I can tell.
However, I don't think any of us have the power to force them to act otherwise at this point, and salt should be able to handle this, one way or another.
CosmicToast commented 4 years ago

Update: the pagination behavior is documented now, here. The tl;dr:

frogunder commented 4 years ago

@5paceToast Thank you for reporting this issue.

I will reach out to the cloud team about this one.

@saltstack/team-cloud any thoughts on this one?

Thanks.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] commented 4 years ago

Thank you for updating this issue. It is no longer marked as stale.