jhonnymonclair / dnsexit

Python client for DNSEXIT Dynamic Dns Service
3 stars 6 forks source link

setup.py populates config file (host entry) incorrectly #2

Open CaptBV opened 3 years ago

CaptBV commented 3 years ago

@jhonnymonclair, first up, thank you for your dnsexit repo. It really helped me out a lot!

It did however occur to me that setup.py is populating /etc/dnsexit.conf incorrectly. Namely, the host entry of the config file.

/etc/dnsexit.conf: line 296: f.write("host=" + hosts + "\n")

The hosts variable is derived from: line 190: print("\n" + MSG_YOU_HAVE_SELECTED) line 191: for iter in selected: line 192: print("\t" + iter) --> line 193: hosts = ";".join(hosts)

Resulting in /etc/dnsexit.conf host=other-example.com;host1.other-example.com;host2.other-example.com

Rather than the actually selected host (e.g. host2.other-example.com), which should result in: host=host2.other-example.com


This issue can be reproduced as follows:

  1. In dnsexit.com create domain example.com
  2. In dnsexit.com create domain other-example.com
  3. Add A record host1.other-example.com
  4. Add A record host2.other-example.com
  5. Run setup:
$ sudo ./setup.py
Welcome to DNSExit.Com Dynamic IP update setup script.
Please follow instructions to setup our script.

Enter the username to dnsexit.com: login
Enter password for your username: password
Validating your login credentials...
Login Successfully...

Fetching your DNS domains. It may take a while...
Note: You should setup DNS for the domain first at your web account to get the domain listed below.

Please select the domains to update:
  0     example.com
  1     other-example.com
[separate multi selects by space]
Your selection: 1
Feching hosts in your domains. This may take a while...

Please select host(s) to be updated:
  0     host1.other-example.com
  1     host2.other-example.com
[separate multi selects by space]
Your selection: 1

You have selected the following hosts to be updated:
        host2.other-example.com

Do you want to run it as a daemon?
Your choice [yes]:
<etc etc etc>

Kind regards, CaptBV

CaptBV commented 3 years ago

This issue can obviously quickly be resolved by changing --> line 193: hosts = ";".join(hosts) to --> line 193: hosts = iter

Cheers