diff --git a/plinth/modules/apache/components.py b/plinth/modules/apache/components.py index d993d3235..77fa70239 100644 --- a/plinth/modules/apache/components.py +++ b/plinth/modules/apache/components.py @@ -44,7 +44,7 @@ class Webserver(app.LeaderComponent): self.kind = kind self.urls = urls or [] self.expect_redirects = expect_redirects - self.last_updated_version = last_updated_version + self.last_updated_version = last_updated_version or 0 def is_enabled(self): """Return whether the Apache configuration is enabled.""" diff --git a/plinth/modules/apache/tests/test_components.py b/plinth/modules/apache/tests/test_components.py index 35a120c33..491452e61 100644 --- a/plinth/modules/apache/tests/test_components.py +++ b/plinth/modules/apache/tests/test_components.py @@ -109,6 +109,14 @@ def test_webserver_setup(service_reload, service_restart): return self.enabled app1 = AppTest() + + # Don't fail when last_updated_version is not provided. + webserver1 = Webserver('test-webserver1', 'test-config') + assert webserver1.last_updated_version == 0 + webserver1.setup(old_version=10) + service_reload.assert_not_called() + service_restart.assert_not_called() + webserver1 = Webserver('test-webserver1', 'test-config', last_updated_version=5) for version in (0, 5, 6):