-
Notifications
You must be signed in to change notification settings - Fork 260
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
Feature: enable configuration updates #1026
Feature: enable configuration updates #1026
Conversation
Signed-off-by: Jeffrey Martin <[email protected]>
Signed-off-by: Jeffrey Martin <[email protected]>
* adjust `fixer` to expect a `dict` * add cli `--fix` option supporting various cli config inputs Signed-off-by: Jeffrey Martin <[email protected]>
Signed-off-by: Jeffrey Martin <[email protected]>
Signed-off-by: Jeffrey Martin <[email protected]>
Signed-off-by: Jeffrey Martin <[email protected]>
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.
coupla minor points, looks good in general
garak/probes/av_spam_scanning.py
Outdated
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 uses aliases
? same comment for other probes
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.
Currently just for --plugin_info
output, I could see skipping them or enabling interactive
to use them later as hints for outdated command requests.
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'm into it -- it enables deprecation pretty easily too. Could warn on the use of aliases and fix it at some point, especially via interactive.
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.
ok, that's cool. we might like to choose now how diligent we intend to be about this - are aliases
only given as indications, or do we guarantee that they're exhaustive?
there's a duplication of info here (because it's already given in fixer
modules) that i'm mindful of
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.
Agreed I tried to note in the description this becomes a required
step when adding a migration that impacts a plugin name however there is no enforcement/early warning mechanism currently in place, we could add a lint
like action that checks for plugin file or class renames as a warning/hint on PRs.
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.
Very into this as a clean way to help manage deprecation. Awesome work here, @jmartin-tech
garak/probes/av_spam_scanning.py
Outdated
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'm into it -- it enables deprecation pretty easily too. Could warn on the use of aliases and fix it at some point, especially via interactive.
* improved docs to reference plugin `family` name changes * spelling for log of successful action * more specific removal of file extension in filename Signed-off-by: Jeffrey Martin <[email protected]>
b3ca38f
to
0a06d39
Compare
What's going on with the unmatched |
You have a good point, the |
fix #889
Provides a path for forward migration of configuration when plugins or other configuration based parameter change between versions.
As an initial capability this acts similar to the
packer fix
command by accepting input of outdated configuration to produce an equivalent configuration for the current version ofgarak
. To support fixing a previous configuration tooling is added to createMigration
classes to be detected and run in order to modify and entires in the configuration based on structural or naming changes ingarak
.The following process can be used to add new
Migration
to the applied set used tofix
a configuration:Mirgation
filegarak/resources/fixer/
with a filename that formattedas
YYYYMMDD_some_descriptive_name.py
garak.resources.fixer.Migration
with anapply()
method that accepts an existing dictionary and returns a new modified dictionary without any side-effects to the original passed dictionary.alias
should be added to the plugin class attributes.When a user calls
garak
with the--fix
cli parameter the configuration change detected as requiring update will be applied to and an equivalent updated configuration will be output.Expected action when
--fix
is specified:--*_option_file
or--*_options
, json output will be generated if any change is required.--config
or no additional configuration based flags yaml will be output if changes are required for the user supplied configuration as well asgarak.site.yaml
if found in the env.Additional changes:
options
andoption_file
support for all plugin typesVerification
Example usage and outputs:
old.yaml:
garak.site.yaml:
probe.json
garak.log
reports application of each applicable fix for various configs.