Add support for unreachable hosts
This commit is contained in:
@@ -73,8 +73,9 @@ class CallbackModule(CallbackBase):
|
||||
'duration': duration,
|
||||
'result': json.dumps(result._result),
|
||||
'changed': result._result['changed'],
|
||||
'skipped': result._result['skipped'],
|
||||
'failed': result._result['failed'],
|
||||
'skipped': result._result['skipped'],
|
||||
'unreachable': result._result['unreachable'],
|
||||
'ignore_errors': self.task.ignore_errors or False
|
||||
})
|
||||
db.session.add(data)
|
||||
@@ -89,6 +90,7 @@ class CallbackModule(CallbackBase):
|
||||
'playbook_uuid': self.playbook_uuid,
|
||||
'host': host,
|
||||
'changed': host_stats['changed'],
|
||||
'unreachable': host_stats['unreachable'],
|
||||
'failures': host_stats['failures'],
|
||||
'ok': host_stats['ok'],
|
||||
'skipped': host_stats['skipped']
|
||||
@@ -113,7 +115,7 @@ class CallbackModule(CallbackBase):
|
||||
result.task_start = self.task_start
|
||||
result.task_end = datetime.datetime.now()
|
||||
|
||||
status_keys = ['changed', 'failed', 'skipped']
|
||||
status_keys = ['changed', 'failed', 'skipped', 'unreachable']
|
||||
for status in status_keys:
|
||||
if status not in result._result:
|
||||
result._result[status] = False
|
||||
|
||||
@@ -40,8 +40,9 @@ class Tasks(db.Model):
|
||||
duration = db.Column(db.String)
|
||||
result = db.Column(db.Text)
|
||||
changed = db.Column(db.Integer)
|
||||
skipped = db.Column(db.Integer)
|
||||
failed = db.Column(db.Integer)
|
||||
skipped = db.Column(db.Integer)
|
||||
unreachable = db.Column(db.Integer)
|
||||
ignore_errors = db.Column(db.Integer)
|
||||
|
||||
def __repr__(self):
|
||||
@@ -56,6 +57,7 @@ class Stats(db.Model):
|
||||
failures = db.Column(db.Integer)
|
||||
ok = db.Column(db.Integer)
|
||||
skipped = db.Column(db.Integer)
|
||||
unreachable = db.Column(db.Integer)
|
||||
|
||||
def __repr__(self):
|
||||
return '<Stats %r>' % self.host
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
<div class="col-md-6">
|
||||
<h2>Run information</h2>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<div class="col-md-12 text-right">
|
||||
<h3>Filter by status</h3>
|
||||
<a href="/host/{{ host }}/ok"><label class="label status-filter OK" style="margin-right: 5px;">OK</label></a>
|
||||
<a href="/host/{{ host }}/changed"><label class="label status-filter CHANGED" style="margin-right: 5px;">CHANGED</label></a>
|
||||
<a href="/host/{{ host }}/skipped"><label class="label status-filter SKIPPED" style="margin-right: 5px;">SKIPPED</label></a>
|
||||
<a href="/host/{{ host }}/failed"><label class="label status-filter FAILED" style="margin-right: 5px;">FAILED</label></a>
|
||||
<a href="/host/{{ host }}/unreachable"><label class="label status-filter UNREACHABLE" style="margin-right: 5px;">UNREACHABLE</label></a>
|
||||
<a href="/host/{{ host }}/ignored"><label class="label status-filter SKIPPED" >IGNORED</label></a>
|
||||
<a href="/host/{{ host }}"><label class="label status-filter label-default" >ALL</label></a>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
background-color: #9d8000;
|
||||
}
|
||||
.UNREACHABLE {
|
||||
background-color: #9d8000;
|
||||
background-color: #a30000;
|
||||
}
|
||||
|
||||
tr.results {
|
||||
@@ -42,9 +42,7 @@
|
||||
}
|
||||
|
||||
.label.status-filter {
|
||||
font-size: 120%;
|
||||
padding-bottom: 1px;
|
||||
padding-top: 1px;
|
||||
font-size: 110%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -47,9 +47,10 @@
|
||||
<tr>
|
||||
<th class="text-center">Host</th>
|
||||
<th class="text-center"><a href="/playbook/{{ playbook }}/ok"><label class="label OK">OK</label></a></th>
|
||||
<th class="text-center"><a href="/playbook/{{ playbook }}/changed"><label class="label CHANGED">CHANGED</label></th>
|
||||
<th class="text-center"><a href="/playbook/{{ playbook }}/skipped"><label class="label SKIPPED">SKIPPED</label></th>
|
||||
<th class="text-center"><a href="/playbook/{{ playbook }}/failed"><label class="label FAILED">FAILED</label></th>
|
||||
<th class="text-center"><a href="/playbook/{{ playbook }}/changed"><label class="label CHANGED">CHANGED</label></a></th>
|
||||
<th class="text-center"><a href="/playbook/{{ playbook }}/skipped"><label class="label SKIPPED">SKIPPED</label></a></th>
|
||||
<th class="text-center"><a href="/playbook/{{ playbook }}/failed"><label class="label FAILED">FAILED</label></a></th>
|
||||
<th class="text-center"><a href="/playbook/{{ playbook }}/unreachable"><label class="label UNREACHABLE">UNREACHABLE</label></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -60,6 +61,7 @@
|
||||
<td class="text-center">{{ row.changed }}</td>
|
||||
<td class="text-center">{{ row.skipped }}</td>
|
||||
<td class="text-center">{{ row.failures }}</td>
|
||||
<td class="text-center">{{ row.unreachable }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -68,12 +70,13 @@
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row" style="display: flex; align-items: center;">
|
||||
<div class="col-md-offset-6 col-md-6 text-right">
|
||||
<div class="col-md-12 text-right">
|
||||
<h3>Filter by status</h3>
|
||||
<a href="/playbook/{{ playbook }}/ok"><label class="label status-filter OK" style="margin-right: 5px;">OK</label></a>
|
||||
<a href="/playbook/{{ playbook }}/changed"><label class="label status-filter CHANGED" style="margin-right: 5px;">CHANGED</label></a>
|
||||
<a href="/playbook/{{ playbook }}/skipped"><label class="label status-filter SKIPPED" style="margin-right: 5px;">SKIPPED</label></a>
|
||||
<a href="/playbook/{{ playbook }}/failed"><label class="label status-filter FAILED" style="margin-right: 5px;">FAILED</label></a>
|
||||
<a href="/playbook/{{ playbook }}/unreachable"><label class="label status-filter UNREACHABLE" style="margin-right: 5px;">UNREACHABLE</label></a>
|
||||
<a href="/playbook/{{ playbook }}/ignored"><label class="label status-filter SKIPPED" >IGNORED</label></a>
|
||||
<a href="/playbook/{{ playbook }}"><label class="label status-filter label-default" >ALL</label></a>
|
||||
</div>
|
||||
|
||||
@@ -44,9 +44,10 @@
|
||||
<tr>
|
||||
<th class="text-center">Host</th>
|
||||
<th class="text-center"><a href="/run/{{ id }}/ok"><label class="label OK">OK</label></a></th>
|
||||
<th class="text-center"><a href="/run/{{ id }}/changed"><label class="label CHANGED">CHANGED</label></th>
|
||||
<th class="text-center"><a href="/run/{{ id }}/skipped"><label class="label SKIPPED">SKIPPED</label></th>
|
||||
<th class="text-center"><a href="/run/{{ id }}/failed"><label class="label FAILED">FAILED</label></th>
|
||||
<th class="text-center"><a href="/run/{{ id }}/changed"><label class="label CHANGED">CHANGED</label></a></th>
|
||||
<th class="text-center"><a href="/run/{{ id }}/skipped"><label class="label SKIPPED">SKIPPED</label></a></th>
|
||||
<th class="text-center"><a href="/run/{{ id }}/failed"><label class="label FAILED">FAILED</label></a></th>
|
||||
<th class="text-center"><a href="/run/{{ id }}/unreachable"><label class="label UNREACHABLE">UNREACHABLE</label></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -57,6 +58,7 @@
|
||||
<td class="text-center">{{ row.changed }}</td>
|
||||
<td class="text-center">{{ row.skipped }}</td>
|
||||
<td class="text-center">{{ row.failures }}</td>
|
||||
<td class="text-center">{{ row.unreachable }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -65,12 +67,13 @@
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row" style="display: flex; align-items: center;">
|
||||
<div class="col-md-offset-6 col-md-6 text-right">
|
||||
<div class="col-md-12 text-right">
|
||||
<h3>Filter by status</h3>
|
||||
<a href="/run/{{ id }}/ok"><label class="label status-filter OK" style="margin-right: 5px;">OK</label></a>
|
||||
<a href="/run/{{ id }}/changed"><label class="label status-filter CHANGED" style="margin-right: 5px;">CHANGED</label></a>
|
||||
<a href="/run/{{ id }}/skipped"><label class="label status-filter SKIPPED" style="margin-right: 5px;">SKIPPED</label></a>
|
||||
<a href="/run/{{ id }}/failed"><label class="label status-filter FAILED" style="margin-right: 5px;">FAILED</label></a>
|
||||
<a href="/run/{{ id }}/unreachable"><label class="label status-filter UNREACHABLE" style="margin-right: 5px;">UNREACHABLE</label></a>
|
||||
<a href="/run/{{ id }}/ignored"><label class="label status-filter SKIPPED" >IGNORED</label></a>
|
||||
<a href="/run/{{ id }}"><label class="label status-filter label-default" >ALL</label></a>
|
||||
</div>
|
||||
|
||||
@@ -49,6 +49,8 @@ def jinja_pick_status(row):
|
||||
return 'SKIPPED'
|
||||
if row.failed:
|
||||
return 'FAILED'
|
||||
if row.unreachable:
|
||||
return 'UNREACHABLE'
|
||||
return 'OK'
|
||||
|
||||
|
||||
@@ -92,6 +94,7 @@ def status_to_query(status=None):
|
||||
},
|
||||
'failed': {'failed': 1},
|
||||
'skipped': {'skipped': 1},
|
||||
'unreachable': {'unreachable': 1}
|
||||
}[status]
|
||||
else:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user