Closed scotchoaf closed 5 years ago
Testing more the python parsing is now showing the value but only a single value, last in the list, so perhaps a checkbox list issue. This could be useful if the code filters based on checkbox=True for each item in the list and then creates the arg --name=value where the name is the var name.
Looks like in the python code you can use:
parser.add_argument("--security_rules", action='append')
and this will create a list to send into python code with the values from the checked items in the list.
Use Case: I have a script to get all of the security rules from the firewall and would be able to feed this into a second .meta-cnc.yaml file var section to generate the checkbox list for second skillet that adds data (eg. zone, profile-group, tag...) to the set of rules.
@scotchoaf example python script to handle list type input args is here. let me know if this works for your use case: https://github.com/nembery/Skillets/tree/experimental/skillets_by_type/python/input_args
this was implemented using csv delimited env or cli args
The python skillet appears to only work with single value inputs as '--name value', name from the var section of the metadata file. Want to use a checkbox list model and var section parsing should be using each key/value pair in the list as '--key value' as an argument and ignore the name attribute.
cnc tasks.py likely should include: if type == 'checkbox' then: and parses the variables values differently than the text and other var types. Although not sure if the key (displayed value) is sent in as a value and value can be used as a variable key - no reversed?
https://github.com/PaloAltoNetworks/pan-cnc/blob/f3278ebbafe0ec312290568eab6173013b5a54f5/pan_cnc/tasks.py#L265
from def python3_execute_script: