Removed dependence on REMOTE_HOST env variable and reverse DNS. iannucci
authorPeter Iannucci <iannucci@mit.edu>
Sat, 29 Jun 2013 23:28:29 +0000 (19:28 -0400)
committerPeter Iannucci <iannucci@mit.edu>
Tue, 2 Jul 2013 01:25:45 +0000 (21:25 -0400)
debian/changelog
server/usr/sbin/invirt-console-update

index b2f91b4..9836e76 100644 (file)
@@ -1,3 +1,9 @@
+invirt-console (0.2.16) unstable; urgency=low
+
+  * invirt-console-update now doesn't depend on remctld setting REMOTE_HOST
+
+ -- Peter Iannucci <iannucci@mit.edu>  Mon, 01 Jul 2013 21:22:00 -0400
+
 invirt-console (0.2.15) unstable; urgency=low
 
   * Divert /etc/conserver/console.cf in the right binary package.
index e24a3ce..8da9bfb 100755 (executable)
@@ -3,9 +3,15 @@ import sys
 import os
 import subprocess
 
+from invirt.config import structs as config
+
 def main(args):
   contents = args[2]
-  hostname = os.environ['REMOTE_HOST'].lower()
+  host_addr = os.environ['REMOTE_ADDR']
+  for h in config.hosts:
+    if host_addr in h.internal_ips or host_addr == h.ip:
+      hostname = h.hostname
+      break
   f = file('/etc/conserver/conf.d/'+hostname, 'w')
   f.write(contents)
   f.close()