summaryrefslogtreecommitdiff
path: root/lib/ansible/utils
diff options
context:
space:
mode:
authorAdam Friedman <tintoy@users.noreply.github.com>2017-02-09 22:30:31 +1100
committerJohn R Barker <john@johnrbarker.com>2017-02-09 11:30:31 +0000
commit1a28a4817649d3e072cfc086d7e683e33ae0f4c9 (patch)
tree47088552bde4c8a766415eb7da9b5b0c5cfc6232 /lib/ansible/utils
parentb5811ccb8a5398e4e74d490155e9f5d7bf6d7cbd (diff)
downloadansible-1a28a4817649d3e072cfc086d7e683e33ae0f4c9.tar.gz
Refactor dimensiondata_network module (#21043)
* Refactor dimensiondata_network to use shared base class for common functionality. * Experiment: remove the assignments in the "except ImportError:" block that keep PyCharm happy. If this fixes the build, then I reckon there's a bug in the validate-modules script (https://github.com/ansible/ansible/blob/devel/test/sanity/validate-modules/validate-modules#L322). * Remove unused imports. * Changes based on feedback from @gundalow for ansible/ansible#21043. - Use no_log=True for mcp_password parameter. - Collapse module parameter definitions. * Use shared definitions and doc fragments for common module arguments (ansible/ansible#21043). * Make default network plan "ESSENTIALS", rather than "ADVANCED" (this is consistent with our other tooling). Tidy up module parameter documentation. * Simplify dimensiondata module documentation fragments (didn't know you could include multiple fragments). * Change 'verify_ssl_cert' module parameter to 'validate_certs'.
Diffstat (limited to 'lib/ansible/utils')
-rw-r--r--lib/ansible/utils/module_docs_fragments/dimensiondata.py58
-rw-r--r--lib/ansible/utils/module_docs_fragments/dimensiondata_wait.py45
2 files changed, 103 insertions, 0 deletions
diff --git a/lib/ansible/utils/module_docs_fragments/dimensiondata.py b/lib/ansible/utils/module_docs_fragments/dimensiondata.py
new file mode 100644
index 0000000000..d477a83bf3
--- /dev/null
+++ b/lib/ansible/utils/module_docs_fragments/dimensiondata.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2016 Dimension Data
+#
+# This module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this software. If not, see <http://www.gnu.org/licenses/>.
+#
+# Authors:
+# - Adam Friedman <tintoy@tintoy.io>
+
+
+class ModuleDocFragment(object):
+
+ # Dimension Data doc fragment
+ DOCUMENTATION = '''
+
+options:
+ region:
+ description:
+ - The target region.
+ choices:
+ - Regions are defined in Apache libcloud project [libcloud/common/dimensiondata.py]
+ - They are also listed in U(https://libcloud.readthedocs.io/en/latest/compute/drivers/dimensiondata.html)
+ - Note that the default value "na" stands for "North America".
+ - The module prepends 'dd-' to the region choice.
+ default: na
+ mcp_user:
+ description:
+ - The username used to authenticate to the CloudControl API.
+ - If not specified, will fall back to C(MCP_USER) from environment variable or C(~/.dimensiondata).
+ required: false
+ mcp_password:
+ description:
+ - The password used to authenticate to the CloudControl API.
+ - If not specified, will fall back to C(MCP_PASSWORD) from environment variable or C(~/.dimensiondata).
+ - Required if I(mcp_user) is specified.
+ required: false
+ location:
+ description:
+ - The target datacenter.
+ required: true
+ validate_certs:
+ description:
+ - If C(false), SSL certificates will not be validated.
+ - This should only be used on private instances of the CloudControl API that use self-signed certificates.
+ required: false
+ default: true
+ '''
diff --git a/lib/ansible/utils/module_docs_fragments/dimensiondata_wait.py b/lib/ansible/utils/module_docs_fragments/dimensiondata_wait.py
new file mode 100644
index 0000000000..a281758f5b
--- /dev/null
+++ b/lib/ansible/utils/module_docs_fragments/dimensiondata_wait.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2016 Dimension Data
+#
+# This module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this software. If not, see <http://www.gnu.org/licenses/>.
+#
+# Authors:
+# - Adam Friedman <tintoy@tintoy.io>
+
+
+class ModuleDocFragment(object):
+
+ # Dimension Data ("wait-for-completion" parameters) doc fragment
+ DOCUMENTATION = '''
+
+options:
+ wait:
+ description:
+ - Should we wait for the task to complete before moving onto the next.
+ required: false
+ default: false
+ wait_time:
+ description:
+ - The maximum amount of time (in seconds) to wait for the task to complete.
+ - Only applicable if I(wait=true).
+ required: false
+ default: 600
+ wait_poll_interval:
+ description:
+ - The amount of time (in seconds) to wait between checks for task completion.
+ - Only applicable if I(wait=true).
+ required: false
+ default: 2
+ '''