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_network port_security_enabled unexpected keyword #62062

Closed
agowa opened this issue Sep 10, 2019 · 6 comments
Closed

os_network port_security_enabled unexpected keyword #62062

agowa opened this issue Sep 10, 2019 · 6 comments
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. cloud has_pr This issue has an associated PR. module This issue/PR relates to a module. openstack support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.

Comments

@agowa
Copy link
Contributor

agowa commented Sep 10, 2019

SUMMARY

The module os_network throws an unexpected keyword error

ISSUE TYPE
  • Bug Report
COMPONENT NAME

os_network

ANSIBLE VERSION
ansible 2.10.0.dev0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/PycharmProjects/foo/lib/ansible
  executable location = /home/user/PycharmProjects/foo/bin/ansible
  python version = 3.7.4 (default, Jul 16 2019, 07:12:58) [GCC 9.1.0]
CONFIGURATION

OS / ENVIRONMENT

ArchLinux and ansible from source

STEPS TO REPRODUCE
- os_network:
    cloud: mycloud
    state: present
    name: ext_network
EXPECTED RESULTS

Network ext_network is created

ACTUAL RESULTS
<ansible_connection=local> ESTABLISH LOCAL CONNECTION FOR USER: user
<ansible_connection=local> EXEC /bin/sh -c 'echo ~user && sleep 0'
<ansible_connection=local> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653 `" && echo ansible-tmp-1568119756.1711743-57841647084653="` echo /home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653 `" ) && sleep 0'
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/basic.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/openstack.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/file.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/_utils.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/pycompat24.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/parsing/convert_bool.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/six/__init__.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/text/formatters.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/parameters.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/text/converters.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/process.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/_json_compat.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/sys_info.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/_text.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/_collections_compat.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/__init__.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/validation.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/parsing/__init__.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/text/__init__.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/common/collections.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/distro/__init__.py
Using module_utils file /home/user/PycharmProjects/foo/lib/ansible/module_utils/distro/_distro.py
Using module file /home/user/PycharmProjects/foo/lib/ansible/modules/cloud/openstack/os_network.py
<ansible_connection=local> PUT /home/user/.ansible/tmp/ansible-local-36553ghd_qohx/tmpwn2x8ad4 TO /home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/AnsiballZ_os_network.py
<ansible_connection=local> EXEC /bin/sh -c 'chmod u+x /home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/ /home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/AnsiballZ_os_network.py && sleep 0'
<ansible_connection=local> EXEC /bin/sh -c 'python2 /home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/AnsiballZ_os_network.py && sleep 0'
<ansible_connection=local> EXEC /bin/sh -c 'rm -f -r /home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/AnsiballZ_os_network.py", line 102, in <module>
    _ansiballz_main()
  File "/home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/AnsiballZ_os_network.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/AnsiballZ_os_network.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible.modules.cloud.openstack.os_network', init_globals=None, run_name='__main__', alter_sys=False)
  File "/usr/lib/python2.7/runpy.py", line 192, in run_module
    fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/tmp/ansible_os_network_payload_HaCvOE/ansible_os_network_payload.zip/ansible/modules/cloud/openstack/os_network.py", line 255, in <module>
  File "/tmp/ansible_os_network_payload_HaCvOE/ansible_os_network_payload.zip/ansible/modules/cloud/openstack/os_network.py", line 237, in main
TypeError: create_network() got an unexpected keyword argument 'port_security_enabled'

fatal: [ansible_connection=local]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/AnsiballZ_os_network.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/AnsiballZ_os_network.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/user/.ansible/tmp/ansible-tmp-1568119756.1711743-57841647084653/AnsiballZ_os_network.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.cloud.openstack.os_network', init_globals=None, run_name='__main__', alter_sys=False)\n  File \"/usr/lib/python2.7/runpy.py\", line 192, in run_module\n    fname, loader, pkg_name)\n  File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n    exec code in run_globals\n  File \"/tmp/ansible_os_network_payload_HaCvOE/ansible_os_network_payload.zip/ansible/modules/cloud/openstack/os_network.py\", line 255, in <module>\n  File \"/tmp/ansible_os_network_payload_HaCvOE/ansible_os_network_payload.zip/ansible/modules/cloud/openstack/os_network.py\", line 237, in main\nTypeError: create_network() got an unexpected keyword argument 'port_security_enabled'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Can be fixed by:

diff --git a/lib/ansible/modules/cloud/openstack/os_network.py b/lib/ansible/modules/cloud/openstack/os_network.py
index 79f4b0f9e3..98d90f7847 100644
--- a/lib/ansible/modules/cloud/openstack/os_network.py
+++ b/lib/ansible/modules/cloud/openstack/os_network.py
@@ -227,14 +227,12 @@ def main():
 
                 if project_id is not None:
                     net = cloud.create_network(name, shared, admin_state_up,
-                                               external, provider, project_id,
-                                               port_security_enabled=port_security_enabled,
-                                               mtu_size=mtu, dns_domain=dns_domain)
+                                               external, provider, project_id
+                                               )
                 else:
                     net = cloud.create_network(name, shared, admin_state_up,
-                                               external, provider,
-                                               port_security_enabled=port_security_enabled,
-                                               mtu_size=mtu, dns_domain=dns_domain)
+                                               external, provider
+                                               )
                 changed = True
             else:
                 changed = False

my openstacksdk version is 0.35 and I've installed it using pacman python-openstacksdk.

@ansibot
Copy link
Contributor

ansibot commented Sep 10, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Sep 10, 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_triage Needs a first human triage before being processed. openstack support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. labels Sep 10, 2019
@odyssey4me
Copy link
Contributor

I've proposed a fix for this to the upstream collection: https://review.opendev.org/708119
Once that is merged I'll propose a patch to stable-2.9 too.

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Feb 17, 2020
openstack-gerrit pushed a commit to openstack/ansible-collections-openstack that referenced this issue Feb 18, 2020
To make use of the port_security_enabled [a] and mtu [b] parameters,
[c] and [d] need to be present in the openstacksdk or the os_network
module with return an error like:

TypeError: create_network() got an unexpected keyword argument 'port_security_enabled'

or:

TypeError: create_network() got an unexpected keyword argument 'mtu'

To handle this, we fail the module if one of the arguments are used
and the minimum openstacksdk version for that argument is not met.

[a] ansible/ansible@eaf238b
[b] ansible/ansible@c6a8e99
[c] openstack/openstacksdk@8eb788a
[d] openstack/openstacksdk@a1fc820

Fixes: ansible/ansible#62062
Change-Id: I2b80dc721a08bbdb530af3705ae99cf1b579d9f0
odyssey4me added a commit to odyssey4me/ansible that referenced this issue Feb 18, 2020
To make use of the port_security_enabled [a] and mtu [b] parameters,
[c] and [d] need to be present in the openstacksdk or the os_network
module with return an error like:

TypeError: create_network() got an unexpected keyword argument 'port_security_enabled'

or:

TypeError: create_network() got an unexpected keyword argument 'mtu'

To handle this, we fail the module if one of the arguments are used
and the minimum openstacksdk version for that argument is not met.

[a] ansible@eaf238b
[b] ansible@c6a8e99
[c] openstack/openstacksdk@8eb788a
[d] openstack/openstacksdk@a1fc820

Backport-of: https://review.opendev.org/708119
Fixes: ansible#62062
Change-Id: I2b80dc721a08bbdb530af3705ae99cf1b579d9f0
@odyssey4me
Copy link
Contributor

The collection patch has merged. The stable-2.9 PR is up: #67546

@ansibot ansibot added the has_pr This issue has an associated PR. label Feb 18, 2020
odyssey4me added a commit to odyssey4me/ansible that referenced this issue Feb 19, 2020
…rity_enabled

To make use of the port_security_enabled [a] parameter, [b] needs
to be present in the openstacksdk or the os_network module will
return an error like:

TypeError: create_network() got an unexpected keyword argument 'port_security_enabled'

To handle this, we fail the module if one of the arguments are used
and the minimum openstacksdk version for that argument is not met.

[a] ansible@eaf238b
[b] openstack/openstacksdk@8eb788a

Backport-of: https://review.opendev.org/708119
Fixes: ansible#62062
@odyssey4me
Copy link
Contributor

Oh, and I've pushed a stable-2.8 PR up too: #67577

mattclay pushed a commit that referenced this issue Mar 2, 2020
To make use of the port_security_enabled [a] and mtu [b] parameters,
[c] and [d] need to be present in the openstacksdk or the os_network
module with return an error like:

TypeError: create_network() got an unexpected keyword argument 'port_security_enabled'

or:

TypeError: create_network() got an unexpected keyword argument 'mtu'

To handle this, we fail the module if one of the arguments are used
and the minimum openstacksdk version for that argument is not met.

[a] eaf238b
[b] c6a8e99
[c] openstack/openstacksdk@8eb788a
[d] openstack/openstacksdk@a1fc820

Backport-of: https://review.opendev.org/708119
Fixes: #62062
Change-Id: I2b80dc721a08bbdb530af3705ae99cf1b579d9f0
mattclay pushed a commit that referenced this issue Mar 2, 2020
…rity_enabled

To make use of the port_security_enabled [a] parameter, [b] needs
to be present in the openstacksdk or the os_network module will
return an error like:

TypeError: create_network() got an unexpected keyword argument 'port_security_enabled'

To handle this, we fail the module if one of the arguments are used
and the minimum openstacksdk version for that argument is not met.

[a] eaf238b
[b] openstack/openstacksdk@8eb788a

Backport-of: https://review.opendev.org/708119
Fixes: #62062
@odyssey4me
Copy link
Contributor

bug_resolved

@ansibot ansibot closed this as completed Mar 30, 2020
@ansible ansible locked and limited conversation to collaborators Apr 27, 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. cloud has_pr This issue has an associated PR. module This issue/PR relates to a module. openstack support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.
Projects
None yet
Development

No branches or pull requests

3 participants