Skip to content
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

Merged
merged 2 commits into from
Sep 14, 2018

Conversation

dagwieers
Copy link
Contributor

@dagwieers dagwieers commented Sep 13, 2018

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
  • Docs Pull Request
COMPONENT NAME

aci dev_guide

ANSIBLE VERSION

v2.7

ADDITIONAL INFORMATION

Screenshot of local Table of Contents:

screenshot from 2018-09-13 05-53-27

@dagwieers
Copy link
Contributor Author

cc @jmcgill298

@dagwieers dagwieers added the aci Cisco ACI community label Sep 13, 2018
@ansibot
Copy link
Contributor

ansibot commented Sep 13, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 docs This issue/PR relates to or includes documentation. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 13, 2018
@ansibot

This comment has been minimized.

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Sep 13, 2018
@dagwieers dagwieers force-pushed the aci-dev_guide branch 2 times, most recently from 4463f9b to 8d066ef Compare September 13, 2018 01:13
Copy link
Contributor

@acozine acozine left a 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.

@dagwieers
Copy link
Contributor Author

@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).

@dagwieers
Copy link
Contributor Author

@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...)

@dagwieers
Copy link
Contributor Author

@acozine What are "Active headings" ?

@ansibot

This comment has been minimized.

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Sep 13, 2018
@mattclay
Copy link
Member

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.

@dagwieers
Copy link
Contributor Author

@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 if elif else statements into separate examples. There's no easy way to fix that unless we break that structure and then it does no longer reflect the module.

@acozine
Copy link
Contributor

acozine commented Sep 13, 2018

@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.

@acozine
Copy link
Contributor

acozine commented Sep 13, 2018

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.

@dagwieers
Copy link
Contributor Author

@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!

@acozine
Copy link
Contributor

acozine commented Sep 13, 2018

Some of the headings in this doc are already active: "Testing for sanity checks" is a good example.

@mattclay
Copy link
Member

@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.

@ansibot
Copy link
Contributor

ansibot commented Sep 13, 2018

@ansibot ansibot added networking Network category and removed ci_verified Changes made in this PR are causing tests to fail. labels Sep 13, 2018
@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Sep 13, 2018
@mattclay
Copy link
Member

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.

@dagwieers
Copy link
Contributor Author

Well, thinking about this even more, I happily give up syntax highlighting if that keeps the examples identical to the modules.

@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Sep 13, 2018
@ansibot

This comment has been minimized.

@dagwieers
Copy link
Contributor Author

@acozine I think I fixed all your remarks. Not all headings are active because I don't think it makes sense everywhere. Feedback appreciated.

@dagwieers
Copy link
Contributor Author

@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.

Copy link
Contributor

@acozine acozine left a 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:
Copy link
Contributor

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).

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

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.
Copy link
Contributor

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."

Copy link
Contributor Author

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.
Copy link
Contributor

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).

Copy link
Contributor Author

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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

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"?

Copy link
Contributor Author

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
Copy link
Contributor

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).

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sentence case here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@acozine
Copy link
Contributor

acozine commented Sep 13, 2018

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.

@dagwieers
Copy link
Contributor Author

@acozine @jmcgill298 Please re-review !

@acozine
Copy link
Contributor

acozine commented Sep 13, 2018

Looks good on the writing side, thanks @dagwieers. I'll let @jmcgill298 weigh in before merging.

@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Sep 13, 2018
@jmcgill298
Copy link
Contributor

LGTM

@ansibot ansibot added the shipit This PR is ready to be merged by Core label Sep 14, 2018
@dagwieers dagwieers merged commit e038338 into ansible:devel Sep 14, 2018
@dagwieers
Copy link
Contributor Author

@acozine Can we backport this to v2.7 ?

@acozine
Copy link
Contributor

acozine commented Sep 14, 2018

@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.

@dagwieers dagwieers mentioned this pull request Sep 14, 2018
@samccann samccann added this to Docsite work in Ansible-maintained Collections Documentation via automation Sep 21, 2018
@dagwieers dagwieers added the cisco Cisco technologies label Feb 23, 2019
@samccann samccann moved this from Needs Triage - todo backlog - Docsite work -anything can go here to Waiting review/merge in Ansible-maintained Collections Documentation Mar 7, 2019
@samccann samccann moved this from Waiting review/merge to Done in Ansible-maintained Collections Documentation Mar 7, 2019
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
aci Cisco ACI community affects_2.8 This issue/PR affects Ansible v2.8 cisco Cisco technologies docs This issue/PR relates to or includes documentation. networking Network category shipit This PR is ready to be merged by Core support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants