Fixed torrent transport + added tests
This commit is contained in:
parent
554dc5c82a
commit
f25e8abe14
@ -1 +1 @@
|
||||
../../../solar/solar/core/transports/helpers/solar_torrent.py
|
||||
../../../solar/core/transports/helpers/solar_torrent.py
|
@ -19,6 +19,7 @@ from uuid import uuid4
|
||||
|
||||
import libtorrent as lt
|
||||
|
||||
from solar.core.handlers.base import SOLAR_TEMP_LOCAL_LOCATION
|
||||
from solar.core.log import log
|
||||
from solar.core.transports.base import Executor
|
||||
from solar.core.transports.base import SyncTransport
|
||||
@ -96,7 +97,7 @@ class TorrentSyncTransport(SyncTransport):
|
||||
seed_args = ';'.join(to_seed)
|
||||
# TODO: 'g' is just for debug, it should be 's', remove when sure
|
||||
cmd = ['/usr/bin/python',
|
||||
'/vagrant/solar/solar/core/transports/helpers/solar_torrent.py',
|
||||
'/vagrant/solar/core/transports/helpers/solar_torrent.py',
|
||||
'g',
|
||||
'"%s"' % seed_args]
|
||||
log.debug("Will start seeding: %r" % ' '.join(cmd))
|
||||
@ -110,6 +111,11 @@ class TorrentSyncTransport(SyncTransport):
|
||||
torrents = self._torrents
|
||||
else:
|
||||
torrents = self._sudo_torrents
|
||||
torrents = map(lambda x: (
|
||||
x[0],
|
||||
x[1],
|
||||
x[2].replace(SOLAR_TEMP_LOCAL_LOCATION, '/tmp/')
|
||||
), torrents)
|
||||
to_get = ["%s|%s" % (os.path.abspath(
|
||||
os.path.join(x[2], '..')), x[1]) for x in torrents]
|
||||
get_args = ';'.join(to_get)
|
||||
|
@ -216,6 +216,12 @@ class InputsFieldWrp(IndexFieldWrp):
|
||||
my_resource, my_inp_name, other_resource, other_inp_name, my_type,
|
||||
other_type)
|
||||
|
||||
def _connect_other_list(self, my_resource, my_inp_name, other_resource,
|
||||
other_inp_name, my_type, other_type):
|
||||
return self._connect_other_simple(
|
||||
my_resource, my_inp_name, other_resource, other_inp_name, my_type,
|
||||
other_type)
|
||||
|
||||
def _connect_other_list_hash(self, my_resource, my_inp_name,
|
||||
other_resource, other_inp_name, my_type,
|
||||
other_type):
|
||||
|
@ -667,3 +667,17 @@ def test_nested_two_listdict(rk):
|
||||
assert 'backends' in sc
|
||||
assert isinstance(sc['backends'], list)
|
||||
assert isinstance(sc['something'], int)
|
||||
|
||||
|
||||
def test_connect_other_list(rk):
|
||||
k1 = next(rk)
|
||||
k2 = next(rk)
|
||||
|
||||
r1 = create_resource(k1, {'name': 'first',
|
||||
'inputs': {'config': {"trackers": []}}})
|
||||
r2 = create_resource(k2, {'name': 'second',
|
||||
'inputs': {"trackers": ["t1", "t2"]}})
|
||||
r2.connect(r1, {'trackers': 'config:trackers'})
|
||||
Resource.save_all_lazy()
|
||||
|
||||
assert r1.inputs['config']['trackers'] == ["t1", "t2"]
|
||||
|
Loading…
Reference in New Issue
Block a user