stackabletech / agent

Stackable Agent - a kubelet written in Rust which uses systemd as its backend
Apache License 2.0
15 stars 9 forks source link

Create missing directories #274

Closed siegfriedweber closed 3 years ago

siegfriedweber commented 3 years ago

Description

The following directories are created if they do not exist:

Log output if a directory was created:

[2021-08-27T07:24:53Z INFO  stackable_agent] Directory [data] created which is specified in the configuration option [data-directory].

Log output if an IO error occurred:

[2021-08-27T07:28:51Z ERROR stackable_agent] Could not create the directory [/etc/passwd/data] which is specified in the configuration option [data-directory]. Not a directory (os error 20)
[2021-08-27T07:29:23Z ERROR stackable_agent] Could not create the directory [/lib/data] which is specified in the configuration option [data-directory]. Permission denied (os error 13)

This change is not tested with unit tests because it is mainly about IO, so it does not make sense to try to mock the IO. Furthermore unit tests should not modify the filesystem. It is also not possible to test this change with the integration tests because they only communicate with the agent via the Kubernetes API. So they cannot manipulate the file system on the node and cannot restart the agent.

Closes #105

Review Checklist