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

Onesixtyone inventory plugin (Fixes #41443) #53036

Open
wants to merge 13 commits into
base: devel
from

Conversation

Projects
None yet
5 participants
@victorock
Copy link
Contributor

victorock commented Feb 26, 2019

SUMMARY

Add inventory plugin for onesixtyone, which is lightweight and fast in discovery of devices running SNMP.

Fixes #41443

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

onesixtyone

ADDITIONAL INFORMATION
ansible-inventory -i inventory --list
{
    "_meta": {
        "hostvars": {
            "ip-172-16-96-168.eu-central-1.compute.internal": {
                "ansible_host": "172.16.96.168", 
                "ansible_network_os": "ios", 
                "snmp_community": "public", 
                "snmp_sysdescr": "Cisco IOS Software [Gibraltar], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.10.1b, RELEASE SOFTWARE (fc1)  Technical Support: http://www.cisco.com/techsupport  Copyright (c) 1986-2018 by Cisco Systems, Inc.  Compiled Wed 12-Dec-18 02"
            }
        }
    }, 
    "all": {
        "children": [
            "ios", 
            "ungrouped"
        ]
    }, 
    "ios": {
        "hosts": [
            "ip-172-16-96-168.eu-central-1.compute.internal"
        ]
    }, 
    "ungrouped": {}
}
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 26, 2019

The test ansible-test sanity --test pylint [explain] failed with 5 errors:

lib/ansible/plugins/inventory/onesixtyone.py:105:17: bad-whitespace No space allowed after bracket           jobs = [ gevent.spawn(self._add_device, self, device) for device in self._discovery() ]                  ^
lib/ansible/plugins/inventory/onesixtyone.py:105:96: bad-whitespace No space allowed before bracket           jobs = [ gevent.spawn(self._add_device, self, device) for device in self._discovery() ]                                                                                                 ^
lib/ansible/plugins/inventory/onesixtyone.py:130:0: trailing-whitespace Trailing whitespace
lib/ansible/plugins/inventory/onesixtyone.py:203:0: missing-final-newline Final newline missing
lib/ansible/plugins/inventory/onesixtyone.py:203:0: mixed-line-endings Mixed line endings LF and CRLF

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

lib/ansible/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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.8 [explain] failed with 1 error:

lib/ansible/plugins/inventory/onesixtyone.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test docs-build [explain] failed with 8 errors:

docs/docsite/rst/dev_guide/developing_inventory.rst:35:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:37:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:41:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:111:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:209:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)

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

lib/ansible/plugins/inventory/onesixtyone.py:68:3: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:69:3: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:70:1: E722 do not use bare 'except'
lib/ansible/plugins/inventory/onesixtyone.py:71:3: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:92:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:93:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:94:19: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:95:19: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:96:23: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:105:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:105:19: E201 whitespace after '['
lib/ansible/plugins/inventory/onesixtyone.py:105:96: E202 whitespace before ']'
lib/ansible/plugins/inventory/onesixtyone.py:106:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:129:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:130:1: W293 blank line contains whitespace
lib/ansible/plugins/inventory/onesixtyone.py:145:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:146:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:147:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:148:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:149:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:151:11: E114 indentation is not a multiple of four (comment)
lib/ansible/plugins/inventory/onesixtyone.py:152:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:166:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:175:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:176:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:177:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:179:19: E121 continuation line under-indented for hanging indent
lib/ansible/plugins/inventory/onesixtyone.py:189:7: E114 indentation is not a multiple of four (comment)
lib/ansible/plugins/inventory/onesixtyone.py:190:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:191:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:193:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:194:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:196:7: E114 indentation is not a multiple of four (comment)
lib/ansible/plugins/inventory/onesixtyone.py:197:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:198:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:199:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:200:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:201:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:202:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:203:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:203:80: W292 no newline at end of file

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 27, 2019

The test ansible-test sanity --test pylint [explain] failed with 5 errors:

lib/ansible/plugins/inventory/onesixtyone.py:105:17: bad-whitespace No space allowed after bracket           jobs = [ gevent.spawn(self._add_device, self, device) for device in self._discovery() ]                  ^
lib/ansible/plugins/inventory/onesixtyone.py:105:96: bad-whitespace No space allowed before bracket           jobs = [ gevent.spawn(self._add_device, self, device) for device in self._discovery() ]                                                                                                 ^
lib/ansible/plugins/inventory/onesixtyone.py:130:0: trailing-whitespace Trailing whitespace
lib/ansible/plugins/inventory/onesixtyone.py:203:0: missing-final-newline Final newline missing
lib/ansible/plugins/inventory/onesixtyone.py:203:0: mixed-line-endings Mixed line endings LF and CRLF

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

lib/ansible/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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.8 [explain] failed with 1 error:

lib/ansible/plugins/inventory/onesixtyone.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test docs-build [explain] failed with 8 errors:

docs/docsite/rst/dev_guide/developing_inventory.rst:35:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:37:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:41:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:111:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:209:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)

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

lib/ansible/plugins/inventory/onesixtyone.py:68:3: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:69:3: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:70:1: E722 do not use bare 'except'
lib/ansible/plugins/inventory/onesixtyone.py:71:3: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:92:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:93:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:94:19: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:95:19: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:96:23: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:105:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:105:19: E201 whitespace after '['
lib/ansible/plugins/inventory/onesixtyone.py:105:96: E202 whitespace before ']'
lib/ansible/plugins/inventory/onesixtyone.py:106:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:129:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:130:1: W293 blank line contains whitespace
lib/ansible/plugins/inventory/onesixtyone.py:145:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:146:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:147:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:148:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:149:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:151:11: E114 indentation is not a multiple of four (comment)
lib/ansible/plugins/inventory/onesixtyone.py:152:11: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:166:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:175:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:176:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:177:15: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:179:19: E121 continuation line under-indented for hanging indent
lib/ansible/plugins/inventory/onesixtyone.py:189:7: E114 indentation is not a multiple of four (comment)
lib/ansible/plugins/inventory/onesixtyone.py:190:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:191:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:193:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:194:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:196:7: E114 indentation is not a multiple of four (comment)
lib/ansible/plugins/inventory/onesixtyone.py:197:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:198:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:199:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:200:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:201:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:202:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:203:7: E111 indentation is not a multiple of four
lib/ansible/plugins/inventory/onesixtyone.py:203:80: W292 no newline at end of file

click here for bot help

Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 27, 2019

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

lib/ansible/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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.8 [explain] failed with 1 error:

lib/ansible/plugins/inventory/onesixtyone.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test docs-build [explain] failed with 8 errors:

docs/docsite/rst/dev_guide/developing_inventory.rst:35:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:37:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:41:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:111:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:209:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)

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

lib/ansible/plugins/inventory/onesixtyone.py:69:1: E722 do not use bare 'except'
lib/ansible/plugins/inventory/onesixtyone.py:75:1: E722 do not use bare 'except'

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 27, 2019

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

lib/ansible/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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.8 [explain] failed with 1 error:

lib/ansible/plugins/inventory/onesixtyone.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test docs-build [explain] failed with 8 errors:

docs/docsite/rst/dev_guide/developing_inventory.rst:35:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:37:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:41:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:111:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:209:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)

click here for bot help

Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 27, 2019

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

lib/ansible/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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.8 [explain] failed with 1 error:

lib/ansible/plugins/inventory/onesixtyone.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test docs-build [explain] failed with 8 errors:

docs/docsite/rst/dev_guide/developing_inventory.rst:35:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:37:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:41:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:111:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:209:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)

click here for bot help

Ansible Network added some commits Feb 26, 2019

Ansible Network
onesixtyone:
- inventory plugin using onesixtyone  to discover devices using snmp.
- group together hosts with the same platforms.
Ansible Network
Changelog:
- pep8 fixes
- netaddr for cidrs
- documentation as per PEP257
- comments and suggestions
Ansible Network
Exception raised from InventoryModule.
get_bin_path call from InventoryModule.parse()
Ansible Network

@victorock victorock force-pushed the victorock:onesixtyone-inventory-plugin branch from d90201d to 3d577f0 Feb 27, 2019

@victorock

This comment has been minimized.

