Ignore changes in selected systemd units

This commit implements a possibility of ignoring changes in specified
systemd unit as proposed by [1]. This can be useful in cases where
some of the units are behaving badly (but not affecting the health
of a whole system).
Add a CLI option `--systemd-ignore-unit` to let user specify which units
should be ignored.

[1]: https://github.com/CESNET/velia/issues/1

Change-Id: I5902151b4ac95bdcd9aacf29c0189fb62537497f
diff --git a/tests/input-systemd.cpp b/tests/input-systemd.cpp
index 001d449..02a6ae3 100644
--- a/tests/input-systemd.cpp
+++ b/tests/input-systemd.cpp
@@ -36,14 +36,15 @@
     // create units. Unit2 and Unit3 are in states that we consider failed
     // therefore the DbusSystemdInput will report ERROR after loading the second unit
     // FailedUnits: {unit2, unit3} -> ERROR
-    server.createUnit(*serverConnection, "/cz/cesnet/systemd1/unit/unit1", "active", "running");
-    server.createUnit(*serverConnection, "/cz/cesnet/systemd1/unit/unit2", "activating", "auto-restart");
-    server.createUnit(*serverConnection, "/cz/cesnet/systemd1/unit/unit3", "failed", "failed");
+    server.createUnit(*serverConnection, "unit1.service", "/cz/cesnet/systemd1/unit/unit1", "active", "running");
+    server.createUnit(*serverConnection, "unit2.service", "/cz/cesnet/systemd1/unit/unit2", "activating", "auto-restart");
+    server.createUnit(*serverConnection, "unit3.service", "/cz/cesnet/systemd1/unit/unit3", "failed", "failed");
+    server.createUnit(*serverConnection, "unitIgnored.service", "/cz/cesnet/systemd1/unit/unitIgnored", "failed", "failed");
 
     REQUIRE_CALL(*mx, updateState(ANY(void*), velia::State::OK)).IN_SEQUENCE(seq1);
     REQUIRE_CALL(*mx, updateState(ANY(void*), velia::State::ERROR)).IN_SEQUENCE(seq1);
     REQUIRE_CALL(*mx, updateState(ANY(void*), velia::State::ERROR)).IN_SEQUENCE(seq1);
-    auto i1 = std::make_shared<velia::DbusSystemdInput>(mx, *clientConnection, "cz.cesnet.systemd1", "/cz/cesnet/systemd1", "cz.cesnet.systemd1.Manager", "cz.cesnet.systemd1.Unit");
+    auto i1 = std::make_shared<velia::DbusSystemdInput>(mx, std::set<std::string> {"unitIgnored.service"}, *clientConnection, "cz.cesnet.systemd1", "/cz/cesnet/systemd1", "cz.cesnet.systemd1.Manager", "cz.cesnet.systemd1.Unit");
     // i1 now listens for dbus events, we can start the semaphore server
 
     // FailedUnits: {unit3} -> ERROR
@@ -57,7 +58,12 @@
     // add new unit with failed/failed, DbusSystemdInput should receive UnitNew signal and monitor this unit too
     // FailedUnits: {unit4} -> OK
     REQUIRE_CALL(*mx, updateState(i1.get(), velia::State::ERROR)).IN_SEQUENCE(seq1);
-    server.createUnit(*serverConnection, "/cz/cesnet/systemd1/unit/unit4", "failed", "failed");
+    server.createUnit(*serverConnection, "unit4.service", "/cz/cesnet/systemd1/unit/unit4", "failed", "failed");
+
+    // unitIgnored is ignored by us, so it can change in any way but since we don't obtain the notifications, nothing will happen
+    server.changeUnitState("/cz/cesnet/systemd1/unit/unitIgnored", "failed", "failed");
+    server.changeUnitState("/cz/cesnet/systemd1/unit/unitIgnored", "active", "auto-restarting");
+    server.changeUnitState("/cz/cesnet/systemd1/unit/unitIgnored", "active", "running");
 
     waitForCompletionAndBitMore(seq1);