Thank you for such a beautiful explanation On Mon, 30 Aug 2021, 22:48 Sagar Paul, <[email protected]> wrote:
> Hey Nitesh, > > For a cli based module, we recommend cli_rm_builder, but there are a few > more things that make the cli_rm_builder different from > resource_module_builder, like - > > - with cli_rm_builder the code that is scaffolded with RMEngineBase > which is leveraged by Ansible Network Team for cli based resource modules. > - the code that gets scaffolded is more consistent over the platforms > available, even makes the whole development faster and better in terms of > experience. > - implementation of facts is easier as parsers are defined to generate > facts. > - the model is the docstring that becomes the argspec and the Source > Of truth (SOT), that can be updated on the go and the tool takes care of > all the updates in the model in terms of argspec. > - the state-based implementation of logic is cleaner as the logic is > written over a defined structured data aka facts. > > these are few points of how the cli_rm_builder based resource module > development is better in terms of resource_module_builder. You can get more > details here > <https://github.com/ansible-network/cli_rm_builder/blob/main/docs/rm_dev_guide.md> > ! > Thanks > > Sagar Paul > Associate Software Engineer, Ansible > > > On Fri, Aug 27, 2021 at 5:38 PM nitesh shet <[email protected]> wrote: > >> Thank you, can you please explain me the benefit of the >> https://github.com/ansible-network/cli_rm_builder over normal resource >> module builder.? >> >> >> >> On Fri, Aug 27, 2021 at 5:07 PM Nilashish Chakraborty < >> [email protected]> wrote: >> >>> Hi Nitesh, >>> >>> There seems to be an indentation issue in the model you shared, which is >>> why the model validation is failing. The sub keys under config are not >>> placed properly. Can you try fixing those and re-run the builder? >>> Also, if you're building a CLI based module, I would highly recommend >>> using https://github.com/ansible-network/cli_rm_builder instead of this. >>> >>> Thanks. >>> >>> -- >>> Nilashish Chakraborty >>> Senior Software Engineer, Ansible >>> >>> On Fri, Aug 27, 2021 at 4:42 PM nitesh shet <[email protected]> >>> wrote: >>> >>>> Hi, >>>> For creating custom collection scaffold i have used resource module >>>> builder from the below link: >>>> ansible-network/resource_module_builder: Scaffold and maintain resource >>>> modules (github.com) >>>> <https://github.com/ansible-network/resource_module_builder> >>>> >>>> for, customisation purpose had written a model(thanos_ntp.yml) for >>>> custom module and added the example files as well. >>>> >>>> but when i ran the site.yml file for my model by providing all the >>>> necessary arguments i am getting below error: >>>> The full traceback is: >>>> Traceback (most recent call last): >>>> File >>>> "/home/nshet/rmb/resource_module_builder/roles/scaffold_rm_facts/filter_plugins/to_doc.py", >>>> line 144, in validate_model >>>> raise AnsibleError("Error while parsing module: %s" % err) >>>> ansible.errors.AnsibleError: Error while parsing module: b"ERROR! >>>> Unexpected Exception, this is probably a bug: 'NoneType' object has no >>>> attribute 'pop'\n" >>>> >>>> During handling of the above exception, another exception occurred: >>>> >>>> Traceback (most recent call last): >>>> File >>>> "/home/nshet/.local/lib/python3.6/site-packages/ansible/plugins/action/template.py", >>>> line 146, in run >>>> resultant = templar.do_template(template_data, >>>> preserve_trailing_newlines=True, escape_backslashes=False) >>>> File >>>> "/home/nshet/.local/lib/python3.6/site-packages/ansible/template/__init__.py", >>>> line 1094, in do_template >>>> res = j2_concat(rf) >>>> File "<template>", line 35, in root >>>> File >>>> "/home/nshet/.local/lib/python3.6/site-packages/ansible/template/__init__.py", >>>> line 265, in wrapper >>>> ret = func(*args, **kwargs) >>>> File >>>> "/home/nshet/rmb/resource_module_builder/roles/scaffold_rm_facts/filter_plugins/to_doc.py", >>>> line 178, in to_doc >>>> validate_model(model, contents) >>>> File >>>> "/home/nshet/rmb/resource_module_builder/roles/scaffold_rm_facts/filter_plugins/to_doc.py", >>>> line 148, in validate_model >>>> % (err, contents)) >>>> ansible.errors.AnsibleError: Failed to validate the model with error: >>>> Error while parsing module: b"ERROR! Unexpected Exception, this is probably >>>> a bug: 'NoneType' object has no attribute 'pop'\n" >>>> >>>> >>>> Can you please help me to overcome this problem? >>>> >>>> >>>> Thanks, >>>> Nitesh >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Ansible Project" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/ansible-project/CAPgfy9U_6NYZTXYMf_pFQofE76wGgqeNOaK_LL4UkWRYFY_SoQ%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/ansible-project/CAPgfy9U_6NYZTXYMf_pFQofE76wGgqeNOaK_LL4UkWRYFY_SoQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ansible Project" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/CAODNBSHBXzq8KjGgUXMgCxeRStB083cfe301PtF4_ka4-wwg6g%40mail.gmail.com >>> <https://groups.google.com/d/msgid/ansible-project/CAODNBSHBXzq8KjGgUXMgCxeRStB083cfe301PtF4_ka4-wwg6g%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CAPgfy9VYY%2Bx4SMQ%3DNC%2BZ4Yu0Qw2G3DFSQMncVUvQKiO%2BMY1Gcw%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CAPgfy9VYY%2Bx4SMQ%3DNC%2BZ4Yu0Qw2G3DFSQMncVUvQKiO%2BMY1Gcw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAEs9WgZKpe%2B3kFNVgNZegsPv-AeT2M3KHXnWfgCQFRjKaWj%3Dxg%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAEs9WgZKpe%2B3kFNVgNZegsPv-AeT2M3KHXnWfgCQFRjKaWj%3Dxg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAPgfy9VY8eOnNER9NTiQ6oa4eZyh8Dh%2BASmndGbtctDN6K%3Ds9w%40mail.gmail.com.
