This shaves a good 10% runtime from tests, and in some situations would mean a huge improvement (say, with long source lists)
sources = self.sources.split(' ')
# Copy all sources
- for source in sources:
- (out,err),proc = server.popen_scp(
- source,
- "%s@%s:%s" % (self.slicename, self.node.hostname,
- os.path.join(self.home_path,'.'),),
- ident_key = self.ident_path,
- server_key = self.node.server_key
- )
-
- if proc.wait():
- raise RuntimeError, "Failed upload source file %r: %s %s" % (source, out,err,)
+ (out,err),proc = server.popen_scp(
+ sources,
+ "%s@%s:%s" % (self.slicename, self.node.hostname,
+ os.path.join(self.home_path,'.'),),
+ ident_key = self.ident_path,
+ server_key = self.node.server_key
+ )
+
+ if proc.wait():
+ raise RuntimeError, "Failed upload source file %r: %s %s" % (source, out,err,)
if self.buildDepends:
# Install build dependencies
raise RuntimeError, "Unconnected TUN - missing node"
# Install the tun_connect script and tunalloc utility
- source = os.path.join(os.path.dirname(__file__), 'scripts', 'tun_connect.py')
+ sources = [
+ os.path.join(os.path.dirname(__file__), 'scripts', 'tun_connect.py'),
+ os.path.join(os.path.dirname(__file__), 'scripts', 'tunalloc.c'),
+ ]
dest = "%s@%s:%s" % (
local.node.slicename, local.node.hostname,
os.path.join(self.home_path,'.'),)
(out,err),proc = server.popen_scp(
- source,
- dest,
- ident_key = local.node.ident_path,
- server_key = local.node.server_key
- )
-
- if proc.wait():
- raise RuntimeError, "Failed upload TUN connect script %r: %s %s" % (source, out,err,)
-
- source = os.path.join(os.path.dirname(__file__), 'scripts', 'tunalloc.c')
- (out,err),proc = server.popen_scp(
- source,
+ sources,
dest,
ident_key = local.node.ident_path,
server_key = local.node.server_key
read and written into dest.
In these modes, recursive cannot be True.
+
+ Source can be a list of files to copy to a single destination,
+ in which case it is advised that the destination be a folder.
"""
if isinstance(source, file) or isinstance(dest, file) \
# Create a temporary server key file
tmp_known_hosts = _make_server_key_args(
server_key, host, port, args)
- args.append(source)
+ if isinstance(source,list):
+ args.extend(source)
+ else:
+ args.append(source)
args.append(dest)
# connects to the remote host and starts a remote connection
instance.do_setup()
instance.do_create()
- instance.do_connect()
+ instance.do_connect_init()
+ instance.do_connect_compl()
instance.do_preconfigure()
# Manually replace netref
instance.do_setup()
instance.do_create()
- instance.do_connect()
+ instance.do_connect_init()
+ instance.do_connect_compl()
instance.do_preconfigure()
instance.do_configure()
instance.do_setup()
instance.do_create()
- instance.do_connect()
+ instance.do_connect_init()
+ instance.do_connect_compl()
instance.do_preconfigure()
instance.do_configure()
instance.do_setup()
instance.do_create()
- instance.do_connect()
+ instance.do_connect_init()
+ instance.do_connect_compl()
instance.do_preconfigure()
instance.do_configure()
instance.do_setup()
instance.do_create()
- instance.do_connect()
+ instance.do_connect_init()
+ instance.do_connect_compl()
instance.do_preconfigure()
instance.do_configure()
try:
instance.do_setup()
instance.do_create()
- instance.do_connect()
+ instance.do_connect_init()
+ instance.do_connect_compl()
instance.do_preconfigure()
instance.do_configure()
self.fail("Usage of TUN without emulation should fail")
instance.do_setup()
instance.do_create()
- instance.do_connect()
+ instance.do_connect_init()
+ instance.do_connect_compl()
instance.do_preconfigure()
# Manually replace netref