Submitting PR for vyos.vyos module

35 views
Skip to first unread message

pigriffin

unread,
Aug 19, 2021, 11:27:40 PM8/19/21
to Ansible Development
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.

David Moreau Simard

unread,
Aug 20, 2021, 11:23:49 PM8/20/21
to Ansible Development
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.

Gomathi Selvi Srinivasan

unread,
Aug 24, 2021, 11:01:19 AM8/24/21
to Ansible Development
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

pigriffin

unread,
Jan 11, 2022, 2:40:11 AMJan 11
to Ansible Development
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...

Gomathi Selvi Srinivasan

unread,
Jan 11, 2022, 9:42:17 AMJan 11
to pigriffin, Ansible Development
Hi,
Can you please share the model you are using with cli_rm_builder?

Thanks ,
Gomathi

--------------------
Senior Software Engineer,
Ansible




--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-devel/ENz46q7kV5Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/d1bf03f5-16aa-49b2-ab01-9baa70e57976n%40googlegroups.com.

pigriffin

unread,
Jan 11, 2022, 6:22:15 PMJan 11
to Ansible Development
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.
Reply all
Reply to author
Forward
0 new messages