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

Netbox site module #53219

Open
wants to merge 9 commits into
base: devel
from

Conversation

Projects
None yet
5 participants
@FragmentedPacket
Copy link
Contributor

FragmentedPacket commented Mar 3, 2019

SUMMARY

Adds a Netbox module to create/delete sites

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

netbox_site.py

ADDITIONAL INFORMATION

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 3, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 3, 2019

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:181:100: trailing-whitespace Trailing whitespace

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:51:20: W291 trailing whitespace
lib/ansible/modules/net_tools/netbox/netbox_site.py:54:63: W291 trailing whitespace
lib/ansible/modules/net_tools/netbox/netbox_site.py:77:37: W291 trailing whitespace
lib/ansible/modules/net_tools/netbox/netbox_site.py:139:32: W291 trailing whitespace
lib/ansible/modules/net_tools/netbox/netbox_site.py:147:34: W291 trailing whitespace
lib/ansible/modules/net_tools/netbox/netbox_site.py:181:101: W291 trailing whitespace

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:0:0: E305 DOCUMENTATION.options.data.suboptions.asn.type: not a valid value for dictionary value @ data['options']['data']['suboptions']['asn']['type']. Got 'integer'

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 3, 2019

@Anthony25 @amb1s1 @FragmentedPacket

As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add shipit if you would like to see it merged.

click here for bot help

@FragmentedPacket FragmentedPacket changed the title Created netbox_interface module and updated netbox_utils Netbox site module Mar 3, 2019

@smolz

This comment has been minimized.

Copy link
Contributor

smolz commented Mar 3, 2019

Tested and working for me on Ansible 2.8.0.dev0 and latest version of Netbox

@ansibot ansibot removed the needs_triage label Mar 4, 2019

@ansibot

This comment was marked as resolved.

Copy link
Contributor

ansibot commented Mar 4, 2019

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:0: syntax-error invalid syntax (<unknown>, line 228)

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:0:0: has a documentation error formatting or is missing documentation.

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:0:0: has a documentation error formatting or is missing documentation.

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:0:0: has a documentation error formatting or is missing documentation.

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:0:0: has a documentation error formatting or is missing documentation.

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:0:0: has a documentation error formatting or is missing documentation.

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
cat _themes/srtd/static/css/theme.css | sed -e 's/^[ 	]*//g; s/[ 	]*$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$/d' | sed -e :a -e '$!N; s/\n\(.\)/\1/; ta' > _themes/srtd/static/css/theme.min.css
PYTHONPATH=../../lib ../bin/dump_config.py --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ -d ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../bin/generate_man.py --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml
PYTHONPATH=../../lib ../bin/plugin_formatter.py -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Evaluating module files...
Makefile:93: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../bin/plugin_formatter.py", line 774, in <module>
    main()
  File "../bin/plugin_formatter.py", line 729, in main
    plugin_info, categories = get_plugin_info(options.module_dir, limit_to=options.limit_to, verbose=(options.verbosity > 0))
  File "../bin/plugin_formatter.py", line 294, in get_plugin_info
    doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose)
  File "/root/ansible/lib/ansible/utils/plugin_docs.py", line 105, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/root/ansible/lib/ansible/parsing/plugin_docs.py", line 40, in read_docstring
    M = ast.parse(b_module_data.read())
  File "/usr/lib/python3.6/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 228
    module = AnsibleModule(argument_spec=argument_spec,
         ^
SyntaxError: invalid syntax
make: *** [modules] Error 1

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: module = AnsibleModule(argument_spec=argument_spec,

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: module = AnsibleModule(argument_spec=argument_spec,

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: module = AnsibleModule(argument_spec=argument_spec,

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: module = AnsibleModule(argument_spec=argument_spec,

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: module = AnsibleModule(argument_spec=argument_spec,

The test ansible-test sanity --test compile --python 3.8 [explain] failed with 1 error:

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:5: SyntaxError: module = AnsibleModule(argument_spec=argument_spec,

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: invalid syntax

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: invalid syntax

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: invalid syntax

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: invalid syntax

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: SyntaxError: invalid syntax

The test ansible-test sanity --test import --python 3.8 [explain] failed with 1 error:

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:5: SyntaxError: invalid syntax

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:223:13: E124 closing bracket does not match visual indentation
lib/ansible/modules/net_tools/netbox/netbox_site.py:224:9: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:225:9: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:226:9: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:227:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:228:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:228:11: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:228:13: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:230:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:231:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:233:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:234:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:234:8: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:234:10: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:235:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:235:13: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:235:15: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:236:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:236:8: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:236:10: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:237:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:237:10: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:237:12: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:238:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:238:9: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:238:11: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:239:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:239:10: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:239:12: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:240:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:240:19: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:240:21: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:241:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:242:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:243:11: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:243:13: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:244:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:246:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:247:15: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:247:17: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:248:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:250:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:250:16: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:250:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:251:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:251:14: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:251:16: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:252:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:253:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:253:20: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:258:13: E123 closing bracket does not match indentation of opening bracket's line
lib/ansible/modules/net_tools/netbox/netbox_site.py:262:13: E123 closing bracket does not match indentation of opening bracket's line
lib/ansible/modules/net_tools/netbox/netbox_site.py:263:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:265:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:267:5: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:271:1: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:272:9: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:272:11: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:275:23: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:275:25: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:278:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:278:20: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:280:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:280:20: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:282:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:282:20: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:284:17: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:284:19: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:289:1: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:296:16: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:296:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:299:9: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:299:11: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:302:13: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:302:15: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:303:16: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:303:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:304:12: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:304:14: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:306:13: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:306:15: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:307:12: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:307:14: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:308:16: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:308:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:313:1: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:317:9: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:317:11: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:321:16: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:321:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:322:12: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:322:14: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:324:12: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:324:14: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:325:16: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:325:18: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/net_tools/netbox/netbox_site.py:330:1: E122 continuation line missing indentation or outdented
lib/ansible/modules/net_tools/netbox/netbox_site.py:332:1: E901 TokenError: EOF in multi-line statement

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:0:0: E401 Python SyntaxError while parsing module

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

lib/ansible/modules/net_tools/netbox/netbox_site.py:228:10: python-syntax-error invalid syntax (<unknown>, line 228)

click here for bot help

@NilashishC
Copy link
Contributor

NilashishC left a comment

@FragmentedPacket Could you please add some unit tests for this new module?

@FragmentedPacket

This comment has been minimized.

Copy link
Contributor Author

FragmentedPacket commented Mar 11, 2019

@NilashishC I'm not sure unit tests will work in this case as most of the stuff returned here is an object itself so mocking that is pretty difficult. I was looking at integration testing. Is there a spot for more detailed documentation for building integration tests? We'd want to spin up a netbox instance using docker and then run the integration playbooks against that instance.

@FragmentedPacket

This comment has been minimized.

Copy link
Contributor Author

FragmentedPacket commented Mar 11, 2019

@Anthony25 Do you have any ideas for testing strategies?

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 18, 2019

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

lib/ansible/module_utils/net_tools/netbox/netbox_utils.py:321:74: trailing-whitespace Trailing whitespace

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

lib/ansible/module_utils/net_tools/netbox/netbox_utils.py:321:16: E111 indentation is not a multiple of four
lib/ansible/module_utils/net_tools/netbox/netbox_utils.py:321:75: W291 trailing whitespace

click here for bot help

@ansibot ansibot added ci_verified and removed ci_verified labels Mar 18, 2019

validate_certs=dict(type="bool", default=True)
)

global module

This comment has been minimized.

@NilashishC

NilashishC Mar 25, 2019

Contributor

Please refrain from using global.

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.