summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Richter <Felix.Richter@syntax-fehler.de>2011-05-11 19:09:09 +0200
committerFelix Richter <Felix.Richter@syntax-fehler.de>2011-05-11 19:09:09 +0200
commit6b447449eed7aa99a8a18e3de30566545af0edcd (patch)
treea5d6756dadbea2bc7e9e9bbf8b21a74659b1259a
parent436512a5b3cbafa44f6db9c54fc7eb66bcb7eb21 (diff)
parente3f90c0c1375857d6a0a5f94ebbdec987e0f5a26 (diff)
Merge branch 'master' of github.com:miefda/retiolum
-rwxr-xr-xretiolum/hosts/.scripts/retiolum.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/retiolum/hosts/.scripts/retiolum.py b/retiolum/hosts/.scripts/retiolum.py
index 6314c689..4c955b86 100755
--- a/retiolum/hosts/.scripts/retiolum.py
+++ b/retiolum/hosts/.scripts/retiolum.py
@@ -15,15 +15,15 @@ def address2hostfile(netname, hostname, address): #adds address to hostsfile or
addr_file = open(hostfile, "r")
addr_cache = addr_file.readlines()
addr_file.close()
- if address != "": addr_cache.insert(0, "Address = " + address + "\n")
- else:
- if addr_cache[0].startswith("Address"): addr_cache.remove(addr_cache[0])
- addr_file = open(hostfile, "w")
- addr_file.writelines(addr_cache)
- addr_file.close
- logging.info("sending ALRM to tinc deamon!")
- tincd_ALRM = subprocess.call(["tincd -n " + netname + " --kill=HUP" ],shell=True)
-
+ if address != "":
+ addr_cache.insert(0, "Address = " + address + "\n")
+ addr_file = open(hostfile, "w")
+ addr_file.writelines(addr_cache)
+ addr_file.close
+ logging.info("sending ALRM to tinc deamon!")
+ tincd_ALRM = subprocess.call(["tincd -n " + netname + " --kill=HUP" ],shell=True)
+ else:
+ recover = subprocess.os.popen("tar xzf /etc/tinc/" + netname + "/hosts/hosts.tar.gz -C /etc/tinc/" + netname + "/hosts/ " + hostname)
def findhostinlist(hostslist, hostname, ip): #finds host + ip in list
for line in xrange(len(hostslist)):
@@ -241,8 +241,6 @@ def auththread(netname, hostname, authfifo, sendfifo, timeoutfifo): #manages aut
time.sleep(1)
#Program starts here!
-#netname = "retiolum"
-#hostname = "miefda901"
parser = OptionParser()
parser.add_option("-n", "--netname", dest="netname", help="the netname of the tinc network")