opentelekomcloud / ansible-collection-cloud

Ansible modules for using with OTC (addition to the native OpenStack modules)
Apache License 2.0
21 stars 13 forks source link

opentelekomcloud.cloud.subnet fails when changing description parameter #178

Closed hadoopch closed 1 year ago

hadoopch commented 2 years ago

Hi all, today i tried:

When i run the the following playbook the first time with description parameter everything is working fine.

- name: "Fetch id {{ vpcid.stdout }} for vpc  name {{snnet.sn_vpc_name}}"
  set_fact:
    sn_vpc_id={{ vpcid.stdout }}

- name: "Create subnet {{snnet.sn_name}}"
  opentelekomcloud.cloud.subnet:
    name: "{{snnet.sn_name}}"
    vpc_id: "{{ sn_vpc_id}}"
    cidr: "{{ snnet.sn_cidr }}"
    gateway_ip: "{{ snnet.sn_gateway_ip }}"
    #description: "{{snnet.sn_description}}"
    description: "{{ snnet.sn_description }}"
    dns_list:
      - "{{dns_1}}"
      - "{{dns_2}}"

If i change the description and rerun the playbook it fails with the following error:


The full traceback is:
Traceback (most recent call last):
  File "/home/linux/.ansible/tmp/ansible-tmp-1645541884.0863757-233713335327632/AnsiballZ_subnet.py", line 102, in <module>
    _ansiballz_main()
  File "/home/linux/.ansible/tmp/ansible-tmp-1645541884.0863757-233713335327632/AnsiballZ_subnet.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/linux/.ansible/tmp/ansible-tmp-1645541884.0863757-233713335327632/AnsiballZ_subnet.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.opentelekomcloud.cloud.plugins.modules.subnet', init_globals=None, run_name='__main__', alter_sys=False)
  File "/usr/lib64/python3.6/runpy.py", line 208, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_opentelekomcloud.cloud.subnet_payload_jldr6mt3/ansible_opentelekomcloud.cloud.subnet_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/subnet.py", line 349, in <module>
  File "/tmp/ansible_opentelekomcloud.cloud.subnet_payload_jldr6mt3/ansible_opentelekomcloud.cloud.subnet_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/subnet.py", line 345, in main
  File "/tmp/ansible_opentelekomcloud.cloud.subnet_payload_jldr6mt3/ansible_opentelekomcloud.cloud.subnet_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/module_utils/otc.py", line 201, in __call__
  File "/tmp/ansible_opentelekomcloud.cloud.subnet_payload_jldr6mt3/ansible_opentelekomcloud.cloud.subnet_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/subnet.py", line 263, in run
TypeError: fail_json() takes 1 positional argument but 2 were given

fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/linux/.ansible/tmp/ansible-tmp-1645541884.0863757-233713335327632/AnsiballZ_subnet.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/linux/.ansible/tmp/ansible-tmp-1645541884.0863757-233713335327632/AnsiballZ_subnet.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/linux/.ansible/tmp/ansible-tmp-1645541884.0863757-233713335327632/AnsiballZ_subnet.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.opentelekomcloud.cloud.plugins.modules.subnet', init_globals=None, run_name='__main__', alter_sys=False)\n  File \"/usr/lib64/python3.6/runpy.py\", line 208, in run_module\n    return _run_code(code, {}, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_opentelekomcloud.cloud.subnet_payload_jldr6mt3/ansible_opentelekomcloud.cloud.subnet_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/subnet.py\", line 349, in <module>\n  File \"/tmp/ansible_opentelekomcloud.cloud.subnet_payload_jldr6mt3/ansible_opentelekomcloud.cloud.subnet_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/subnet.py\", line 345, in main\n  File \"/tmp/ansible_opentelekomcloud.cloud.subnet_payload_jldr6mt3/ansible_opentelekomcloud.cloud.subnet_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/module_utils/otc.py\", line 201, in __call__\n  File \"/tmp/ansible_opentelekomcloud.cloud.subnet_payload_jldr6mt3/ansible_opentelekomcloud.cloud.subnet_payload.zip/ansible_collections/opentelekomcloud/cloud/plugins/modules/subnet.py\", line 263, in run\nTypeError: fail_json() takes 1 positional argument but 2 were given\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Could you please check ?

Thanks in advance

Uli

hadoopch commented 2 years ago

Good morning everybody,

this issues is not fixed with latest release 0.12.

Best regards Uli

vladimirvshivkov commented 2 years ago

Checking it now

vladimirvshivkov commented 2 years ago

@hadoopch fixed in 0.12.1. try on your environment and let us know, please. thanks

hadoopch commented 2 years ago

Hi Enrou,

i made an update to 0.12.1. But the error still occurs when i change the description of a subnet and rerun the playbook afterwards

vladimirvshivkov commented 2 years ago

In that case, could you send log with full verbosity (-vvvvv)

hadoopch commented 2 years ago

Hi Enrou, the error i have sent is already a -vvvv output.

vladimirvshivkov commented 2 years ago

It would be very helpful if you could send the full log of a task, including the parameters of invocation.

hadoopch commented 1 year ago

Hi Vladimir,

Today i made a test with Version 0.12.4

    "msg": "updating subnet fields {'gateway_ip': '10.2.254.1', 'cidr': '10.2.254.0/24'} is not supported (subnet: otcextensions.sdk.vpc.v1.subnet.Subnet(id=37d5aba6-2418-4ff7-ad18-3b7cdc10cba2, name=kunde1-SN-pub, description=, cidr=10.2.254.0/24, dnsList=['100.125.4.25', '100.125.64.24'], status=ACTIVE, vpc_id=ca958018-4edc-464c-9342-82e757a65ea8, gateway_ip=10.2.254.1, dhcp_enable=True, primary_dns=100.125.4.25, secondary_dns=100.125.64.24, neutron_network_id=37d5aba6-2418-4ff7-ad18-3b7cdc10cba2, neutron_subnet_id=88ba4ba9-473c-4e15-af8c-11aabc0cfe3e, extra_dhcp_opts=[], project_id=6573b4be93e742f9a45b0f2d33e6b03b, location=Munch({'cloud': 'otc', 'region_name': 'eu-ch2', 'zone': None, 'project': Munch({'id': '6573b4be93e742f9a45b0f2d33e6b03b', 'name': 'eu-ch2_dvs', 'domain_id': None, 'domain_name': 'OTC00000000001000077913'})})))"
}

The problem still exist. For any reasons it is not supported.

gtema commented 1 year ago

@hadoopch , sorry for long time for processing this https://docs.otc.t-systems.com/virtual-private-cloud/api-ref/native_openstack_neutron_apis_v2.0/subnet/updating_a_subnet.html#vpc-subnet02-0004 describes that gateway_ip can not be updated. Sorry, but we can't help here.