nixos/taskserver: Don't change imperative users

Whenever the nixos-taskserver tool was invoked manually for creating an
organisation/group/user we now add an empty file called .imperative to
the data directory.

During the preStart of the Taskserver service, we use process-json which
in turn now checks whether those .imperative files exist and if so, it
doesn't do anything with it.

This should now ensure that whenever there is a manually created user,
it doesn't get killed off by the declarative configuration in case it
shouldn't exist within that configuration.

In addition, we also add a small subtest to check whether this is
happening or not and fail if the imperatively created user got deleted
by process-json.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig
2016-04-12 03:42:13 +02:00
parent 9586795ef2
commit a41b109bc1
2 changed files with 70 additions and 9 deletions
+9 -1
View File
@@ -41,7 +41,8 @@ import ./make-test.nix {
for my $client ($client1, $client2) {
$client->nest("initialize client for user $user", sub {
$client->succeed(
su $user, "task rc.confirmation=no config confirmation no"
(su $user, "rm -rf /home/$user/.task"),
(su $user, "task rc.confirmation=no config confirmation no")
);
my $exportinfo = $server->succeed(
@@ -156,5 +157,12 @@ import ./make-test.nix {
$client1->succeed(su "bar", "task add destroy even more >&2");
$client1->fail(su "bar", "task sync >&2");
};
readdImperativeUser;
subtest "check whether declarative config overrides user bar", sub {
restartServer;
testSync "bar";
};
'';
}