Simon Ruderich [Tue, 6 Apr 2021 09:44:47 +0000 (11:44 +0200)]
remote: add "sync" sub-command to perform changes
Performing the changes when no command line arguments were given became
problematic in ddd21f0 (remote: add ainsl sub-command ("append if no
such line"), 2021-04-04). With "ainsl" as sub-command a user might be
tempted to run the helper manually to test it. But running it without
any arguments causes it to hang (waiting for commands from stdin) which
is confusing. Instead, use the new separate "sync" sub-command to
perform the changes and abort when no sub-command is given.
Simon Ruderich [Mon, 5 Apr 2021 08:36:02 +0000 (10:36 +0200)]
tests: use subtests
This removes the need to print the name of the test in each t.Errorf()
call which reduces unnecessary code. It also permits skipping tests
which will be used in the future.
Simon Ruderich [Sun, 4 Apr 2021 21:35:50 +0000 (23:35 +0200)]
remote: add ainsl sub-command ("append if no such line")
It is preferred to deploy complete files by putting them in the files/
directory of a group. However, sometimes this is not possible because
parts of the file's content are unknown or managed by other programs or
users. An example is .ssh/authorized_keys which should contain certain
keys but which is also managed manually. `ainsl` permits adding a key to
the file without rewriting it completely.
`ainsl` can be used by specifying the following command:
$SAFCM_HELPER ainsl /path/to/file line-to-add
Per default non-existent files are an error. To create the file if
necessary use: