summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/best_practices_guide.adoc31
-rw-r--r--docs/core_concepts_guide.adoc9
-rw-r--r--docs/style_guide.adoc51
3 files changed, 70 insertions, 21 deletions
diff --git a/docs/best_practices_guide.adoc b/docs/best_practices_guide.adoc
index 938b6b46a..83df53735 100644
--- a/docs/best_practices_guide.adoc
+++ b/docs/best_practices_guide.adoc
@@ -4,7 +4,7 @@
The purpose of this guide is to describe the preferred patterns and best practices used in this repository (both in ansible and python).
-It is important to note that this repository may not currently comply with all best practices, but our intention is that it will.
+It is important to note that this repository may not currently comply with all best practices, but the intention is that it will.
All new pull requests created against this repository MUST comply with this guide.
@@ -22,14 +22,14 @@ This guide complies with https://www.ietf.org/rfc/rfc2119.txt[RFC2119].
The purpose of this rule is to avoid cases where the build bot will fail pull requests for code modified in a previous pull request.
-Our tooling is flexible enough that exceptions can be made so that the tool the build bot is running will ignore certain areas or certain checks, but the build bot itself must pass for the pull request to be merged.
+The tooling is flexible enough that exceptions can be made so that the tool the build bot is running will ignore certain areas or certain checks, but the build bot itself must pass for the pull request to be merged.
== Python
=== PyLint
-We use http://www.pylint.org/[PyLint] in an attempt to keep our python code as clean and as managable as possible. Our build bot runs each pull request through PyLint and any warnings or errors cause the build bot to fail the pull request.
+http://www.pylint.org/[PyLint] is used in an attempt to keep the python code as clean and as managable as possible. The build bot runs each pull request through PyLint and any warnings or errors cause the build bot to fail the pull request.
'''
[cols="2v,v"]
@@ -49,7 +49,7 @@ Instead, http://docs.pylint.org/faq.html#is-it-possible-to-locally-disable-a-par
.Exceptions:
1. When PyLint fails because of a dependency that can't be installed on the build bot
-1. When PyLint fails because we are including a module that is outside of our control (like Ansible)
+1. When PyLint fails because of including a module that is outside of control (like Ansible)
'''
[cols="2v,v"]
@@ -70,7 +70,7 @@ The purpose of this rule is to inform future developers about the disable.
# Reason: disable pylint maybe-no-member because overloaded use of
# the module name causes pylint to not detect that 'results'
# is an array or hash
-# Status: permanently disabled unless we can find a way to fix this.
+# Status: permanently disabled unless a way is found to fix this.
# pylint: disable=maybe-no-member
metadata[line] = results.pop()
----
@@ -78,6 +78,23 @@ metadata[line] = results.pop()
== Ansible
+=== Role Directory
+.Context
+* http://docs.ansible.com/playbooks_best_practices.html#directory-layout[Ansible Suggested Directory Layout]
+
+'''
+[cols="2v,v"]
+|===
+| **Rule**
+| The Ansible roles directory MUST maintain a flat structure.
+|===
+
+.The purpose of this rule is to:
+* Comply with the upstream best practices
+* Make it familiar for new contributors
+* Make it compatible with Ansible Galaxy
+
+
=== Filters
.Context:
* https://docs.ansible.com/playbooks_filters.html[Ansible Playbook Filters]
@@ -92,7 +109,7 @@ metadata[line] = results.pop()
When using the jinja2 `default` filter, unless the variable is a boolean, specify `true` as the second parameter. This will cause the default filter to replace empty strings, lists, etc with the provided default.
-This is because we would prefer to either have a sane default set than to have an empty string, list, etc. We don't, for example, want config values set to an empty string.
+This is because it is preferable to either have a sane default set than to have an empty string, list, etc. For example, it is preferable to have a config value set to a sane default than to have it simply set as an empty string.
.From the http://jinja.pocoo.org/docs/dev/templates/[Jinja2 Docs]:
[quote]
@@ -119,4 +136,4 @@ If you want to use default with variables that evaluate to false you have to set
In other words, normally the `default` filter will only replace the value if it's undefined. By setting the second parameter to `true`, it will also replace the value if it defaults to a false value in python, so None, empty list, empty string, etc.
-We almost always want this instead of the empty list, string, etc.
+This is almost always more desirable than an empty list, string, etc.
diff --git a/docs/core_concepts_guide.adoc b/docs/core_concepts_guide.adoc
index 0d746bfb5..38187c55e 100644
--- a/docs/core_concepts_guide.adoc
+++ b/docs/core_concepts_guide.adoc
@@ -4,12 +4,12 @@
The purpose of this guide is to describe core concepts used in this repository.
-It is important to note that this repository may not currently implement all of the concepts, but our intention is that it will.
+It is important to note that this repository may not currently implement all of the concepts, but the intention is that it will.
== Logical Grouping Concepts
-The following are the concepts we use to logically group OpenShift cluster instances.
+The following are the concepts used to logically group OpenShift cluster instances.
-We use these groupings to perform operations specifically against instances in the specified group.
+These groupings are used to perform operations specifically against instances in the specified group.
For example, run an Ansible playbook against all instances in the `production` environment, or run an adhoc command against all instances in the `acme-corp` cluster group.
@@ -35,7 +35,8 @@ Defined Cluster Group:
=== Environment
An environment is a logical grouping of one or more cluster groups. How the environment is defined is determined by the OpenShift administrators.
-Example: Extending the two examples above, Hosting Corp could provide both production and staging environments for it's customers. In this way, Acme Corp could push their code to the staging environment and test it out before pushing it to production.
+Example: Extending the two examples above, Hosting Corp is upgrading to the latest version of OpenShift. Before deploying it to their clusters in the Production environment, they want to test it out. So, Hosting Corp runs an Ansible playbook specifically against all of the cluster groups in the Staging environment in order to do the OpenShift upgrade.
+
Defined Environments:
`production`
diff --git a/docs/style_guide.adoc b/docs/style_guide.adoc
index 714b56c70..3b888db12 100644
--- a/docs/style_guide.adoc
+++ b/docs/style_guide.adoc
@@ -4,16 +4,47 @@
The purpose of this guide is to describe the preferred coding conventions used in this repository (both in ansible and python).
-It is important to note that this repository may not currently comply with all style guide rules, but our intention is that it will.
+It is important to note that this repository may not currently comply with all style guide rules, but the intention is that it will.
All new pull requests created against this repository MUST comply with this guide.
This style guide complies with https://www.ietf.org/rfc/rfc2119.txt[RFC2119].
-== Ansible Variable Naming
+== Python
-=== Global Variables
-We define Ansible global variables as any variables outside of ansible roles. Examples include playbook variables, variables passed in on the cli, etc.
+
+=== Python Maximum Line Length
+
+.Context:
+* https://www.python.org/dev/peps/pep-0008/#maximum-line-length[Python Pep8 Line Length]
+
+'''
+[cols="2v,v"]
+|===
+| **Rule**
+| All lines SHOULD be no longer than 80 characters.
+|===
+
+Every attempt SHOULD be made to comply with this soft line length limit, and only when it makes the code more readable should this be violated.
+
+Code readability is subjective, therefore pull-requests SHOULD still be merged, even if they violate this soft limit as it is up to the individual contributor to determine if they should violate the 80 character soft limit.
+
+
+'''
+[cols="2v,v"]
+|===
+| **Rule**
+| All lines MUST be no longer than 120 characters.
+|===
+
+This is a hard limit and is enforced by the build bot. This check MUST NOT be disabled.
+
+
+
+== Ansible
+
+=== Ansible Global Variables
+Ansible global variables are defined as any variables outside of ansible roles. Examples include playbook variables, variables passed in on the cli, etc.
'''
[cols="2v,v"]
@@ -29,8 +60,8 @@ Example:
g_environment: someval
----
-==== Role Variables
-We define Ansible role variables as variables contained in (or passed into) a role.
+=== Ansible Role Variables
+Ansible role variables are defined as variables contained in (or passed into) a role.
'''
[cols="2v,v"]
@@ -39,7 +70,7 @@ We define Ansible role variables as variables contained in (or passed into) a ro
| Role variables MUST have a prefix of atleast 3 characters. See below for specific naming rules.
|===
-===== Role with 3 (or more) words in the name
+==== Role with 3 (or more) words in the name
Take the first letter of each of the words.
@@ -61,7 +92,7 @@ tmur_var1: value_one
-===== Role with 2 (or less) words in the name
+==== Role with 2 (or less) words in the name
Make up a prefix that makes sense.
@@ -82,7 +113,7 @@ tow_var1: value_one
----
-===== Role name prefix conflicts
+==== Role name prefix conflicts
If two role names contain words that start with the same letters, it will seem like their prefixes would conflict.
Role variables are confined to the roles themselves, so this is actually only a problem if one of the roles depends on the other role (or uses includes into the other role).
@@ -104,4 +135,4 @@ Even though both roles have the same prefix (mur), and even though both roles ha
This would only be a problem if my_uber_role depended on made_up_role, or vice versa. Or if either of these two roles included things from the other.
-We think this is enough of a corner case that it is unlikely to happen. If it does, we will address it on a case by case basis.
+This is enough of a corner case that it is unlikely to happen. If it does, it will be addressed on a case by case basis.