318 Commits

Author SHA1 Message Date
Samuele Pedroni
4570677cc9 many: rename systemd.Kind to Backend for a bit more clarity (#10788)
add some doc comments
adjust/simplify tests using MockNewSystemd
2021-09-24 14:09:05 +02:00
Michael Vogt
6151af3135 Merge pull request #10748 from mardy/systemd-atleast
systemd: add AtLeast() method, add mocking in systemdtest
2021-09-13 17:33:53 +02:00
Alberto Mardegan
57ea536749 systemd: have a specific error for old systemd versions 2021-09-13 13:49:44 +03:00
Alberto Mardegan
93c766478e systemd: allow mocking the systemd version 2021-09-13 13:49:44 +03:00
Alberto Mardegan
86c446dacd systemd: use text.template to generate mount unit 2021-09-13 10:35:33 +03:00
Alberto Mardegan
793e2104d6 systemd: add Origin to description 2021-09-10 12:12:19 +03:00
Alberto Mardegan
31cae3c30e tests: mock systemctl output for listing mount units 2021-09-10 12:12:19 +03:00
Alberto Mardegan
ff307c1d85 systemd: add a method to list mount units created by a snap 2021-09-10 12:12:19 +03:00
Alberto Mardegan
7d86a7d247 systemd: allow creating temporary mount units 2021-09-10 12:12:19 +03:00
Alberto Mardegan
577155014d systemd: add AddMountUnitFileWithOptions()
Taking a struct with parameters makes the method more extensible. We
also add the information about which module caused the creation of the
mount unit, and do not write the revision unless explicitly requested.
2021-09-10 12:12:19 +03:00
Alberto Mardegan
71f6b3484a don't specify rootDir 2021-09-03 13:26:27 +03:00
Alberto Mardegan
45ed587bf4 Update systemd/systemd.go
Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2021-09-03 12:45:06 +03:00
Alberto Mardegan
9b2d256578 systemd: add a method to allow injecting mocked systemd objects 2021-09-02 18:36:41 +03:00
Alberto Mardegan
3a2ca86af3 systemd: export the Reporter type
If we want to be able to mock systemd, this needs to be exported.
2021-09-02 18:36:41 +03:00
Alberto Mardegan
0a6c72c6cb systemd: instantiate the systemd type in a separate function
This will make it easier to inject mocks without having to change the
client code.
2021-09-02 18:36:41 +03:00
Michael Vogt
3c1289e00c vendor.c: new vendor.c subdir
The `go.mod` system has no support to checkout non-go code anymore.
So in order to vendor the squashfuse code we need to come up with
a simple vendoring system ourself it seems.

This will unblock the move to `go.mod` further.
2021-08-18 22:15:51 +02:00
Samuele Pedroni
d92fa5844e wrappers/services.go: do not restart disabled or inactive services
Merge pull request #10266 from mardy/service-restart


This implementes the suggestion described in the forum:
https://forum.snapcraft.io/t/command-line-interface-to-manipulate-services/262/47

Fixes: https://bugs.launchpad.net/snapd/+bug/1803212
2021-06-18 09:48:18 +02:00
Samuele Pedroni
54e84fb8db many: fix imports order (according to gci)
had to make the comment in wrappers/services_test.go a one-liner
otherwise half of it is lost

last set of files needing changing (as per current master)
2021-06-16 09:54:31 +02:00
Ian Johnson
bcbc27a816 systemd: refactor "[not set]" handling in getPropertyUintValue
As suggested by Michael

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-06-11 09:54:22 -05:00
Alberto Mardegan
256dafa6c2 many: address review comments 2021-06-11 11:36:40 +03:00
Ian Johnson
00c84e7e2e systemd: refactor property parsers for int values in CurrentTasksCount, etc
As suggested by Maciej, Michael and Samuele in snapcore/snapd#10354.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-06-10 15:31:31 -05:00
Alberto Mardegan
8d7b3e68be systemd: create a systemdtest package 2021-06-09 16:53:03 +03:00
Alberto Mardegan
0bb437a669 many: address review comments 2021-06-09 08:55:44 +03:00
Alberto Mardegan
1f6d7efd01 Merge branch 'master' into service-restart 2021-06-09 08:38:56 +03:00
Alberto Mardegan
f5fba92f9e Merge branch 'master' into service-restart 2021-06-08 08:55:17 +03:00