Merge "Allow to use parent input more than once in CR"
This commit is contained in:
commit
bc039d31b4
@ -252,8 +252,10 @@ def update_inputs(child, inputs):
|
||||
connections, assignments, computable = parse_inputs(inputs)
|
||||
parents = defaultdict(lambda: defaultdict(dict))
|
||||
for c in connections:
|
||||
mapping = {c['parent_input']: c['child_input']}
|
||||
parents[c['parent']]['mapping'].update(mapping)
|
||||
if not parents[c['parent']]['mapping'].get(c['parent_input']):
|
||||
parents[c['parent']]['mapping'][c['parent_input']] = []
|
||||
mapping = parents[c['parent']]['mapping']
|
||||
mapping[c['parent_input']].append(c['child_input'])
|
||||
if parents[c['parent']].get('events', None) is None:
|
||||
parents[c['parent']]['events'] = c['events']
|
||||
|
||||
|
@ -174,6 +174,20 @@ def test_add_list_values(mocker, resources):
|
||||
assert mocked_signals.call_count == 1
|
||||
|
||||
|
||||
def test_double_parent_input(mocker, resources):
|
||||
mocked_signals = mocker.patch(
|
||||
'solar.core.resource.resource.Resource.connect_with_events')
|
||||
args = {'ip': 'node1::ip',
|
||||
'servers': ['server1', 'server2'],
|
||||
'alias': 'ser1',
|
||||
'private_ip': 'node1::ip'
|
||||
}
|
||||
cr.update_inputs('service1', args)
|
||||
call_args = mocked_signals.call_args[0][1]
|
||||
assert 'ip' in call_args['ip']
|
||||
assert 'private_ip' in call_args['ip']
|
||||
|
||||
|
||||
def test_parse_connection():
|
||||
correct_connection = {'child_input': 'ip',
|
||||
'parent': 'node1',
|
||||
|
Loading…
x
Reference in New Issue
Block a user