-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add refresh-bridges
command
#2573
Add refresh-bridges
command
#2573
Conversation
Codecov ReportAttention:
Additional details and impacted files
|
Robot Results
|
// XXX: having file name squished together with 20 fields which go into file content is a bit obscure | ||
pub config_file: String, |
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.
Fully agree. That said I would not spent too much time refactoring this bridge config. The long-term plan is to implement a direct connection from the mapper to the cloud - removing the need for an external bridge.
const C8Y_CONFIG_FILENAME: &str = "c8y-bridge.conf"; | ||
const AZURE_CONFIG_FILENAME: &str = "az-bridge.conf"; | ||
const AWS_CONFIG_FILENAME: &str = "aws-bridge.conf"; | ||
use crate::bridge::AWS_CONFIG_FILENAME; | ||
use crate::bridge::AZURE_CONFIG_FILENAME; | ||
use crate::bridge::C8Y_CONFIG_FILENAME; |
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.
The fact that these constants where defined for connect, disconnect and reconnect is yet another sign that this module has rotten overtime.
// FIXME: what does this magic number mean? | ||
if token.contains("71") { |
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.
This is the C8Y smartrest code for a jwt token payload. See comment line 239.
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.
My bad, didn't notice the comment above, but still I'm inclined to leave that comment as a reminder that IMO we're using cumulocity smartrest codes magic numbers a bit too much, and having names for all of them defined in the c8y_api
crate would be better.
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.
Apart from the major missing step: "mosquitto restart after the bridge configs are refreshed", the rest of the code looks fine.
tests/RobotFramework/tests/cumulocity/self-update/tedge_self_update.robot
Outdated
Show resolved
Hide resolved
2d95173
to
81bde11
Compare
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.
Approved
Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
Signed-off-by: Marcel Guzik <marcel.guzik@inetum.com>
81bde11
to
b127b2f
Compare
Proposed changes
Add a
tedge refresh-bridges
command which regenerates and overwrites bridge configuration for all active bridges.Types of changes
Paste Link to the issue
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments
It was necessary to extract some stuff from
connect
module, so I did a small refactor in a first commit and the command implementation in the second. I expect there will be some blockers regarding the command itself (naming, and so on), so I could do the first commit as a separate PR.