|
|
@ -19,10 +19,13 @@ class AdHocExecutionSerializer(serializers.ModelSerializer):
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def get_stat(obj):
|
|
|
|
def get_stat(obj):
|
|
|
|
|
|
|
|
count_failed_hosts = len(obj.failed_hosts)
|
|
|
|
|
|
|
|
count_success_hosts = len(obj.success_hosts)
|
|
|
|
|
|
|
|
count_total = count_success_hosts + count_failed_hosts
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
"total": obj.hosts_amount,
|
|
|
|
"total": count_total,
|
|
|
|
"success": len(obj.summary.get("contacted", [])),
|
|
|
|
"success": count_success_hosts,
|
|
|
|
"failed": len(obj.summary.get("dark", [])),
|
|
|
|
"failed": count_failed_hosts
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def get_field_names(self, declared_fields, info):
|
|
|
|
def get_field_names(self, declared_fields, info):
|
|
|
|