Commit ddb2d75b by tarokkk

laborclient: Fixed home folder

parent 24b3d541
...@@ -10,7 +10,6 @@ import rdp ...@@ -10,7 +10,6 @@ import rdp
from multiprocessing import Process from multiprocessing import Process
import subprocess import subprocess
import tempfile import tempfile
import getpass
class KeyGen: class KeyGen:
"""Attributes: """Attributes:
...@@ -110,7 +109,14 @@ class Browser: ...@@ -110,7 +109,14 @@ class Browser:
self.public_key_b64 = base64.b64encode(public_key) self.public_key_b64 = base64.b64encode(public_key)
def destroy(self, dummy): def destroy(self, dummy):
try:
os.unlink(self.private_key_file)
except:
pass
try:
self.umount_sshfs_folder() self.umount_sshfs_folder()
except:
pass
gtk.main_quit() gtk.main_quit()
def on_navigation_requested(self, view, frame, req, data=None): def on_navigation_requested(self, view, frame, req, data=None):
...@@ -128,14 +134,14 @@ class Browser: ...@@ -128,14 +134,14 @@ class Browser:
except: except:
False False
def mount_sshfs_folder(self): def mount_sshfs_folder(self):
self.folder = getpass.gethome() + "/sshfs" self.folder = os.path.expanduser("~/sshfs")
neptun = self.params["neptun"] neptun = self.params["neptun"]
host = self.params["host"] host = self.params["host"]
try: try:
os.makedirs(folder, 0644) os.makedirs(self.folder, 0644)
except: except:
pass pass
result = subprocess.call(['/usr/bin/sshfs', '-o', 'IdentityFile='+self.private_key_file, neptun+"@"+host+":home", folder]) result = subprocess.call(['/usr/bin/sshfs', '-o', 'IdentityFile='+self.private_key_file, neptun+"@"+host+":home", self.folder])
#print result #print result
def umount_sshfs_folder(self): def umount_sshfs_folder(self):
try: try:
...@@ -175,6 +181,7 @@ class Browser: ...@@ -175,6 +181,7 @@ class Browser:
### JS ### JS
self.post_key(self.public_key_b64) self.post_key(self.public_key_b64)
### Parse values and do mounting ### ### Parse values and do mounting ###
elif uri.startswith("https://cloud.ik.bme.hu/?"):
try: try:
uri, params = uri.split('?', 1) uri, params = uri.split('?', 1)
values = params.split('&') values = params.split('&')
...@@ -185,10 +192,10 @@ class Browser: ...@@ -185,10 +192,10 @@ class Browser:
self.mount_sshfs_folder() self.mount_sshfs_folder()
except Exception as e: except Exception as e:
print e print e
finally:
os.unlink(self.private_key_file)
except: except:
pass pass
finally:
os.unlink(self.private_key_file)
return True return True
def main(self): def main(self):
gtk.main() gtk.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