Commit 59aa364c by Csók Tamás

Correction in cloud.py and a windows icon for windows

parent 318fac09
File added
...@@ -34,7 +34,7 @@ def pars_arguments(): ...@@ -34,7 +34,7 @@ def pars_arguments():
parser.add_argument("-u", "--username", type=str) parser.add_argument("-u", "--username", type=str)
parser.add_argument("-p", "--password", type=str) parser.add_argument("-p", "--password", type=str)
parser.add_argument("-d", "--driver", help="Select webdriver. Aside from Firefox, you have to install first the proper driver.", \ parser.add_argument("-d", "--driver", help="Select webdriver. Aside from Firefox, you have to install first the proper driver.", \
type=str, choices=['firefox', 'chrome', 'ie', 'opera', 'safari'], default="firefox") type=str, choices=['firefox', 'chrome', 'ie', 'opera'], default="firefox")
parser.add_argument("-o", "--old", help="Use old interface", action="store_true") parser.add_argument("-o", "--old", help="Use old interface", action="store_true")
args = parser.parse_args(); args = parser.parse_args();
return args return args
...@@ -54,8 +54,6 @@ class Browser: ...@@ -54,8 +54,6 @@ class Browser:
self.driver = webdriver.Ie() self.driver = webdriver.Ie()
elif args.driver == "opera": elif args.driver == "opera":
self.driver = webdriver.Opera() self.driver = webdriver.Opera()
elif args.driver == "safari":
self.driver = webdriver.Safari()
self.driver.implicitly_wait(10) self.driver.implicitly_wait(10)
## ##
...@@ -96,6 +94,7 @@ class Browser: ...@@ -96,6 +94,7 @@ class Browser:
driver.find_element_by_css_selector("a[href*='/logout/']").click() driver.find_element_by_css_selector("a[href*='/logout/']").click()
except: except:
print "Browser session timed out!" print "Browser session timed out!"
raise
return vm return vm
## ##
...@@ -127,6 +126,7 @@ class Browser: ...@@ -127,6 +126,7 @@ class Browser:
driver.find_element_by_css_selector("a[href*='/logout/']").click() driver.find_element_by_css_selector("a[href*='/logout/']").click()
except: except:
print "Browser session timed out!" print "Browser session timed out!"
raise
return vm return vm
## ##
...@@ -138,6 +138,7 @@ class Browser: ...@@ -138,6 +138,7 @@ class Browser:
# kapcsolódunk a klienshez # kapcsolódunk a klienshez
def main(): def main():
try:
args = pars_arguments() args = pars_arguments()
if args.uri is not None: if args.uri is not None:
vm = Struct() vm = Struct()
...@@ -146,17 +147,21 @@ def main(): ...@@ -146,17 +147,21 @@ def main():
vm.state = "RUN" vm.state = "RUN"
else: else:
browser = Browser(args) browser = Browser(args)
try:
if args.old: if args.old:
vm = browser.old_main() vm = browser.old_main()
else: else:
vm = browser.main() vm = browser.main()
browser.driver.quit() browser.driver.quit()
except:
raise
if platform.system() == "Linux": if platform.system() == "Linux":
from cloud_connect_from_linux import connect from cloud_connect_from_linux import connect
elif platform.system() == "Windows": elif platform.system() == "Windows":
from cloud_connect_from_windows import connect from cloud_connect_from_windows import connect
if vm.state.upper()[:3] in ("FUT", "RUN"): if vm.state.upper()[:3] in ("FUT", "RUN"):
connect(vm) connect(vm)
except:
pass
if __name__ == "__main__": if __name__ == "__main__":
main() main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment