-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fixes #15239: Generate a list of directives with their id and mode #2321
Fixes #15239: Generate a list of directives with their id and mode #2321
Conversation
6b9dfeb
to
a36bd7b
Compare
Commit modified |
val csvContent = for { | ||
policy <- policies | ||
} yield { | ||
s"""${policy.id.directiveId.value};${policy.policyMode.getOrElse(policyMode.mode).name};${policy.technique.generationMode.name};${policy.technique.agentConfig.runHooks.nonEmpty};${policy.technique.id.name};${policy.technique.id.version}""" |
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.
What is going to be displayed to user for them to choose? It can't be the uuid, user won't understand. I believe it must be directive name set in UI, or an ID for that.
Also, it need to be sorted by some user interesting thing. I don't know if it's technique/directive, or just directive, or rule/directive... But someone must find it back quickly (even in that file, be it just to minimize changes between run and so that we can compare file by diff).
Also, we need to know if the directive is system (and perhaps just ignore them totally, I'm not sure we want to let the user only run one of them).
Finally, I think we need to group directive that we merged - I'm not sure it's the case at that point, but perhaps it is, I don't remember
a36bd7b
to
c7a7d5a
Compare
Commit modified |
c7a7d5a
to
b340c18
Compare
Commit modified |
val csvContent = for { | ||
policy <- policies | ||
} yield { | ||
s"""${policy.id.directiveId.value};${policy.policyMode.getOrElse(policyMode.mode).name};${policy.technique.generationMode.name};${policy.technique.agentConfig.runHooks.nonEmpty};${policy.technique.id.name};${policy.technique.id.version};"${policy.directiveOrder.value}"""" |
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.
So, we converged with a normalized solution and still easy to parse in shell!
- fully quoted csv, ie: `"field 1","field 2","some " in field 3","some , in last field"
- the first fields MUST be comma-free, only the last can contain comma.
In shell, we will usecut
with the numbered fields for first columns (uuid,etc) and acut
"everything remaining" for last part.
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 first fields are missing the quotes
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.
Update CSV format as indicated please :)
PR rebased |
b340c18
to
54fa04b
Compare
val csvContent = for { | ||
policy <- policies | ||
} yield { | ||
s"""${policy.id.directiveId.value};${policy.policyMode.getOrElse(policyMode.mode).name};${policy.technique.generationMode.name};${policy.technique.agentConfig.runHooks.nonEmpty};${policy.technique.id.name};${policy.technique.id.version};"${policy.directiveOrder.value}"""" |
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 first fields are missing the quotes
…mode Fixes #15239: Generate a list of directives with their id and mode
Commit modified |
last push was a push dto rebase, because it was not compiling due to change in ZioRuntime;) here is the change |
policy.technique.id.version :: | ||
policy.directiveOrder.value :: | ||
Nil ).mkString("\"","\",\"","\"") | ||
|
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.
I believe we need the list to be sorted by directiveOrder
and that we need to know if the technique is system or not.
…id and mode Fixes #15239: Generate a list of directives with their id and mode
Commit modified |
This PR is not mergeable to upper versions. |
… their id and mode Fixes #15239: Generate a list of directives with their id and mode
Commit modified |
This PR is not mergeable to upper versions. |
https://issues.rudder.io/issues/15239