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

os_router: Fixes subnet and network scope through filters #62799

Closed
wants to merge 1 commit into from

Conversation

racciari
Copy link
Contributor

SUMMARY
  • When checking for external_fixed_ips, the search for the subnet was scoped with
    the project for an external (shared) subnet. This only works for the project who one the external network.

  • For each interface defined for the router, the search for the network wasn't scoped
    to the project, which leads to "Multiple matches found for network" error if their
    were multiple network with the same name.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

os_router

ADDITIONAL INFORMATION

ansible 2.8.5 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/racciari/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /home/racciari/venv/ansible-test/lib/python2.7/site-packages/ansible executable location = /home/racciari/venv/ansible-test/bin/ansible python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

1- Create 2 projects
2- Create a network in each project using the same name
3 - Create a router with the network name

…terfaces

* When checking for external_fixed_ips, the search for the subnet was scoped with
the project for an external (shared) subnet.

* For interfaces defined for the router, the search for the network wasn't scoped
to the project, which leads to "Multiple matches found for network" error if their
were multiple network with the same name.
@ansibot
Copy link
Contributor

ansibot commented Sep 24, 2019

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

lib/ansible/modules/cloud/openstack/os_router.py:0:0: python-syntax-error: Python SyntaxError while parsing module
test/sanity/ignore.txt:1641:1: A100: Ignoring 'parameter-type-not-in-doc' on 'lib/ansible/modules/cloud/openstack/os_router.py' is unnecessary
test/sanity/ignore.txt:1642:1: A100: Ignoring 'doc-missing-type' on 'lib/ansible/modules/cloud/openstack/os_router.py' is unnecessary

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

lib/ansible/modules/cloud/openstack/os_router.py:350:0: syntax-error: invalid syntax (<unknown>, line 350)

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

Command "ansible-doc -t module os_router" returned exit status 1.
>>> Standard Error
ERROR! module os_router missing documentation (or could not parse documentation): invalid syntax (<unknown>, line 350)

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

Command "/usr/bin/python3.6 /root/ansible/test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
PYTHONPATH=../../lib ../../hacking/build-ansible.py collection-meta --template-file=../templates/collections_galaxy_meta.rst.j2 --output-dir=rst/dev_guide/ ../../lib/ansible/galaxy/data/collections_galaxy_meta.yml
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-config --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../../hacking/build-ansible.py generate-man --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-keywords --template-dir=../templates --output-dir=rst/reference_appendices/ ./keyword_desc.yml
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-plugins -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Evaluating module files...
Makefile:99: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../../hacking/build-ansible.py", line 92, in <module>
    main()
  File "../../hacking/build-ansible.py", line 81, in main
    retval = command.main(args)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 721, in main
    plugin_info, categories = get_plugin_info(args.module_dir, limit_to=args.limit_to, verbose=(args.verbosity > 0))
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 225, 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 124, 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 350
    net = cloud.get_network(iface['net'], filters))
                                                  ^
SyntaxError: invalid syntax
make: *** [modules] Error 1

The test ansible-test sanity --test package-data [explain] failed with the error:

Command "/usr/bin/python3.6 /root/ansible/test/sanity/code-smell/package-data.py" returned exit status 1.
>>> Standard Error
Traceback (most recent call last):
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 383, in <module>
    main()
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 360, in main
    sdist_path = create_sdist(tmp_dir)
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 174, in create_sdist
    raise Exception('make snapshot failed:\n%s' % stderr)
Exception: make snapshot failed:
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
docs/man/man1/ansible-galaxy.1.rst:51: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
docs/man/man1/ansible-galaxy.1.rst:57: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
ERROR! module os_router at /tmp/tmp7af__vg5/lib/ansible/modules/cloud/openstack/os_router.py has a documentation error formatting or is missing documentation.
Traceback (most recent call last):
  File "packaging/release/changelogs/changelog.py", line 835, in <module>
    main()
  File "packaging/release/changelogs/changelog.py", line 102, in main
    args.func(args)
  File "packaging/release/changelogs/changelog.py", line 132, in command_release
    plugins = load_plugins(version=version, force_reload=reload_plugins)
  File "packaging/release/changelogs/changelog.py", line 184, in load_plugins
    '--json', '--metadata-dump', '-t', plugin_type])
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/tmp/tmp7af__vg5/bin/ansible-doc', '--json', '--metadata-dump', '-t', 'module']' returned non-zero exit status 1.
make: *** [changelog] Error 1

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

lib/ansible/modules/cloud/openstack/os_router.py:350:63: SyntaxError: net = cloud.get_network(iface['net'], filters))

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

lib/ansible/modules/cloud/openstack/os_router.py:350:63: SyntaxError: net = cloud.get_network(iface['net'], filters))

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

lib/ansible/modules/cloud/openstack/os_router.py:350:63: SyntaxError: net = cloud.get_network(iface['net'], filters))

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

lib/ansible/modules/cloud/openstack/os_router.py:350:63: SyntaxError: net = cloud.get_network(iface['net'], filters))

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

lib/ansible/modules/cloud/openstack/os_router.py:350:63: SyntaxError: net = cloud.get_network(iface['net'], filters))

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Sep 24, 2019

@ansibot ansibot added affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. openstack small_patch support:community This issue/PR relates to code supported by the Ansible community. labels Sep 24, 2019
@opendev-zuul
Copy link

opendev-zuul bot commented Sep 24, 2019

Build failed (third-party-check pipeline) integration testing with
OpenStack. For information on how to proceed, see
http://docs.openstack.org/infra/manual/developers.html#automated-testing

@goneri goneri added the ci_verified Changes made in this PR are causing tests to fail. label Oct 2, 2019
@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Oct 2, 2019
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 10, 2019
@sshnaidm
Copy link
Contributor

Thanks for submitting patch for Openstack Ansible modules!
We moved Openstack Ansible modules to Openstack repositories.
Next patches should be submitted not with Ansible Github but with
Openstack Gerrit: https://review.opendev.org/#/q/project:openstack/ansible-collections-openstack
Please submit your code there from now.
Thanks for your contribution and sorry for inconvienience.

@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html new_module This PR includes a new module. new_plugin This PR includes a new plugin. labels Mar 24, 2020
@ansibot ansibot removed the new_module This PR includes a new module. label Apr 1, 2020
@ansibot ansibot added collection Related to Ansible Collections work collection:openstack.cloud needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@ansibot ansibot removed collection:openstack.cloud needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Jul 15, 2020
@Akasurde
Copy link
Member

@racciari Thanks for the contribution. Closing as per above.

@Akasurde Akasurde closed this Aug 19, 2020
@ansible ansible locked as resolved and limited conversation to collaborators Aug 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. ci_verified Changes made in this PR are causing tests to fail. cloud collection Related to Ansible Collections work module This issue/PR relates to a module. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. new_plugin This PR includes a new plugin. openstack small_patch stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants