Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def connect_remote(self, rargs=[], **opts):
"""connects to a remote slave
Invoke an auxiliary utility (slave gsyncd, possibly wrapped)
which sets up the connection and set up a RePCe client to
communicate throuh its stdio.
"""
slave = opts.get('slave', self.url)
extra_opts = []
so = getattr(gconf, 'session_owner', None)
if so:
extra_opts += ['--session-owner', so]
if boolify(gconf.use_rsync_xattrs):
extra_opts.append('--use-rsync-xattrs')
po = Popen(rargs + gconf.remote_gsyncd.split() + extra_opts +
['-N', '--listen', '--timeout', str(gconf.timeout),
slave],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
gconf.transport = po
return self.start_fd_client(po.stdout, po.stdin, **opts)
"using rsync for extended attributes is not supported")
repce = RepceServer(
self.server, sys.stdin, sys.stdout, int(gconf.sync_jobs))
t = syncdutils.Thread(target=lambda: (repce.service_loop(),
syncdutils.finalize()))
t.start()
logging.info("slave listening")
if gconf.timeout and int(gconf.timeout) > 0:
while True:
lp = self.server.last_keep_alive
time.sleep(int(gconf.timeout))
if lp == self.server.last_keep_alive:
logging.info(
"connection inactive for %d seconds, stopping" %
int(gconf.timeout))
break
else:
select((), (), ())
stop servicing if a timeout is configured and got no
keep-alime in that inteval
"""
if boolify(gconf.use_rsync_xattrs) and not privileged():
raise GsyncdError(
"using rsync for extended attributes is not supported")
repce = RepceServer(
self.server, sys.stdin, sys.stdout, int(gconf.sync_jobs))
t = syncdutils.Thread(target=lambda: (repce.service_loop(),
syncdutils.finalize()))
t.start()
logging.info("slave listening")
if gconf.timeout and int(gconf.timeout) > 0:
while True:
lp = self.server.last_keep_alive
time.sleep(int(gconf.timeout))
if lp == self.server.last_keep_alive:
logging.info(
"connection inactive for %d seconds, stopping" %
int(gconf.timeout))
break
else:
select((), (), ())