Permalink
Browse files

changing how the ipaddress is aquired for the request

  • Loading branch information...
1 parent a5808a4 commit 3a2124aba41ca77fb790c445d02317f976e4dfb5 BuzzTroll committed Sep 2, 2010
View
6 control/etc/workspace-control/propagation.conf
@@ -43,8 +43,8 @@ http: false
lantorrent: true
lantorrentport: 5893
-
-# if lantorrentip is not specified the then
-# socket.gethostbyname(socket.gethostname()) will be used
+# if lantorrentip is not specified the then it will be assumed that the
+# request program is being run from ssh and the contact information will
+# come from the SSH_CLIENT env
#lantorrentip: x.x.x.x
ssh: /usr/bin/ssh
View
7 control/src/python/workspacecontrol/defaults/imageprocurement/propagate_lantorrent.py
@@ -13,7 +13,7 @@ class LantorrentPropadapter(propagate_scp.propadapter):
def __init__(self, params, common):
propagate_scp.propadapter.__init__(self, params, common)
self.ssh = None
- self.ltport = 5893
+ self.ltport = None
self.ltip = None
self.scheme = "lantorrent://"
@@ -24,7 +24,7 @@ def validate(self):
self.ltip = self.p.get_conf_or_none("propagation", "lantorrentip")
if not self.ltip:
- self.ltip = socket.gethostbyname(socket.gethostname())
+ self.ltip = ""
self.ltport = self.p.get_conf_or_none("propagation", "lantorrentport")
if not self.ltport:
@@ -132,7 +132,8 @@ def _lt_command(self, local, remote):
xfer_user = xfer_user + "@"
else:
xfer_user = ""
- cmd = self.ssh + " -p %d %s%s %s %s %s %s %d %s %d" % (xfer_port, xfer_user, xfer_host, lt_exe, xfer_path, local, group_id, group_count, self.ltip, self.ltport)
+ rid = str(uuid.uuid1())
+ cmd = self.ssh + " -p %d %s%s %s %s %s %s %d %s:%d" % (xfer_port, xfer_user, xfer_host, lt_exe, xfer_path, local, group_id, group_count, self.ltip, self.ltport, rid)
self.c.log.debug("lantorrent command %s " % (cmd))
View
1,207 lantorrent/log/lantorrent.log
0 additions, 1,207 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
17 lantorrent/pylantorrent/request.py
@@ -122,15 +122,22 @@ def main(argv=sys.argv[1:]):
dst_filename = argv[1]
group_id = int(argv[2])
group_count = int(argv[3])
-
- host = argv[4]
- port = int(argv[5])
-
-
# the user provides the rid. that way we know they have it to look
# things up later if needed
rid = argv[4]
+ hostport = argv[5]
+ ha = hostport.split(":")
+ host = ha[0]
+ if host == "":
+ hostport = os.environ['SSH_CLIENT']
+ ha = hostport.split(" ")
+ host = ha[0]
+ if len(ha) > 1:
+ port = int(ha[1])
+ else:
+ port = 5893
+
con_str = pylantorrent.dbfile
now = datetime.datetime.now()
con = sqlite3.connect(con_str)

0 comments on commit 3a2124a

Please sign in to comment.