octodns: Error in Ns1Provider

When running ‘octodns-sync’ with ‘–doit’ I get the error below with one of my zones. The command runs fine without pushing the changes.

This might be a bug in the NS1 SDK @weyrick?

2017-06-02T10:20:57  [139657304188672] INFO  Ns1Provider[nsone] apply: making changes
Traceback (most recent call last):
  File "/usr/local/bin/octodns-sync", line 11, in <module>
    load_entry_point('octodns==0.8.0', 'console_scripts', 'octodns-sync')()
  File "/usr/local/lib/python2.7/dist-packages/octodns/cmds/sync.py", line 39, in main
    dry_run=not args.doit, force=args.force)
  File "/usr/local/lib/python2.7/dist-packages/octodns/manager.py", line 282, in sync
    total_changes += target.apply(plan)
  File "/usr/local/lib/python2.7/dist-packages/octodns/provider/base.py", line 143, in apply
    self._apply(plan)
  File "/usr/local/lib/python2.7/dist-packages/octodns/provider/ns1.py", line 202, in _apply
    getattr(self, '_apply_{}'.format(class_name))(nsone_zone, change)
  File "/usr/local/lib/python2.7/dist-packages/octodns/provider/ns1.py", line 167, in _apply_Create
    getattr(nsone_zone, 'add_{}'.format(_type))(name, **params)
  File "/usr/local/lib/python2.7/dist-packages/nsone/zones.py", line 131, in add_X
    return record.create(callback=callback, errback=errback, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nsone/records.py", line 130, in create
    callback=success, errback=errback, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nsone/rest/records.py", line 113, in create
    **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nsone/rest/records.py", line 124, in create_raw
    errback=errback)
  File "/usr/local/lib/python2.7/dist-packages/nsone/rest/resource.py", line 73, in _make_request
    return self._transport.send(type, self._make_url(path), **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nsone/rest/transport/requests.py", line 48, in send
    resp.text)
  File "/usr/local/lib/python2.7/dist-packages/nsone/rest/errors.py", line 53, in __init__
    hdrs = response.headers._rawHeaders
AttributeError: 'CaseInsensitiveDict' object has no attribute '_rawHeaders'

It looks to be caused by an excessive number connections for a zone with many records. In the log below I replaced the zone name with example.com, all record names with ‘somerecord’ and removed a range of lines (from the original 110) for visibility.

2017-06-02T10:31:15  [140391072339712] DEBUG urllib3.connectionpool Starting new HTTPS connection (1): api.nsone.net
2017-06-02T10:31:15  [140391072339712] DEBUG urllib3.connectionpool https://api.nsone.net:443 "PUT /v1/zones/example.com/somerecord/A HTTP/1.1" 200 None
2017-06-02T10:31:15  [140391072339712] DEBUG urllib3.connectionpool Starting new HTTPS connection (1): api.nsone.net
2017-06-02T10:31:16  [140391072339712] DEBUG urllib3.connectionpool https://api.nsone.net:443 "PUT /v1/zones/example.com/somerecord/A HTTP/1.1" 200 None
2017-06-02T10:31:16  [140391072339712] DEBUG urllib3.connectionpool Starting new HTTPS connection (1): api.nsone.net
2017-06-02T10:31:16  [140391072339712] DEBUG urllib3.connectionpool https://api.nsone.net:443 "PUT /v1/zones/example.com/somerecord/A HTTP/1.1" 200 None
2017-06-02T10:31:16  [140391072339712] DEBUG urllib3.connectionpool Starting new HTTPS connection (1): api.nsone.net
2017-06-02T10:31:16  [140391072339712] DEBUG urllib3.connectionpool https://api.nsone.net:443 "PUT /v1/zones/example.com/somerecord/A HTTP/1.1" 200 None
2017-06-02T10:31:16  [140391072339712] DEBUG urllib3.connectionpool Starting new HTTPS connection (1): api.nsone.net
2017-06-02T10:31:17  [140391072339712] DEBUG urllib3.connectionpool https://api.nsone.net:443 "PUT /v1/zones/example.com/somerecord/A HTTP/1.1" 200 None
.........
2017-06-02T10:31:37  [140391072339712] DEBUG urllib3.connectionpool https://api.nsone.net:443 "PUT /v1/zones/example.com/somerecord/CNAME HTTP/1.1" 200 None
2017-06-02T10:31:38  [140391072339712] DEBUG urllib3.connectionpool Starting new HTTPS connection (1): api.nsone.net
2017-06-02T10:31:38  [140391072339712] DEBUG urllib3.connectionpool https://api.nsone.net:443 "PUT /v1/zones/example.com/somerecord/CNAME HTTP/1.1" 200 None
2017-06-02T10:31:38  [140391072339712] DEBUG urllib3.connectionpool Starting new HTTPS connection (1): api.nsone.net
2017-06-02T10:31:38  [140391072339712] DEBUG urllib3.connectionpool https://api.nsone.net:443 "PUT /v1/zones/example.com/somerecord/A HTTP/1.1" 429 34

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (14 by maintainers)

Most upvoted comments

Thanks @pashap I’ll take a look at getting things updated, if I’m lucky this week.

@ross sorry for the delay, i let this one slip. im at NS1 as well, and told @fcelda id take care of the poor header handling thats causing the exception a couple of weeks ago.

i just created a PR that should fix header handling in the ns1 python sdk.

EDIT: just cut a new release of the python sdk with the fix in it, release version is 0.9.14