fzlee / namecom

Simple ddns module for name.com
MIT License
5 stars 5 forks source link

namecli doesn't use environment variables for NAME and TOKEN #2

Closed ajschroeder closed 4 years ago

ajschroeder commented 4 years ago

I have set the environment variables as such:

set | grep NAMECOM NAMECOM_NAME=test-user NAMECOM_TOKEN=

However, when I run namecli ddns --domain example.net --host www namecli tells me that --name is missing.

When I specify the variables on the CLI it works great

fzlee commented 4 years ago

please try with version 0.4.0

ajschroeder commented 4 years ago

I just upgraded to 0.4.0 and it seems to read the environment variables properly. Thank you for resolving!

I did run into another issue when attempting to update the '@' record for my domain, should I open a separate issue?

fzlee commented 4 years ago

it doesn't matter, please tell me what can I do to help you

ajschroeder commented 4 years ago

When I try to create a naked domain record '@' I get the following error stating a duplicate record. However, when I try to update another A record (e.g. www) then I do not see the error:

current IP: <removed>
record not found, creating new..
Traceback (most recent call last):
  File "/home/pi/.local/bin/namecli", line 110, in <module>
    cli()
  File "/home/pi/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/pi/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.local/bin/namecli", line 92, in ddns
    client.create_record(domain, host, "A", ip)
  File "/home/pi/.local/lib/python2.7/site-packages/namecom/__init__.py", line 61, in create_record
    return self.post(path, data).json()
  File "/home/pi/.local/lib/python2.7/site-packages/namecom/helpers.py", line 39, in new_func
    raise Exception("HTTP request failed, response body: {}".format(response.text))
Exception: HTTP request failed, response body: {"message":"Invalid Argument","details":"Parameter Value Error - Duplicate Record"}
fzlee commented 4 years ago

To create a DNS record, we have to delete old ones first, unfortunately somehow I could not make it. please try 0.5.0, which should fix this issue