# HG changeset patch # User om # Date 1386330473 -3600 # Node ID d7d7b8dee78eaca2c4a08ccabdf3bc318918e2a8 # Parent 0b4efa323de33d5dad46156cbe22c7b8ffe62c3c vmmanger searches for cygwin paths now diff -r 0b4efa323de3 -r d7d7b8dee78e OpenSecurity/bin/cygwin.py --- a/OpenSecurity/bin/cygwin.py Fri Dec 06 12:29:15 2013 +0100 +++ b/OpenSecurity/bin/cygwin.py Fri Dec 06 12:47:53 2013 +0100 @@ -56,7 +56,15 @@ @staticmethod def root(): """get the path to our local cygwin installment""" - return os.path.join(Environment('OpenSecurity').prefix_path, '..', 'cygwin') + home_drive = os.path.expandvars("%HOMEDRIVE%") + os.sep + path_hint = [ + os.path.abspath(os.path.join(Environment('OpenSecurity').prefix_path, '..', 'cygwin')), + os.path.abspath(os.path.join(Environment('OpenSecurity').prefix_path, '..', 'cygwin64')), + os.path.abspath(os.path.join(home_drive, 'cygwin')), + os.path.abspath(os.path.join(home_drive, 'cygwin64')) + ] + path_valid = [ p for p in path_hint if os.path.exists(p) ] + return path_valid[0] def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE): @@ -94,6 +102,9 @@ # start if __name__ == "__main__": + print(Cygwin.root()) + sys.exit(1) + # execute what is given on the command line c = Cygwin() p = c(sys.argv[1:]) diff -r 0b4efa323de3 -r d7d7b8dee78e OpenSecurity/bin/opensecurityd.py --- a/OpenSecurity/bin/opensecurityd.py Fri Dec 06 12:29:15 2013 +0100 +++ b/OpenSecurity/bin/opensecurityd.py Fri Dec 06 12:47:53 2013 +0100 @@ -74,7 +74,6 @@ """OpenSecurity '/device_change' handler""" def GET(self): - gvm_mgr.cygwin_path = 'c:\\cygwin64\\bin\\' gvm_mgr.handleDeviceChange() return "os_device_change" @@ -126,7 +125,6 @@ def GET(self): res = "'os_server': { " res += "'version': '" + __version__ + "', " - res += "'virtualbox_path': '" + gvm_mgr.vBoxPath + "', " res += "'machine_folder': '" + gvm_mgr.getDefaultMachineFolder() + "' " res += "}" return res diff -r 0b4efa323de3 -r d7d7b8dee78e OpenSecurity/bin/vmmanager.py --- a/OpenSecurity/bin/vmmanager.py Fri Dec 06 12:29:15 2013 +0100 +++ b/OpenSecurity/bin/vmmanager.py Fri Dec 06 12:47:53 2013 +0100 @@ -9,6 +9,7 @@ import subprocess import sys import re +from cygwin import Cygwin DEBUG = True @@ -40,7 +41,7 @@ def __init__(self): self.systemProperties = self.getSystemProperties() - #TODO: get cygwin path externally + self.cygwin_path = Cygwin.root() return def execute(self, cmd): diff -r 0b4efa323de3 -r d7d7b8dee78e OpenSecurity/test/check-server.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/test/check-server.bat Fri Dec 06 12:47:53 2013 +0100 @@ -0,0 +1,2 @@ +@echo off +..\cygwin\bin\curl -X GET http://127.0.0.1:8080/ \ No newline at end of file diff -r 0b4efa323de3 -r d7d7b8dee78e OpenSecurity/test/create-security-vm.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/test/create-security-vm.bat Fri Dec 06 12:47:53 2013 +0100 @@ -0,0 +1,2 @@ +@echo off +../cygwin/bin/curl -X PUT -d name='Test' http://127.0.0.1:8080/sdvms \ No newline at end of file diff -r 0b4efa323de3 -r d7d7b8dee78e OpenSecurity/test/list-security-vms.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/test/list-security-vms.bat Fri Dec 06 12:47:53 2013 +0100 @@ -0,0 +1,2 @@ +@echo off +..\cygwin\bin\curl -X GET http://127.0.0.1:8080/sdvms \ No newline at end of file diff -r 0b4efa323de3 -r d7d7b8dee78e OpenSecurity/test/list-single-vm.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/test/list-single-vm.bat Fri Dec 06 12:47:53 2013 +0100 @@ -0,0 +1,2 @@ +@echo off +..\cygwin\bin\curl -X GET http://127.0.0.1:8080/vms/OsecVM \ No newline at end of file diff -r 0b4efa323de3 -r d7d7b8dee78e OpenSecurity/test/list-vms.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/test/list-vms.bat Fri Dec 06 12:47:53 2013 +0100 @@ -0,0 +1,2 @@ +@echo off +..\cygwin\bin\curl -X GET http://127.0.0.1:8080/vms \ No newline at end of file