-
Notifications
You must be signed in to change notification settings - Fork 736
[utils] enhance YAML emission with recursive handling #4177
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
Conversation
d0dc7e7 to
5437847
Compare
5437847 to
8dfbad1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4177 +/- ##
==========================================
+ Coverage 89.31% 89.33% +0.01%
==========================================
Files 259 259
Lines 15684 15711 +27
==========================================
+ Hits 14008 14035 +27
Misses 1676 1676 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I have confirmed that:
HOWEVER: I am getting issues with timeouts, even though the cloud-init configuration completes successfully. For some reason on the latest |
8ebfd65 to
8dfbad1
Compare
|
Because of the issues I have been seeing with updating to the latest upstream of |
src/utils/yaml_node_utils.cpp
Outdated
| // Special handling for strings that look like octal numbers (e.g. "0755") | ||
| if (n.IsScalar()) | ||
| { | ||
| std::string value = n.Scalar(); |
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.
| std::string value = n.Scalar(); | |
| const std::string value = n.Scalar(); |
src/utils/yaml_node_utils.cpp
Outdated
| else | ||
| { | ||
| emitter << n; | ||
| } |
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.
| else | |
| { | |
| emitter << n; | |
| } | |
src/utils/yaml_node_utils.cpp
Outdated
| else | ||
| { | ||
| emitter << n; | ||
| } |
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.
| else | |
| { | |
| emitter << n; | |
| } | |
| emitter << n; |
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.
LGTM 👍
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.
LGTM!
This pull request involves updating the URL of the `yaml-cpp` submodule from our fork's URL to the upstream URL. We implement our fork's changes (double-quoting all strings with a colon `:`) by adding a condition to the recursive YAML emission handling structure introduced in #4177 Launching instances has not been affected, and there has not been a regression introduced in launching instances with cloud-init YAML files.
This pull request involves updating the URL of the `yaml-cpp` submodule from our fork's URL to the upstream URL. We implement our fork's changes (double-quoting all strings with a colon `:`) by adding a condition to the recursive YAML emission handling structure introduced in #4177 Launching instances has not been affected, and there has not been a regression introduced in launching instances with cloud-init YAML files.
fixes #4176
This pull request refactors the
emit_yamlfunction insrc/utils/yaml_node_utils.cppto handle YAML nodes recursively, allowing for the addition of special handling, which is needed to properly handle scalar strings that resemble octal numbers.Enhancements to YAML node handling:
std::string mp::utils::emit_yaml(const YAML::Node& node)to introduce a recursive helper function (emit_node) for processing YAML nodes. This allows the function to handleMap,Sequence, and scalar nodes more robustly.YAML::LocalTag("str")to preserve their string representation in the emitted YAML.These changes seem necessary due to how
yaml-cpphandles re-emission of YAML input. If the YAML input uses quotes ("0755"), the YAML spec says this is a string and should remain a string, however it appears thatyaml-cppis seeing a scalar "0755", and then writing it out in a way that causes it to be emitted as a number. These changes should not affect anything with regards to YAML parsing other than this particular case where a cloud-init file has awrite_filessection with apermissionsstring defined.