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

[Documentation Issue] errors in DNS API example usage #1886

Closed
dupuy opened this issue Jun 22, 2016 · 1 comment
Closed

[Documentation Issue] errors in DNS API example usage #1886

dupuy opened this issue Jun 22, 2016 · 1 comment
Assignees
Labels
api: dns Issues related to the Cloud DNS API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@dupuy
Copy link

dupuy commented Jun 22, 2016

Page Name: dns-usage
Release: 0.16.0

As noted at https://groups.google.com/d/msg/cloud-dns-discuss/m5CHw1ncS14/lTKvD7O_BgAJ

this example of the DNS API doesn't actually work:

>>> import time
>>> from gcloud import dns
>>> client = dns.Client(project='PROJECT_ID')
>>> zone = client.zone('acme-co', 'example.com')
>>> TWO_HOURS = 2 * 60 * 60  # seconds
>>> record_set = zone.resource_record_set(
...    'www.example.com', 'CNAME', TWO_HOURS, 'www1.example.com')
>>> changes = zone.changes()
>>> changes.add_record_set(record_set)
>>> changes.create()  # API request
>>> while changes.status != 'done':
...     print('Waiting for changes to complete')
...     time.sleep(60)     # or whatever interval is appropriate
...     changes.reload()   # API request

Needs to be in this form:

CNAME:

record_set = zone.resource_record_set('www.example.com.', 'CNAME',
                                      3600, ['www1.example.com.',])

Or for A records:

record_set = zone.resource_record_set('www.example.com.', 'A',
                                      3600, ['11.111.11.111',])

Resource records need to be in a List form, DNS records seem to need the trailing dot.

@tseaver tseaver added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. docs api: dns Issues related to the Cloud DNS API. labels Jun 22, 2016
@tseaver
Copy link
Contributor

tseaver commented Jun 22, 2016

@dupuy Thank you for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: dns Issues related to the Cloud DNS API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants