Commit 8a87f316 authored by ibuler's avatar ibuler

[Update] 兼容之前的protocols格式

parent 2cd092af
......@@ -27,6 +27,10 @@ class ProtocolsRelatedField(serializers.RelatedField):
return str(value)
def to_internal_value(self, data):
print(data)
print(type(data))
if isinstance(data, dict):
return data
if '/' not in data:
raise ValidationError("protocol not contain /: {}".format(data))
v = data.split("/")
......
......@@ -199,7 +199,7 @@ def test_asset_connectivity_util(assets, task_name=None):
contacted=defaultdict(dict), dark=defaultdict(dict), success=True
)
created_by = assets[0].org_id
for _, value in hosts_category.items():
for k, value in hosts_category.items():
if not value['hosts']:
continue
task, created = update_or_create_ansible_task(
......@@ -324,7 +324,7 @@ def test_system_user_connectivity_util(system_user, assets, task_name):
results_summary = dict(
contacted=defaultdict(dict), dark=defaultdict(dict), success=True
)
for _, value in hosts_category.items():
for k, value in hosts_category.items():
if not value['hosts']:
continue
task, created = update_or_create_ansible_task(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment