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

New module kops_facts. #50330

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
3 participants
@Yannig
Copy link
Contributor

Yannig commented Dec 26, 2018

This module retrieve facts on kops existing cluster.

SUMMARY

Add a new module to retrieve fact from kops cluster.

You can use the same variable as with kops/aws to handle communication with kops cluster (ie KOPS_STATE_STORE, AWS_ACCESS_KEY_ID and AWS_ACCESS_ACCESS_KEY).

export AWS_ACCESS_KEY_ID=xxx
export AWS_ACCESS_ACCESS_KEY=xxxxxxxxxxx
export KOPS_STATE_STORE=s3://my-state-store-in-s3
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

kops_facts module

ADDITIONAL INFORMATION

Retrieve facts from kops cluster

$ ansible -M ./library -m kops_facts localhost

Truncated output:

localhost | SUCCESS => {
    "ansible_facts": {
        "kops_clusters": [
            "test.fqdn"
        ],
        "kops_clusters_definitions": {
            "test.fqdn": {
                "apiVersion": "kops/v1alpha2",
                "kind": "Cluster",
                "metadata": {
                    "creationTimestamp": "2018-12-03T10:42:44",
                    "name": "test.fqdn"
                },
[...]

This module use a module utils to handle kops communication. I have already written 2 other modules to handle cluster creation and instance group creation (PR to come up).

New module kops_facts.
This module retrieve facts on kops existing cluster.
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Dec 26, 2018

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/kops.py:17:0: ansible-bad-module-import Import external package or ansible.module_utils not ansible.utils.vars

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test import --python 2.6 [explain] failed with 2 errors:

lib/ansible/module_utils/kops.py:17:0: ImportError: No module named utils.vars
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ImportError: No module named utils.vars

The test ansible-test sanity --test import --python 2.7 [explain] failed with 3 errors:

lib/ansible/module_utils/kops.py:17:0: ImportError: No module named utils.vars
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: ImportError: No module named utils.vars
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ImportError: No module named utils.vars

The test ansible-test sanity --test import --python 3.5 [explain] failed with 3 errors:

lib/ansible/module_utils/kops.py:17:0: ImportError: No module named 'ansible.utils'
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: ImportError: No module named 'ansible.utils'
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ImportError: No module named 'ansible.utils'

The test ansible-test sanity --test import --python 3.6 [explain] failed with 3 errors:

lib/ansible/module_utils/kops.py:17:0: ModuleNotFoundError: No module named 'ansible.utils'
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: ModuleNotFoundError: No module named 'ansible.utils'
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ModuleNotFoundError: No module named 'ansible.utils'

The test ansible-test sanity --test import --python 3.7 [explain] failed with 3 errors:

lib/ansible/module_utils/kops.py:17:0: ModuleNotFoundError: No module named 'ansible.utils'
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: ModuleNotFoundError: No module named 'ansible.utils'
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ModuleNotFoundError: No module named 'ansible.utils'

The test ansible-test sanity --test no-underscore-variable [explain] failed with 1 error:

lib/ansible/module_utils/kops.py:128:18: use `dummy` instead of `_` for a variable name

The test ansible-test sanity --test pep8 [explain] failed with 12 errors:

lib/ansible/module_utils/kops.py:63:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:76:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:98:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:118:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:142:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:154:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:163:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:175:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:193:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:214:5: E303 too many blank lines (2)
lib/ansible/modules/cloud/kops/kops_facts.py:73:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/cloud/kops/kops_facts.py:104:5: E303 too many blank lines (2)

The test ansible-test sanity --test shebang [explain] failed with 1 error:

lib/ansible/module_utils/kops.py:0:0: should not have a shebang

The test ansible-test sanity --test validate-modules [explain] failed with 11 errors:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.author: Invalid author for dictionary value @ data['author']. Got ['Yannig Perré']
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.kops_cmd.type: not a valid value for dictionary value @ data['options']['kops_cmd']['type']. Got 'string'
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.name.description.0: expected str @ data['options']['name']['description'][0]. Got {'FQDN name of the cluster (eg': 'test.example.org)'}
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.name.type: not a valid value for dictionary value @ data['options']['name']['type']. Got 'string'
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.state_store.description.0: expected str @ data['options']['state_store']['description'][0]. Got {'State store (eg': 's3://my-state-store)'}
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.state_store.type: not a valid value for dictionary value @ data['options']['state_store']['type']. Got 'string'
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E324 Value for "default" from the argument_spec (None) for "kops_cmd" does not match the documentation ('None')
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E324 Value for "default" from the argument_spec (None) for "state_store" does not match the documentation ('None')
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: E106 Import found before documentation variables. All imports must appear below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: E107 Imports should be directly below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.
lib/ansible/modules/cloud/kops:0:0: E502 Ansible module subdirectories must contain an __init__.py

click here for bot help

#
# (c) 2018, Yannig Perré <yannig.perre@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# pylint: disable=invalid-name,dangerous-default-value,duplicate-code

This comment has been minimized.

@mattclay

mattclay Jan 7, 2019

Member

Pylint rules should be disabled only where needed.

@mattclay mattclay added the ci_verified label Jan 7, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Jan 7, 2019

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/kops.py:17:0: ansible-bad-module-import Import external package or ansible.module_utils not ansible.utils.vars

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test import --python 2.6 [explain] failed with 2 errors:

lib/ansible/module_utils/kops.py:17:0: ImportError: No module named utils.vars
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ImportError: No module named utils.vars

The test ansible-test sanity --test import --python 2.7 [explain] failed with 3 errors:

lib/ansible/module_utils/kops.py:17:0: ImportError: No module named utils.vars
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: ImportError: No module named utils.vars
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ImportError: No module named utils.vars

The test ansible-test sanity --test import --python 3.5 [explain] failed with 3 errors:

lib/ansible/module_utils/kops.py:17:0: ImportError: No module named 'ansible.utils'
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: ImportError: No module named 'ansible.utils'
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ImportError: No module named 'ansible.utils'

The test ansible-test sanity --test import --python 3.6 [explain] failed with 3 errors:

lib/ansible/module_utils/kops.py:17:0: ModuleNotFoundError: No module named 'ansible.utils'
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: ModuleNotFoundError: No module named 'ansible.utils'
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ModuleNotFoundError: No module named 'ansible.utils'

The test ansible-test sanity --test import --python 3.7 [explain] failed with 3 errors:

lib/ansible/module_utils/kops.py:17:0: ModuleNotFoundError: No module named 'ansible.utils'
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: ModuleNotFoundError: No module named 'ansible.utils'
test/runner/.tox/import/lib/ansible/module_utils/kops.py:17:0: ModuleNotFoundError: No module named 'ansible.utils'

The test ansible-test sanity --test no-underscore-variable [explain] failed with 1 error:

lib/ansible/module_utils/kops.py:128:18: use `dummy` instead of `_` for a variable name

The test ansible-test sanity --test pep8 [explain] failed with 12 errors:

lib/ansible/module_utils/kops.py:63:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:76:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:98:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:118:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:142:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:154:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:163:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:175:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:193:5: E303 too many blank lines (2)
lib/ansible/module_utils/kops.py:214:5: E303 too many blank lines (2)
lib/ansible/modules/cloud/kops/kops_facts.py:73:1: E302 expected 2 blank lines, found 1
lib/ansible/modules/cloud/kops/kops_facts.py:104:5: E303 too many blank lines (2)

The test ansible-test sanity --test shebang [explain] failed with 1 error:

lib/ansible/module_utils/kops.py:0:0: should not have a shebang

The test ansible-test sanity --test validate-modules [explain] failed with 11 errors:

lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.author: Invalid author for dictionary value @ data['author']. Got ['Yannig Perré']
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.kops_cmd.type: not a valid value for dictionary value @ data['options']['kops_cmd']['type']. Got 'string'
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.name.description.0: expected str @ data['options']['name']['description'][0]. Got {'FQDN name of the cluster (eg': 'test.example.org)'}
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.name.type: not a valid value for dictionary value @ data['options']['name']['type']. Got 'string'
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.state_store.description.0: expected str @ data['options']['state_store']['description'][0]. Got {'State store (eg': 's3://my-state-store)'}
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E305 DOCUMENTATION.options.state_store.type: not a valid value for dictionary value @ data['options']['state_store']['type']. Got 'string'
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E324 Value for "default" from the argument_spec (None) for "kops_cmd" does not match the documentation ('None')
lib/ansible/modules/cloud/kops/kops_facts.py:0:0: E324 Value for "default" from the argument_spec (None) for "state_store" does not match the documentation ('None')
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: E106 Import found before documentation variables. All imports must appear below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.
lib/ansible/modules/cloud/kops/kops_facts.py:13:0: E107 Imports should be directly below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.
lib/ansible/modules/cloud/kops:0:0: E502 Ansible module subdirectories must contain an __init__.py

click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment