Submitting PR for vyos.vyos module

Hi all. I haven’t submitted to ansible before and need a bit of guidance if anyone’s got time!
My actual change is to add a single parameter in the vyos.vyos collection, and is only a few lines. But to get to the point, for updates to the vyos.vyos collection:

  1. should I use ‘Resource module builder’ or CLI_RM_BUILDER; and
  2. If it’s CLI_RM_BUILDER, does it still use the models repository, or something else?

Thanks for your time.

Hi o/

I do not have the answer but will ask around.

In the meantime, looking at the existing (or closed!) PRs for the collection might help understanding how it works ?

Let us know if you find the answer.

Hi,

CLI_RM_BUILDER is the right tool to use to build a model or add keys or delete keys.
Please refer to this doc. The documentation work for cli_rm_builder tool is still in progress.
Let me know if anything is not clear with respect to cli_rm_builder tool usage.

Thanks,
Gomathi

Hi Gomathi. I’ve finally got back to this! when I run cli_rm_builder against the existing vyos.firewall_rules module (or my modified version), it fails with an error. The problem is when ‘convert_doc_to_ansible_module_kwargs’ calls ‘extract_argspec(doc_obj, argpsec)’, ‘extract_argspec’ tries to access the ‘options’ key, which doesn’t exist. ‘doc_obj’ contains a dictionary which has the ‘DOCUMENTATION’ key at its top level. The value of the ‘DOCUMENTATION’ key is a string containing the doc yaml. If I replace the ‘extract_argspec’ function with a version starting with the following (ie. decoding the ‘DOCUMENTATION’ string), and modify ‘convert_doc_to_ansible_module_kwargs’ to call this version, it seems to work:

def extract_argspecX(doc_obj, argpsec):
d_obj = yaml.load(doc_obj[‘DOCUMENTATION’], SafeLoader)
options_obj = d_obj.get(“options”)

So my question is, is this a bug in CLI_RM_BUILDER, or could it be something in the way that I’m calling it that is causing it to fail?

Thanks for your time…

Hi,
Can you please share the model you are using with cli_rm_builder?

Yes, its the master branch from https://github.com/pigriffin/resource_module_models/tree/master, which is the same as the upstream master.

I’m just testing with none of my changes, to make sure that I’ve got the tools setup properly, but not having any luck.