Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Add check if configured directories are writable #273

Merged
merged 1 commit into from
Aug 27, 2021
Merged

Conversation

siegfriedweber
Copy link
Member

@siegfriedweber siegfriedweber commented Aug 26, 2021

Description

Check added if the following directories are writable:

  • config
  • data
  • log
  • package
  • directory of the certificate file if the file does not exist
  • directory of the key file if the file does not exist

Check added if the certificate and key files are readable if they exist.

Log output if a directory is not writable:

[2021-08-26T10:14:04Z ERROR stackable_agent] The directory [/] specified in the configuration option [server-cert-file] is not writable by the process.

Log output if an optional file exists but cannot be opened:

[2021-08-26T10:11:58Z ERROR stackable_agent] Could not open file [/test] which is specified in the configuration option [server-cert-file]. 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 #45

Review Checklist

  • Code contains useful comments
  • (Integration-)Test cases added (or not applicable)
  • Documentation added (or not applicable)
  • Changelog updated (or not applicable)

@siegfriedweber siegfriedweber requested a review from a team August 26, 2021 10:07
@siegfriedweber siegfriedweber self-assigned this Aug 26, 2021
Copy link
Member

@maltesander maltesander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@siegfriedweber
Copy link
Member Author

I checked "(Integration-)Test cases added (or not applicable)" due to the reasons mentioned in the description.

@siegfriedweber siegfriedweber merged commit 7c072cc into main Aug 27, 2021
@siegfriedweber siegfriedweber deleted the check_paths branch August 27, 2021 12:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Agent should check on startup if important directories are readable/writable
2 participants