traffic_ctl: Display YAML format when --records option is set (instead of the legacy records.config style)#11650
Merged
brbzull0 merged 2 commits intoapache:masterfrom Aug 14, 2024
Conversation
It make sense to display YAML instead of the legacy format in case this out wants to be used as input for ATS. A new bunch of function are added only for traffic_ctl to build up yaml from the record's name. This code uses YAML::Emitter so we can add comments to the yaml doc, this is essential as we are including things like defaults values in Each field, this can only be accomplished with Emitters.
Contributor
Author
|
|
cmcfarlen
approved these changes
Aug 14, 2024
Contributor
cmcfarlen
left a comment
There was a problem hiding this comment.
Worth adding a test or two?
Contributor
Author
definitely yes. I'll add them. |
Contributor
Author
@cmcfarlen : done -> #11740 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes the
traffic_ctl configoutput when--recordsis requested.--recordswas used to display the output of a record in therecords.configconfiguration style:As we do not support
records.configstyle anymore, it now make sense to have just YAML, so the same command will now display:$ traffic_ctl config get proxy.config.diags.show_location proxy.config.diags.logfile_perm proxy.config.diags.logfile.filename --records records: diags: logfile: filename: diags.log logfile_perm: rw-r--r-- show_location: 2For things like
traffic_ctl config diff --recordsit will add the default value as standard YAML comment.Note: This is the main reason why this PR uses
YAML::Emitterand not just theYAML::Nodeto build up the yaml doc, it would have been very easy just to use theYAML::Nodebut it cannot keep track of the comments which for things like thediffoption is key.$ traffic_ctl config diff --records records: diags: debug: tags: quic|udp # default: http|dns show_location: 2 # default: 1 http: server_ports: 8080 4443:ssl 4443:quic # default: 8080 8080:ipv6 quic: initial_max_streams_bidi_in: 5 # default: 100 initial_max_streams_bidi_out: 100000 # default: 100 udp: enable_gso: 0 # default: 1 threads: 1 # default: 0if no
--recordsoption is passed, the behavior remain unchanged.fixes: #11607