Closed reubenmiller closed 1 year ago
I did a bit more digging and it seems that there are actually two cases for the Move over file (see below). It depends where the configuration file is being moved from. If the file is being moved from within /etc/tedge/c8y
then the change in file is not detected, however if it is being moved from outside of /etc/tedge/c8y
the change is detected.
These two robot framework test cases show the difference in behaviour (look at the Execute Command
line in both test cases).
Case 1: Move over file (in same directory) - FAIL
Update configuration plugin config via local filesystem move (same directory)
Cumulocity.Should Support Configurations ${DEFAULT_CONFIG} /etc/tedge/tedge.toml system.toml CONFIG1
Transfer To Device ${CURDIR}/c8y-configuration-plugin-updated.toml /etc/tedge/c8y/
Execute Command mv /etc/tedge/c8y/c8y-configuration-plugin-updated.toml /etc/tedge/c8y/c8y-configuration-plugin.toml
Cumulocity.Should Support Configurations ${DEFAULT_CONFIG} /etc/tedge/tedge.toml system.toml CONFIG1 Config@2.0.0
Case 2: Move over file (different directory) - PASS
Update configuration plugin config via local filesystem move (different directory)
Cumulocity.Should Support Configurations ${DEFAULT_CONFIG} /etc/tedge/tedge.toml system.toml CONFIG1
Transfer To Device ${CURDIR}/c8y-configuration-plugin-updated.toml /etc/
Execute Command mv /etc/c8y-configuration-plugin-updated.toml /etc/tedge/c8y/c8y-configuration-plugin.toml
Cumulocity.Should Support Configurations ${DEFAULT_CONFIG} /etc/tedge/tedge.toml system.toml CONFIG1 Config@2.0.0
Describe the bug
The
c8y-configuration-plugin
relies on inotify to detect when edits are done to its configuration file (/etc/tedge/c8y/c8y-configuration-plugin.toml
).Below are the following test cases and current results as of
0.10.0-93-g60e3ba4f
.cp myfile.toml /etc/tedge/c8y/c8y-configuration-plugin.toml
echo '[]' > /etc/tedge/c8y/c8y-configuration-plugin.toml
mv /etc/tedge/c8y/myfile.toml /etc/tedge/c8y/c8y-configuration-plugin.toml
mv /etc/myfile.toml /etc/tedge/c8y/c8y-configuration-plugin.toml
sed -i 's/CONFIG1/CONFIG3/g' /etc/tedge/c8y/c8y-configuration-plugin.toml
To Reproduce
The tests are currently included in PR https://github.com/thin-edge/thin-edge.io/pull/1875.
File:
Expected behavior
Screenshots
Environment (please complete the following information):
Additional context
The following inotify events were produced in the different test cases.
The events were recorded by using the following command on the folder where the
c8y-configuration-plugin.toml
file is stored (not the file directly).Note:
inotifywait
can be installed on debian based systemd usingapt-get install inotify-tools
PASS: Copy over file
PASS: Overwrite file via redirection
FAIL: Move over file (same directory)
FAIL: In place edit