Fixed problem with transports connected to another transports
- When transports_id value is False no magic mappings - Added is_own to location_id, when set to False location_id is not mapped
This commit is contained in:
parent
ae3cb4cad1
commit
dc2c79bac4
@ -20,3 +20,7 @@ input:
|
|||||||
schema: str!
|
schema: str!
|
||||||
value:
|
value:
|
||||||
reverse: True
|
reverse: True
|
||||||
|
is_own: False
|
||||||
|
transports_id:
|
||||||
|
schema: str!
|
||||||
|
value: False
|
||||||
|
@ -16,3 +16,7 @@ input:
|
|||||||
schema: str!
|
schema: str!
|
||||||
value:
|
value:
|
||||||
reverse: True
|
reverse: True
|
||||||
|
is_own: False
|
||||||
|
transports_id:
|
||||||
|
schema: str!
|
||||||
|
value: False
|
||||||
|
@ -20,11 +20,11 @@ from solar.core.transports.ssh import SSHSyncTransport, SSHRunTransport
|
|||||||
from solar.core.transports.solard_transport import SolardRunTransport, SolardSyncTransport
|
from solar.core.transports.solard_transport import SolardRunTransport, SolardSyncTransport
|
||||||
|
|
||||||
_default_transports = {
|
_default_transports = {
|
||||||
# 'sync': SSHSyncTransport,
|
|
||||||
# 'sync': RsyncSyncTransport,
|
# 'sync': RsyncSyncTransport,
|
||||||
# 'run': SSHRunTransport
|
'sync': SSHSyncTransport,
|
||||||
'run': SolardRunTransport,
|
'run': SSHRunTransport
|
||||||
'sync': SolardSyncTransport
|
# 'run': SolardRunTransport,
|
||||||
|
# 'sync': SolardSyncTransport
|
||||||
}
|
}
|
||||||
|
|
||||||
def resource_action(resource, action):
|
def resource_action(resource, action):
|
||||||
|
@ -58,12 +58,21 @@ def location_and_transports(emitter, receiver, orig_mapping):
|
|||||||
elif isinstance(orig_mapping, set):
|
elif isinstance(orig_mapping, set):
|
||||||
orig_mapping.remove(single)
|
orig_mapping.remove(single)
|
||||||
|
|
||||||
def _single(single, inps_emitter, inps_receiver):
|
def _single(single, emitter, receiver, inps_emitter, inps_receiver):
|
||||||
if inps_emitter and inps_receiver:
|
if inps_emitter and inps_receiver:
|
||||||
log.debug("location and transports different, skipping")
|
if not inps_emitter == inps_receiver:
|
||||||
return
|
log.warning("Different %r defined %r => %r", single, emitter.name, receiver.name)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
log.debug("The same %r defined for %r => %r, skipping", single, emitter.name, receiver.name)
|
||||||
|
return
|
||||||
emitter_single = emitter.db_obj.meta_inputs[single]
|
emitter_single = emitter.db_obj.meta_inputs[single]
|
||||||
receiver_single = receiver.db_obj.meta_inputs[single]
|
receiver_single = receiver.db_obj.meta_inputs[single]
|
||||||
|
if emitter_single.get('value') is False:
|
||||||
|
log.debug("Disabled %r mapping for %r", single, emitter.name)
|
||||||
|
return
|
||||||
|
if receiver_single.get('is_own') is False:
|
||||||
|
log.debug("Not is_own %r for %r ", single, emitter.name)
|
||||||
emitter_single_reverse = emitter_single.get('reverse')
|
emitter_single_reverse = emitter_single.get('reverse')
|
||||||
receiver_single_reverse = receiver_single.get('reverse')
|
receiver_single_reverse = receiver_single.get('reverse')
|
||||||
# connect in other direction
|
# connect in other direction
|
||||||
@ -86,7 +95,7 @@ def location_and_transports(emitter, receiver, orig_mapping):
|
|||||||
# XXX: should be somehow parametrized (input attribute?)
|
# XXX: should be somehow parametrized (input attribute?)
|
||||||
for single in ('transports_id', 'location_id'):
|
for single in ('transports_id', 'location_id'):
|
||||||
if single in inps_emitter and inps_receiver:
|
if single in inps_emitter and inps_receiver:
|
||||||
_single(single, inps_emitter[single], inps_receiver[single])
|
_single(single, emitter, receiver, inps_emitter[single], inps_receiver[single])
|
||||||
else:
|
else:
|
||||||
log.warning('Unable to create connection for %s with'
|
log.warning('Unable to create connection for %s with'
|
||||||
' emitter %s, receiver %s',
|
' emitter %s, receiver %s',
|
||||||
|
Loading…
Reference in New Issue
Block a user