vmmanger searches for cygwin paths now
authorom
Fri, 06 Dec 2013 12:47:53 +0100
changeset 18d7d7b8dee78e
parent 17 0b4efa323de3
child 19 3111f077646d
vmmanger searches for cygwin paths now
OpenSecurity/bin/cygwin.py
OpenSecurity/bin/opensecurityd.py
OpenSecurity/bin/vmmanager.py
OpenSecurity/test/check-server.bat
OpenSecurity/test/create-security-vm.bat
OpenSecurity/test/list-security-vms.bat
OpenSecurity/test/list-single-vm.bat
OpenSecurity/test/list-vms.bat
     1.1 --- a/OpenSecurity/bin/cygwin.py	Fri Dec 06 12:29:15 2013 +0100
     1.2 +++ b/OpenSecurity/bin/cygwin.py	Fri Dec 06 12:47:53 2013 +0100
     1.3 @@ -56,7 +56,15 @@
     1.4      @staticmethod
     1.5      def root():
     1.6          """get the path to our local cygwin installment"""
     1.7 -        return os.path.join(Environment('OpenSecurity').prefix_path, '..', 'cygwin')
     1.8 +        home_drive = os.path.expandvars("%HOMEDRIVE%") + os.sep
     1.9 +        path_hint = [ 
    1.10 +            os.path.abspath(os.path.join(Environment('OpenSecurity').prefix_path, '..', 'cygwin')), 
    1.11 +            os.path.abspath(os.path.join(Environment('OpenSecurity').prefix_path, '..', 'cygwin64')), 
    1.12 +            os.path.abspath(os.path.join(home_drive, 'cygwin')),
    1.13 +            os.path.abspath(os.path.join(home_drive, 'cygwin64'))
    1.14 +        ]
    1.15 +        path_valid = [ p for p in path_hint if os.path.exists(p) ]
    1.16 +        return path_valid[0]
    1.17  
    1.18  
    1.19      def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE):
    1.20 @@ -94,6 +102,9 @@
    1.21  # start
    1.22  if __name__ == "__main__":
    1.23  
    1.24 +    print(Cygwin.root())
    1.25 +    sys.exit(1)
    1.26 +
    1.27      # execute what is given on the command line
    1.28      c = Cygwin()
    1.29      p = c(sys.argv[1:])
     2.1 --- a/OpenSecurity/bin/opensecurityd.py	Fri Dec 06 12:29:15 2013 +0100
     2.2 +++ b/OpenSecurity/bin/opensecurityd.py	Fri Dec 06 12:47:53 2013 +0100
     2.3 @@ -74,7 +74,6 @@
     2.4      """OpenSecurity '/device_change' handler"""
     2.5      
     2.6      def GET(self):
     2.7 -        gvm_mgr.cygwin_path = 'c:\\cygwin64\\bin\\'
     2.8          gvm_mgr.handleDeviceChange()
     2.9          return "os_device_change"
    2.10  
    2.11 @@ -126,7 +125,6 @@
    2.12      def GET(self):
    2.13          res = "'os_server': { "
    2.14          res += "'version': '" + __version__ + "', "
    2.15 -        res += "'virtualbox_path': '" + gvm_mgr.vBoxPath + "', "
    2.16          res += "'machine_folder': '" + gvm_mgr.getDefaultMachineFolder() + "' "
    2.17          res += "}"
    2.18          return res
     3.1 --- a/OpenSecurity/bin/vmmanager.py	Fri Dec 06 12:29:15 2013 +0100
     3.2 +++ b/OpenSecurity/bin/vmmanager.py	Fri Dec 06 12:47:53 2013 +0100
     3.3 @@ -9,6 +9,7 @@
     3.4  import subprocess
     3.5  import sys
     3.6  import re
     3.7 +from cygwin import Cygwin
     3.8  
     3.9  DEBUG = True
    3.10  
    3.11 @@ -40,7 +41,7 @@
    3.12      
    3.13      def __init__(self):
    3.14          self.systemProperties = self.getSystemProperties()
    3.15 -        #TODO: get cygwin path externally
    3.16 +        self.cygwin_path = Cygwin.root()
    3.17          return
    3.18           
    3.19      def execute(self, cmd):
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/OpenSecurity/test/check-server.bat	Fri Dec 06 12:47:53 2013 +0100
     4.3 @@ -0,0 +1,2 @@
     4.4 +@echo off
     4.5 +..\cygwin\bin\curl -X GET http://127.0.0.1:8080/
     4.6 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/OpenSecurity/test/create-security-vm.bat	Fri Dec 06 12:47:53 2013 +0100
     5.3 @@ -0,0 +1,2 @@
     5.4 +@echo off
     5.5 +../cygwin/bin/curl -X PUT -d name='Test' http://127.0.0.1:8080/sdvms
     5.6 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/OpenSecurity/test/list-security-vms.bat	Fri Dec 06 12:47:53 2013 +0100
     6.3 @@ -0,0 +1,2 @@
     6.4 +@echo off
     6.5 +..\cygwin\bin\curl -X GET http://127.0.0.1:8080/sdvms
     6.6 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/OpenSecurity/test/list-single-vm.bat	Fri Dec 06 12:47:53 2013 +0100
     7.3 @@ -0,0 +1,2 @@
     7.4 +@echo off
     7.5 +..\cygwin\bin\curl -X GET http://127.0.0.1:8080/vms/OsecVM
     7.6 \ No newline at end of file
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/OpenSecurity/test/list-vms.bat	Fri Dec 06 12:47:53 2013 +0100
     8.3 @@ -0,0 +1,2 @@
     8.4 +@echo off
     8.5 +..\cygwin\bin\curl -X GET http://127.0.0.1:8080/vms
     8.6 \ No newline at end of file