diff --git a/plinth/modules/names/templates/names.html b/plinth/modules/names/templates/names.html index 6c54a6ad2..80effd115 100644 --- a/plinth/modules/names/templates/names.html +++ b/plinth/modules/names/templates/names.html @@ -55,7 +55,7 @@

{% trans "Resolver Status" %}

- {% if resolved_status %} + {% if resolved_installed and resolved_status %}
@@ -107,6 +107,20 @@
+ {% elif not resolved_installed %} +

+ {% blocktrans trimmed %} + systemd-resolved package is not installed. Install it for additional + functionality. + {% endblocktrans %} +

+ {% csrf_token %} + + +
+

{% else %}
{% trans "Error retrieving status:" %} {{ resolved_status_error }} @@ -114,3 +128,9 @@ {% endif %} {% endblock %} + +{% block configuration %} + {% if resolved_installed %} + {{ block.super }} + {% endif %} +{% endblock %} diff --git a/plinth/modules/names/views.py b/plinth/modules/names/views.py index b5e94dcd1..27d3a6376 100644 --- a/plinth/modules/names/views.py +++ b/plinth/modules/names/views.py @@ -31,17 +31,21 @@ class NamesAppView(AppView): def get_initial(self): """Return the values to fill in the form.""" initial = super().get_initial() - initial.update(privileged.get_resolved_configuration()) + if names.is_resolved_installed(): + initial.update(privileged.get_resolved_configuration()) + return initial def get_context_data(self, *args, **kwargs): """Add additional context data for template.""" context = super().get_context_data(*args, **kwargs) context['status'] = get_status() - try: - context['resolved_status'] = resolved.get_status() - except Exception as exception: - context['resolved_status_error'] = exception + context['resolved_installed'] = names.is_resolved_installed() + if context['resolved_installed']: + try: + context['resolved_status'] = resolved.get_status() + except Exception as exception: + context['resolved_status_error'] = exception return context