]> git.llucax.com Git - software/pymin.git/blobdiff - pymin/services/vpn/__init__.py
Merge branch 'master' of git.llucax.com.ar:/var/lib/git/software/pymin into procman
[software/pymin.git] / pymin / services / vpn / __init__.py
index 789d137ca8f2bf6223584ac6e2e2e74a1269ec1d..d25164032323face72f1f5f990532c2ffa3222e6 100644 (file)
@@ -1,8 +1,10 @@
 # vim: set encoding=utf-8 et sw=4 sts=4 :
 
 import os
+import signal
 from os import path
 
+
 from pymin.seqtools import Sequence
 from pymin.dispatcher import Handler, handler, HandlerError
 from pymin.services.util import Restorable, ConfigWriter, InitdHandler, \
@@ -101,15 +103,15 @@ class VpnHandler(Restorable, ConfigWriter,
     @handler('usage: start <vpn_name>')
     def start(self, vpn_src):
         if vpn_src in self.vpns:
-            call(('tincd','--net=',vpn_src))
+            call(('tincd','--net='vpn_src))
 
     @handler('usage: stop <vpn_name>')
     def stop(self, vpn_src):
         if vpn_src in self.vpns:
-            if path.exists('/var/lib/run/tincd.' + vpn_src + '.pid'):
-                pid = file('/var/lib/run/tincd.' + vpn_src + '.pid').readline()
+            if path.exists('/var/run/tinc.' + vpn_src + '.pid'):
+                pid = file('/var/run/tinc.' + vpn_src + '.pid').readline()
                 try:
-                    os.kill(int(pid.strip()), SIGTERM)
+                    os.kill(int(pid.strip()), signal.SIGTERM)
                 except OSError:
                     pass # XXX report error?
 
@@ -165,7 +167,6 @@ class VpnHandler(Restorable, ConfigWriter,
 
 if __name__ == '__main__':
     v = VpnHandler()
-    v.add('test','127.0.0.1','192.168.0.1','255.255.255.0')
-    #v.host.add('test', 'sarasa' ,'127.0.0.1', '205.25.36.36','kjdhfkbdskljvkjblkbjeslkjbvkljbselvslberjhbvslbevlhb')
-    v.delete('test')
+    v.add('prueba','sarasa','192.168.0.188','255.255.255.0')
+    v.host.add('prueba', 'azazel' ,'192.168.0.77', '192.168.0.0','kjdhfkbdskljvkjblkbjeslkjbvkljbselvslberjhbvslbevlhb')
     v.commit()