]> ruderich.org/simon Gitweb - safcm/safcm.git/log
safcm/safcm.git
3 years agotests: add and use testutil package to reduce duplication
Simon Ruderich [Mon, 5 Apr 2021 09:20:02 +0000 (11:20 +0200)]
tests: add and use testutil package to reduce duplication

This is not as explicit as the previous code but still good enough. And
it gets rid of quite some boilerplate.

3 years agoconfig: remove unnecessary os.Chdir in test
Simon Ruderich [Mon, 5 Apr 2021 08:47:40 +0000 (10:47 +0200)]
config: remove unnecessary os.Chdir in test

3 years agotests: go fmt and rewrap
Simon Ruderich [Mon, 5 Apr 2021 08:44:52 +0000 (10:44 +0200)]
tests: go fmt and rewrap

3 years agotests: use subtests
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.

3 years agosafcm: add -q (quiet) command line option
Simon Ruderich [Mon, 5 Apr 2021 07:35:37 +0000 (09:35 +0200)]
safcm: add -q (quiet) command line option

3 years agoremote: add ainsl sub-command ("append if no such line")
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:

    $SAFCM_HELPER ainsl -create /path/to/file line-to-add

The environment variable $SAFCM_HELPER is set when executing commands
and contains the absolute path to the remote helper.

3 years agosync: add SAFCM_HELPER environment variable to commands
Simon Ruderich [Sun, 4 Apr 2021 19:27:31 +0000 (21:27 +0200)]
sync: add SAFCM_HELPER environment variable to commands

Contains the absolute path to the remote helper binary. Will be useful
in the future when the remote helper gets additional subcommands.

3 years agosync: move file related test functions to new package filetest
Simon Ruderich [Sun, 4 Apr 2021 19:25:14 +0000 (21:25 +0200)]
sync: move file related test functions to new package filetest

They will be used by other packages in the near future.

3 years agoremote: remove duplicate call to log.SetFlags()
Simon Ruderich [Sun, 4 Apr 2021 10:36:44 +0000 (12:36 +0200)]
remote: remove duplicate call to log.SetFlags()

3 years agosync: refactor temporary file creation into WriteTemp()
Simon Ruderich [Sun, 4 Apr 2021 08:50:05 +0000 (10:50 +0200)]
sync: refactor temporary file creation into WriteTemp()

Make it public because it will be used by other packages in the near
future.

3 years agosync: remove duplication when setting path to temporary file
Simon Ruderich [Sun, 4 Apr 2021 08:43:19 +0000 (10:43 +0200)]
sync: remove duplication when setting path to temporary file

3 years agofixperms: use safcm-remote.sync's OpenFileNoFollow()
Simon Ruderich [Sun, 4 Apr 2021 08:40:13 +0000 (10:40 +0200)]
fixperms: use safcm-remote.sync's OpenFileNoFollow()

3 years agosync: refactor file opening into OpenFileNoFollow()
Simon Ruderich [Sun, 4 Apr 2021 08:35:22 +0000 (10:35 +0200)]
sync: refactor file opening into OpenFileNoFollow()

Make it public because it will be used by other packages in the next
commit.

3 years agoci: run go vet
Simon Ruderich [Sun, 4 Apr 2021 06:47:40 +0000 (08:47 +0200)]
ci: run go vet

3 years agoconfig: forbid host names which conflict with special groups
Simon Ruderich [Sun, 4 Apr 2021 06:46:00 +0000 (08:46 +0200)]
config: forbid host names which conflict with special groups

3 years agofixperms: don't follow symlinks
Simon Ruderich [Sun, 4 Apr 2021 06:25:57 +0000 (08:25 +0200)]
fixperms: don't follow symlinks

This prevents a possible TOCTOU when chmodding files.

3 years agoconfig: add Host option "ssh_user"
Simon Ruderich [Sat, 3 Apr 2021 13:57:54 +0000 (15:57 +0200)]
config: add Host option "ssh_user"

If it's empty or not present the default user of `ssh` is used. This is
either the current user or the user configured in ~/.ssh/config.

3 years agoAdd support for armv7l SoCs like Raspberry Pi 2 and newer
Markus [Fri, 2 Apr 2021 20:39:26 +0000 (22:39 +0200)]
Add support for armv7l SoCs like Raspberry Pi 2 and newer

3 years agoAdd .gitlab-ci.yml
Simon Ruderich [Sat, 3 Apr 2021 13:06:54 +0000 (15:06 +0200)]
Add .gitlab-ci.yml

3 years agoFirst working version
Simon Ruderich [Sat, 3 Apr 2021 13:02:39 +0000 (15:02 +0200)]
First working version

3 years agoInitial commit
Simon Ruderich [Fri, 19 Mar 2021 17:52:52 +0000 (18:52 +0100)]
Initial commit