Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: remoting/tools/me2me_virtual_host.py

Issue 8863010: Store the host config in a per-host config file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix relaunching of host if it crashes. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/tools/me2me_virtual_host.py
diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py
index f8a8baaa3566e7e22119527f71aa5f5a4bc090ca..23ca7b650edd7b7226693763fe27f7d0ca4f66f1 100755
--- a/remoting/tools/me2me_virtual_host.py
+++ b/remoting/tools/me2me_virtual_host.py
@@ -29,6 +29,9 @@ import keygen
REMOTING_COMMAND = "remoting_me2me_host"
+# Command-line switch for passing the config path to remoting_me2me_host.
+HOST_CONFIG_SWITCH_NAME = "host-config"
+
SCRIPT_PATH = os.path.dirname(sys.argv[0])
if not SCRIPT_PATH:
SCRIPT_PATH = os.getcwd()
@@ -260,10 +263,11 @@ class Desktop:
if not session_proc.pid:
raise Exception("Could not start X session")
- def launch_host(self):
+ def launch_host(self, host):
# Start remoting host
- command = locate_executable(REMOTING_COMMAND)
- self.host_proc = subprocess.Popen(command, env=self.child_env)
+ args = [locate_executable(REMOTING_COMMAND),
+ "--%s=%s" % (HOST_CONFIG_SWITCH_NAME, host.config_file)]
Wez 2011/12/10 00:00:09 Is it possible for |config_file| to contain anythi
Lambros 2011/12/10 02:00:31 This shouldn't confuse popen(), because the whole
+ self.host_proc = subprocess.Popen(args, env=self.child_env)
if not self.host_proc.pid:
raise Exception("Could not start remoting host")
@@ -287,7 +291,7 @@ def main():
return 1
auth.save_config()
- host = Host(os.path.join(CONFIG_DIR, "host.json"))
+ host = Host(os.path.join(CONFIG_DIR, "host#%s.json" % socket.gethostname()))
Wez 2011/12/10 00:00:09 Is socket.gethostname() reliable, e.g. if the host
Lambros 2011/12/10 02:00:31 Python doc isn't helpful here, it says only that i
if not host.load_config():
host.create_config(auth)
@@ -298,7 +302,7 @@ def main():
desktop = Desktop()
desktop.launch_x_server()
desktop.launch_x_session()
- desktop.launch_host()
+ desktop.launch_host(host)
while True:
pid, status = os.wait()
@@ -310,7 +314,7 @@ def main():
if pid == desktop.host_proc.pid:
logging.info("Host process terminated, relaunching")
- desktop.launch_host()
+ desktop.launch_host(host)
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698