mkouhei/tonicdnscli

failed to "tonicdnscli show ..."

Closed this issue · 2 comments

kmn commented

when i convert text file into json format f, ailed to "tonicdnscli show ..." as below:

Users/kmn% tonicdnscli show example.org.txt 
raceback (most recent call last):
  File "/usr/local/bin/tonicdnscli", line 8, in <module>
    load_entry_point('tonicdnscli==0.6', 'console_scripts', 'tonicdnscli')()
  File "/Library/Python/2.7/site-packages/tonicdnscli-0.6-py2.7.egg/tonicdnscli/command.py", line 388, in main
    args.func(args)
  File "/Library/Python/2.7/site-packages/tonicdnscli-0.6-py2.7.egg/tonicdnscli/command.py", line 78, in show
    print(json.dumps(setJSON(domain, True, filename=args.infile),
  File "/Library/Python/2.7/site-packages/tonicdnscli-0.6-py2.7.egg/tonicdnscli/command.py", line 41, in setJSON
    o.readRecords(listitem.splitlines())
  File "/Library/Python/2.7/site-packages/tonicdnscli-0.6-py2.7.egg/tonicdnscli/converter.py", line 52, in readRecords
    self.generateDict(line)
  File "/Library/Python/2.7/site-packages/tonicdnscli-0.6-py2.7.egg/tonicdnscli/converter.py", line 68, in generateDict
    "ttl": int(self.checkkey(line, 3))
TypeError: int() argument must be a string or a number, not 'NoneType'

and the contents of the argument example.org.txt is like this

Users/kmn% cat example.org.txt 
test1.example.org A 192.168.0.101 86400
test2.example.org A 192.168.0.102 86400
test3.example.org A 192.168.0.103 86400

i am hoping that the command works well.

Thanks in advance.

In the following environments (*1): I do not reproduce.
And then re-install it, please try and try again.

% sudo easy_install tonicdnscli
% tonicdnscli show example.org.txt

*1: MacBookAir 4,1; OS X 10.7.4; Python 2.7.1 r271:86832;

kmn commented

I solved this issue.

The argument file contains blank lines.
So deleting the blank lines, the command works successfully.

Users/kmn% tonicdnscli show sample.org.txt   
[
  {
    "records": [
      {
        "content": "192.168.0.101", 
        "name": "test1.example.org", 
        "ttl": 86400, 
        "type": "A"
      }, 
      {
        "content": "192.168.0.102", 
        "name": "test2.example.org", 
        "ttl": 86400, 
        "type": "A"
      }, 
      {
        "content": "192.168.0.103", 
        "name": "test3.example.org", 
        "ttl": 86400, 
        "type": "A"
      }
    ]
  }
]

Thanks!