diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 1f77e3545..fe3ea830f 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -78,7 +78,7 @@ def service_add(name, description=None, log=None, log_type=None, test_status=Non if not description: # Try to get the description from systemd service unit, _ = _get_service_information_from_systemd(name) - description = unit.get("Description", "") if unit is not None else "" + description = str(unit.get("Description", "")) if unit is not None else "" # If the service does not yet exists or if the description is empty, # systemd will anyway return foo.service as default value, so we wanna # make sure there's actually something here. diff --git a/src/yunohost/tests/test_service.py b/src/yunohost/tests/test_service.py index ffe3629c5..c51073c54 100644 --- a/src/yunohost/tests/test_service.py +++ b/src/yunohost/tests/test_service.py @@ -25,7 +25,11 @@ def clean(): if "dummyservice" in services: del services["dummyservice"] - _save_services(services) + + if "networking" in services: + del services["networking"] + + _save_services(services) def test_service_status_all(): @@ -60,6 +64,10 @@ def test_service_add(): service_add("dummyservice", description="A dummy service to run tests") assert "dummyservice" in service_status().keys() +def test_service_add_real_service() + + service_add("networking") + assert "networking" in service_status().keys() def test_service_remove():