Fix list subcommand failing on empty domain

This commit is contained in:
Piotr Dobrowolski 2017-03-10 18:16:40 +01:00
parent f6cdae0158
commit 43a8f83f56

View File

@ -73,7 +73,8 @@ if __name__ == "__main__":
if args['<command>'] == 'list':
ips = list_ips()
for _, ip in ips.items():
print '%15s | %17s | %s' % (ip.ip, ip.mac, ip.domain)
hostname = ip.domain.name() if ip.domain else ''
print '%15s | %17s | %s' % (ip.ip, ip.mac, hostname)
elif args['<command>'] == 'sync':
client = ovh.Client()
server = client.get('/dedicated/server')[0]