mirror of https://github.com/jumpserver/jumpserver
parent
d415e81add
commit
6aaa106aff
|
@ -218,8 +218,8 @@ class AdHoc(models.Model):
|
||||||
history.result = raw
|
history.result = raw
|
||||||
history.summary = summary
|
history.summary = summary
|
||||||
return raw, summary
|
return raw, summary
|
||||||
except:
|
except Exception as e:
|
||||||
return {}, {}
|
return {}, {"dark": {"all": str(e)}, "contacted": []}
|
||||||
finally:
|
finally:
|
||||||
history.date_finished = timezone.now()
|
history.date_finished = timezone.now()
|
||||||
history.timedelta = time.time() - time_start
|
history.timedelta = time.time() - time_start
|
||||||
|
|
|
@ -43,8 +43,8 @@ class AdHocRunHistorySerializer(serializers.ModelSerializer):
|
||||||
def get_stat(obj):
|
def get_stat(obj):
|
||||||
return {
|
return {
|
||||||
"total": len(obj.adhoc.hosts),
|
"total": len(obj.adhoc.hosts),
|
||||||
"success": len(obj.summary["contacted"]),
|
"success": len(obj.summary.get("contacted", [])),
|
||||||
"failed": len(obj.summary["dark"]),
|
"failed": len(obj.summary.get("dark", [])),
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_field_names(self, declared_fields, info):
|
def get_field_names(self, declared_fields, info):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% block first_login_message %}
|
{% block first_login_message %}
|
||||||
{% if user.is_authenticated and user.is_first_login %}
|
{% if request.user.is_authenticated and request.user.is_first_login %}
|
||||||
<div class="alert alert-danger help-message">
|
<div class="alert alert-danger help-message">
|
||||||
{% url 'users:user-first-login' as first_login_url %}
|
{% url 'users:user-first-login' as first_login_url %}
|
||||||
{% blocktrans %}
|
{% blocktrans %}
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block update_public_key_message %}
|
{% block update_public_key_message %}
|
||||||
{% if user.is_authenticated and not user.is_public_key_valid %}
|
{% if request.user.is_authenticated and not request.user.is_public_key_valid %}
|
||||||
<div class="alert alert-danger help-message">
|
<div class="alert alert-danger help-message">
|
||||||
{% url 'users:user-pubkey-update' as user_pubkey_update %}
|
{% url 'users:user-pubkey-update' as user_pubkey_update %}
|
||||||
{% blocktrans %}
|
{% blocktrans %}
|
||||||
|
|
Loading…
Reference in New Issue