I just made my first Ansible collection but I’m getting this parse error when publishing it to Galaxy and I cannot figure out what is wrong with my DOCUMENTATION string.
ERROR! module stemid.powerdns.powerdns_record missing documentation (or could not parse documentation): stemid.powerdns.powerdns_record did not contain a DOCUMENTATION attribute
(/tmp/tmph46fhlgo/ansible_collections/stemid/powerdns/plugins/modules/powerdns_record.py). Unable to parse documentation in python file \'/tmp/tmph46fhlgo/ansible_collections/stemid/powerdns/plugins/modules/powerdns_record.py\': while parsing a block mapping\n in
"<unicode string>", line 7, column 5\ndid not find expected key\n in "<unicode string>", line 7, column 43. while parsing a block mapping\n in "<unicode string>", line 7, column 5\ndid not find expected key\n in "<unicode string>", line 7, column 43\n'
Did you run ansible-test sanity --docker -v first? I would assume that doesn’t pass either. It usually gives you better indications (not all of the tests, but its yamllint test will likely give you a more precise location).
The error is in RETURN, which is invalid YAML. The trailing comma in line 140 is the first error which makes it invalid.
Thanks to both of you for teaching me about how to develop collections.
The issue was indeed in the RETURN statement.
I just took both DOCUMENTATION and RETURN out into a yaml file and ran yamllint on them until I was rid of all the errors. Now I have published a new file without errors.
There’s no need to run yamllint manually on files that contain copy’n’pasted parts of modules, when you can simply run ansible-test sanity --docker -v (with --test yamllint if you only want that test)