-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Config Shadow to store config file updates persistently #490
base: main
Are you sure you want to change the base?
Conversation
source/shadow/ConfigShadow.cpp
Outdated
} | ||
else | ||
{ | ||
LOGM_WARN(TAG, "Failed to open config file: %s, Error: %s", configFilePath, strerror(errno)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix in the revision
source/config/Config.h
Outdated
@@ -486,6 +488,7 @@ namespace Aws | |||
static constexpr char DEFAULT_CONFIG_DIR[] = "~/.aws-iot-device-client/"; | |||
static constexpr char DEFAULT_KEY_DIR[] = "~/.aws-iot-device-client/keys/"; | |||
static constexpr char DEFAULT_CONFIG_FILE[] = "~/.aws-iot-device-client/aws-iot-device-client.conf"; | |||
static constexpr char DEFAULT_ROOT_CONFIG_FILE[] = "/etc/.aws-iot-device-client/aws-iot-device-client.conf"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this path fixed for all platforms where device client is supposed to run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Device Client creates the root config file at this location for all platforms if running with root privileges or if running as a systemd service (reference). However I realized that it is not necessary for the user to have a configuration file at both the user and system level, hence I'll add a check for the files before updating them to avoid unnecessary file creations in the PR revision.
source/shadow/ConfigShadow.h
Outdated
* \brief Updates the local configuration file of device client with the config shadow update | ||
* received from the AWS IOT core for persistence of the new device configuration | ||
* @param config device client local configuration | ||
* @param configFilePath file path of the local aws-iot-device-client.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it more correct to say, Absolute file path of device client configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Will update it. Thanks
…les and refactoring
…-iot-device-client into config-shadow-update
Motivation
Modifications
Change summary
The function added modifies the current config shadow feature behavior to update the local configuration files of device client with the new configurations sent via remote config shadow so that they persist over multiple device client restarts
Testing
Tested the changes locally with multiple config shadow updates
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.