Copy link
Contributor Author

victorock commented Feb 27, 2019

@bcoca @Akasurde @webknjaz please review

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Feb 27, 2019

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

lib/ansible/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

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

lib/ansible/plugins/inventory/onesixtyone.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.5 [explain] failed with 1 error:

lib/ansible/plugins/inventory/onesixtyone.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/plugins/inventory/onesixtyone.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.8 [explain] failed with 1 error:

lib/ansible/plugins/inventory/onesixtyone.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test docs-build [explain] failed with 8 errors:

docs/docsite/rst/dev_guide/developing_inventory.rst:35:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:37:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:41:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:111:0: undefined-label: undefined label: host_list_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/dev_guide/developing_inventory.rst:209:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: auto_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: ini_inventory (if the link has no caption the label must precede a section header)
docs/docsite/rst/porting_guides/porting_guide_2.8.rst:237:0: undefined-label: undefined label: yaml_inventory (if the link has no caption the label must precede a section header)

click here for bot help

Akasurde and others added some commits Feb 28, 2019

typo in comments
Co-Authored-By: victorock <victorockeiro@gmail.com>
typo in parallelize
Co-Authored-By: victorock <victorockeiro@gmail.com>
@victorock

This comment has been minimized.

Copy link
Contributor Author

victorock commented Mar 5, 2019

@bcoca @Akasurde any additional requirement to fix?

Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated
Show resolved Hide resolved lib/ansible/plugins/inventory/onesixtyone.py Outdated

try:
# Using gevent to parallelize reverse dns lookups and adding entries to inventory
jobs = [gevent.spawn(self._add_device, self, device) for device in self._discovery()]

This comment has been minimized.

@webknjaz

webknjaz Mar 6, 2019

Member

this line will probably not generate an exception and should be outside of try/except block

This comment has been minimized.

@bcoca

bcoca Mar 6, 2019

Member

both _discovery and _add_device can throw exceptions, gevent SHOULD push them to the join below, but that is not always the case and depends on timing (they solved this problem a while ago, but we are not specifying version requirement and would have to deal with least common denominator)

This comment has been minimized.

@victorock

victorock Mar 21, 2019

Author Contributor

As per your comments, i am doing the following:

  • Keeping gevent under try
  • Adding catch for gevent exceptions (LoopExit).
  • Removing catch-all so AnsibleParserError exceptions cascade up the hill...
text -- sysdescr text
"""
platforms = {
'asa': re.compile(r'^Cisco\sAdaptive\sSecurity\sAppliance'),

This comment has been minimized.

@webknjaz

webknjaz Mar 6, 2019

Member

No need to compile explicitly, re will hold compiled cache internally anyway.

This comment has been minimized.

@victorock

victorock Mar 21, 2019

Author Contributor

I prefer to keep the compile, method, to explicitly know what is happening. Do you want me to change from re.compile(r'Cisco\sAdaptive\sSecurity\sAppliance') to r'Cisco\sAdaptive\sSecurity\sAppliance' ?

fix as per suggestions
- organize errors/exceptions
- add trailing ','
- remove '^' from regex
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 21, 2019

The test ansible-test sanity --test pylint [explain] failed with 3 errors:

lib/ansible/plugins/inventory/onesixtyone.py:121:44: trailing-whitespace Trailing whitespace
lib/ansible/plugins/inventory/onesixtyone.py:122:0: trailing-whitespace Trailing whitespace
lib/ansible/plugins/inventory/onesixtyone.py:125:12: raising-format-tuple Exception arguments suggest string formatting might be intended

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

lib/ansible/plugins/inventory/onesixtyone.py:121:45: W291 trailing whitespace
lib/ansible/plugins/inventory/onesixtyone.py:122:1: W293 blank line contains whitespace

click here for bot help

HAS_GEVENT = True
except Exception:
HAS_GEVENT = False


class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
class InventoryModule(BaseInventoryPlugin):

This comment has been minimized.

@bcoca

bcoca Mar 21, 2019

Member

i would advise to keep constructable and just implement the functionality, it allows the user to create groups/variables via compose so you don't have to hardcode it into the plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.