-
Notifications
You must be signed in to change notification settings - Fork 23.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ACI: Move dev_guide from Wiki to Ansible docs #45588
Conversation
cc @jmcgill298 |
This comment has been minimized.
This comment has been minimized.
4463f9b
to
8d066ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing content @dagwieers. This PR needs some work. At a minimum, please make Shippable happy, make the headers conform to #35520, add a basic description (what is an ACI module and why would someone want to write their own?), and add a link to this page from the ACI guide. Active headings would make this page better as well. When that's all done, I'll give the text a more thorough read.
@mattclay @gundalow @acozine The rstcheck sanity check is being more strict than Sphinx itself. It is complaining about python examples (even snippets of code) whereas Sphinx doesn't care. Which means I now have to ensure that my snippets of code are syntactically correct (which is silly, because we used place-holders to make code more clear or we selected pieces of code instead of full code). |
8d066ef
to
5a8b66b
Compare
@acozine Can you please merge #35520 so a contributor can simply look at the existing documentation to ensure he's using the correct conventions ? We cannot expect contributors to have an active knowledge of open PR's and their authority (as long as something is not merged, IMO it cannot hold authority over what is already merged...) |
@acozine What are "Active headings" ? |
This comment has been minimized.
This comment has been minimized.
The syntax checking can be an inconvenience for some examples. Fortunately those cases can be easily resolved with minor syntax changes or a small amount of boilerplate. The alternative would be to disable syntax checking, but that seems like giving up more than we'd be gaining. |
@mattclay Ah, so this is a known problem. I wonder if there's a way to disable the syntax checking for those examples we know this is not a problem. We explain the module's structure, by using snippets from a module. Which means we break up |
@dagwieers thanks for the quick response - what time is it where you are??? #35520 is an Issue, not a PR, so I can't merge it, but if you look at the recent changes to the Developer Guide (#45179) or the Community Guide (#45364) you will see the header notation in action. I'm working to fix the headers slowly, along with other changes, which is why the issue is still open. If you have specific questions, about header notation, let me know. |
By "active headings" I meant giving headings verbs and more detail - for example, "Importing shared ACI code" instead of "Imports". You can ignore that for now - the other changes are more important. |
@acozine It's 4AM over here. If you need any help fixing the remaining documentation to follow the new rules, let me know. I now based my headings on the Windows dev_guide, because I am not sure what are supposed to be parts and chapters in my document. PS While improving the docs I was doing exactly that! |
4fe4258
to
1385592
Compare
Some of the headings in this doc are already active: "Testing for sanity checks" is a good example. |
@dagwieers For the if/elif/else case, perhaps something like the following would suffice: if conditional:
pass # other logic here
else
# actual example here Yes, this adds boilerplate, but it also passes the tests. Also, for some readers it will be easier to follow since the example is free standing. Otherwise, when starting reading in the middle of the document it can look like part of the example is missing. |
I find having the "stub code" at the top of the conditional useful for providing context. But that's just me. I'll leave it up to you and @acozine to work out what you'd like to do. |
Well, thinking about this even more, I happily give up syntax highlighting if that keeps the examples identical to the modules. |
249f39b
to
a704424
Compare
This comment has been minimized.
This comment has been minimized.
a704424
to
fc837a5
Compare
@acozine I think I fixed all your remarks. Not all headings are active because I don't think it makes sense everywhere. Feedback appreciated. |
fc837a5
to
ca60588
Compare
@acozine Since this is a PR from 2 different authors (the original document and then the changes) I would prefer if both commits are merged using "Rebase and merge" rather than "Squash and merge" so the content is being correctly attributed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great. Thanks @dagwieers for including anchors for incoming links, as well as for making Shippable happy and fixing the headers. I appreciate your attention to detail. I've found a few little things to fix before merging.
|
||
Defining the argument spec | ||
-------------------------- | ||
The first line adds the standard connection parameters to the module. After that, the next section will update the ``argument_spec`` dictionary with module specific parameters. The module specific parameters should include: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hyphenate "module-specific parameters" (x2).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
+ `absent` to ensure object does not exist | ||
|
||
+ `query` to retrieve information about objects in the class | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently present/absent/query are in italics - did you mean them to be in code
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original docs were written by someone else, I guess so.
) | ||
|
||
|
||
.. hint:: It is important to point out that all configuration arguments should not have a default value, as that could cause unintended changes to the object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd change the hint to "Do not provide default values for configuration arguments. Default values could cause unintended changes to the object."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
Using the AnsibleModule object | ||
------------------------------ | ||
The following section creates an AnsibleModule instance. The module should support check_mode, so we pass the ``argument_spec`` and ``supports_check_mode`` arguments. Since these modules support querying the APIC for all objects of the module's class, the object/parent IDs should only be required if `state` is present or absent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of "check_mode", I'd either enclose it in double backticks to make it look like code
, or say "check mode" without the underscore. Also, currently state is italic (single backtick), should probably be code
(double backticks).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
When State is Present | ||
^^^^^^^^^^^^^^^^^^^^^ | ||
When the state is present, the module needs to perform a diff against the existing configuration and the task entries. If any value needs to be updated, then the module will make a POST request with only the items that need to be updated. Some modules have children that are in a 1-to-1 relationship with another object; for these cases, the module can be used to manage the child objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put double backticks around present
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
+ The child configs include the full child object dictionary, not just the attributes configuration portion. | ||
|
||
+ The configuration portion is built the same way that the object is done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"is done" is a bit confusing here - maybe "The configuration s built the same way as the object" or "The configuration portion is built just like the object portion"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
aci.get_existing() | ||
|
||
|
||
When State is Present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use sentence case for headings (When state is present, not When State is Present).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
aci.post_config() | ||
|
||
|
||
When State is Absent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sentence case here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
For anyone else following this PR, the changes are temporarily visible at http://docs.testing.ansible.com/ansible/latest/dev_guide/developing_modules_general_aci.html. |
ca60588
to
e1fcd20
Compare
@acozine @jmcgill298 Please re-review ! |
Looks good on the writing side, thanks @dagwieers. I'll let @jmcgill298 weigh in before merging. |
LGTM |
@acozine Can we backport this to v2.7 ? |
@dagwieers go ahead and open a backport PR, if we can't get it in before the release, I'll merge it the day after and republish the docs. |
SUMMARY
We had this item on our list for some time, as the Wiki is not the right location for documentation.
https://github.com/ansible/community/wiki/Network:-ACI-Development-Guide
ISSUE TYPE
COMPONENT NAME
aci dev_guide
ANSIBLE VERSION
v2.7
ADDITIONAL INFORMATION
Screenshot of local Table of Contents: