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

Unable to create a mysql instance (Value of unknown type: <class 'scaleway.rdb.v1.types.Volume'>,) #12

Open
alviss7 opened this issue Jun 28, 2023 · 4 comments
Assignees
Labels
priority:medium Improvements that are not the main priority

Comments

@alviss7
Copy link

alviss7 commented Jun 28, 2023

Hello,

I can't create an error-free mysql instance with your new collection with this simple task:

- name: Create a instance
  scaleway.scaleway.scaleway_rdb_instance:
    project_id: "6b7f84df-14b0-4b84-8fea-2f04cd480001"
    access_key: "{{ scw_token.secret.access_key }}"
    secret_key: "{{ scw_token.secret.secret_key }}"
    name: "rdb-test1"
    engine: "MySQL-8"
    user_name: "root"
    password: "srU5&^$)2YvWk9t5"
    node_type: "db-dev-s"
    is_ha_cluster: false
    disable_backup: false
    volume_type: "lssd"
    volume_size: 5000000000
    backup_same_region: false
    state: "present"
    region: "fr-par"
    wait: true
    wait_timeout: 900

The instance is created fine but I have this error:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: Value of unknown type: <class 'scaleway.rdb.v1.types.Volume'>, Volume(type_=None, size=5000000000)
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/cpn/.ansible/tmp/ansible-tmp-1687966215.2367864-252093-81216644931943/AnsiballZ_scaleway_rdb_instance.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/cpn/.ansible/tmp/ansible-tmp-1687966215.2367864-252093-81216644931943/AnsiballZ_scaleway_rdb_instance.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/cpn/.ansible/tmp/ansible-tmp-1687966215.2367864-252093-81216644931943/AnsiballZ_scaleway_rdb_instance.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.scaleway.scaleway.plugins.modules.scaleway_rdb_instance', init_globals=dict(_module_fqn='ansible_collections.scaleway.scaleway.plugins.modules.scaleway_rdb_instance', _modlib_path=modlib_path),\n  File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_scaleway.scaleway.scaleway_rdb_instance_payload_mbn1slx8/ansible_scaleway.scaleway.scaleway_rdb_instance_payload.zip/ansible_collections/scaleway/scaleway/plugins/modules/scaleway_rdb_instance.py\", line 369, in <module>\n  File \"/tmp/ansible_scaleway.scaleway.scaleway_rdb_instance_payload_mbn1slx8/ansible_scaleway.scaleway.scaleway_rdb_instance_payload.zip/ansible_collections/scaleway/scaleway/plugins/modules/scaleway_rdb_instance.py\", line 365, in main\n  File \"/tmp/ansible_scaleway.scaleway.scaleway_rdb_instance_payload_mbn1slx8/ansible_scaleway.scaleway.scaleway_rdb_instance_payload.zip/ansible_collections/scaleway/scaleway/plugins/modules/scaleway_rdb_instance.py\", line 273, in core\n  File \"/tmp/ansible_scaleway.scaleway.scaleway_rdb_instance_payload_mbn1slx8/ansible_scaleway.scaleway.scaleway_rdb_instance_payload.zip/ansible_collections/scaleway/scaleway/plugins/modules/scaleway_rdb_instance.py\", line 226, in create\n  File \"/tmp/ansible_scaleway.scaleway.scaleway_rdb_instance_payload_mbn1slx8/ansible_scaleway.scaleway.scaleway_rdb_instance_payload.zip/ansible/module_utils/basic.py\", line 1513, in exit_json\n  File \"/tmp/ansible_scaleway.scaleway.scaleway_rdb_instance_payload_mbn1slx8/ansible_scaleway.scaleway.scaleway_rdb_instance_payload.zip/ansible/module_utils/basic.py\", line 1506, in _return_formatted\n  File \"/tmp/ansible_scaleway.scaleway.scaleway_rdb_instance_payload_mbn1slx8/ansible_scaleway.scaleway.scaleway_rdb_instance_payload.zip/ansible/module_utils/common/parameters.py\", line 928, in remove_values\n  File \"/tmp/ansible_scaleway.scaleway.scaleway_rdb_instance_payload_mbn1slx8/ansible_scaleway.scaleway.scaleway_rdb_instance_payload.zip/ansible/module_utils/common/parameters.py\", line 471, in _remove_values_conditions\nTypeError: Value of unknown type: <class 'scaleway.rdb.v1.types.Volume'>, Volume(type_=None, size=5000000000)\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

I don't think I made a mistake with the type of my variables, at least, I followed the documentation with ansible-doc
Thanks for this collection and for looking at this.

@remyleone remyleone added priority:highest Bugs filled by customers, security issues priority:high New features and removed priority:highest Bugs filled by customers, security issues labels Nov 2, 2023
@remyleone remyleone added priority:medium Improvements that are not the main priority and removed priority:high New features labels Nov 24, 2023
@remyleone remyleone assigned Laure-di and unassigned Mia-Cross Mar 4, 2024
@DeLoWaN
Copy link

DeLoWaN commented Aug 29, 2024

I have the same error with a loadbalancer resource:

- name: Create a LoadBalancer
  scaleway.scaleway.scaleway_lb:
    secret_key: "{{ awx_scaleway_project.secret_key }}"
    access_key: "{{ awx_scaleway_project.access_key }}"
    organization_id: "{{ awx_scaleway_project.organization_id }}"
    project_id: "{{ awx_scaleway_project.project_id }}"
    name: AWX
    description: AWX LoadBalancer
    type_: lb-s
    region: fr-par
    ssl_compatibility_level: ssl_compatibility_level_modern

Results in

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: Value of unknown type: <class 'scaleway.lb.v1.types.Instance'>, Instance(id='2b9730dc-2ab3-4249-b53e-5e8c4cd8d1fa', status='ready', ip_address='', zone='fr-par-1', created_at=datetime.datetime(2024, 8, 29, 9, 48, 41, 375678, tzinfo=tzutc()), updated_at=datetime.datetime(2024, 8, 29, 10, 0, 22, 232706, tzinfo=tzutc()), region='fr-par')
fatal: [localhost]: FAILED! => {
    "changed": false,
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDERR:

Traceback (most recent call last):
  File "/Users/damien/.ansible/tmp/ansible-tmp-1724925619.645507-94243-242501380911336/AnsiballZ_scaleway_lb.py", line 107, in <module>
    _ansiballz_main()
  File "/Users/damien/.ansible/tmp/ansible-tmp-1724925619.645507-94243-242501380911336/AnsiballZ_scaleway_lb.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/Users/damien/.ansible/tmp/ansible-tmp-1724925619.645507-94243-242501380911336/AnsiballZ_scaleway_lb.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.scaleway.scaleway.plugins.modules.scaleway_lb', init_globals=dict(_module_fqn='ansible_collections.scaleway.scaleway.plugins.modules.scaleway_lb', _modlib_path=modlib_path),
  File "/Users/damien/.pyenv/versions/3.9.18/lib/python3.9/runpy.py", line 225, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/Users/damien/.pyenv/versions/3.9.18/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Users/damien/.pyenv/versions/3.9.18/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/var/folders/xv/lcz0hmwn2hd2kyxhzdxt4gdm0000gn/T/ansible_scaleway.scaleway.scaleway_lb_payload_fd43h6ff/ansible_scaleway.scaleway.scaleway_lb_payload.zip/ansible_collections/scaleway/scaleway/plugins/modules/scaleway_lb.py", line 291, in <module>
  File "/var/folders/xv/lcz0hmwn2hd2kyxhzdxt4gdm0000gn/T/ansible_scaleway.scaleway.scaleway_lb_payload_fd43h6ff/ansible_scaleway.scaleway.scaleway_lb_payload.zip/ansible_collections/scaleway/scaleway/plugins/modules/scaleway_lb.py", line 287, in main
  File "/var/folders/xv/lcz0hmwn2hd2kyxhzdxt4gdm0000gn/T/ansible_scaleway.scaleway.scaleway_lb_payload_fd43h6ff/ansible_scaleway.scaleway.scaleway_lb_payload.zip/ansible_collections/scaleway/scaleway/plugins/modules/scaleway_lb.py", line 221, in core
  File "/var/folders/xv/lcz0hmwn2hd2kyxhzdxt4gdm0000gn/T/ansible_scaleway.scaleway.scaleway_lb_payload_fd43h6ff/ansible_scaleway.scaleway.scaleway_lb_payload.zip/ansible_collections/scaleway/scaleway/plugins/modules/scaleway_lb.py", line 174, in create
  File "/var/folders/xv/lcz0hmwn2hd2kyxhzdxt4gdm0000gn/T/ansible_scaleway.scaleway.scaleway_lb_payload_fd43h6ff/ansible_scaleway.scaleway.scaleway_lb_payload.zip/ansible/module_utils/basic.py", line 1533, in exit_json
  File "/var/folders/xv/lcz0hmwn2hd2kyxhzdxt4gdm0000gn/T/ansible_scaleway.scaleway.scaleway_lb_payload_fd43h6ff/ansible_scaleway.scaleway.scaleway_lb_payload.zip/ansible/module_utils/basic.py", line 1522, in _return_formatted
  File "/var/folders/xv/lcz0hmwn2hd2kyxhzdxt4gdm0000gn/T/ansible_scaleway.scaleway.scaleway_lb_payload_fd43h6ff/ansible_scaleway.scaleway.scaleway_lb_payload.zip/ansible/module_utils/common/parameters.py", line 931, in remove_values
  File "/var/folders/xv/lcz0hmwn2hd2kyxhzdxt4gdm0000gn/T/ansible_scaleway.scaleway.scaleway_lb_payload_fd43h6ff/ansible_scaleway.scaleway.scaleway_lb_payload.zip/ansible/module_utils/common/parameters.py", line 470, in _remove_values_conditions
TypeError: Value of unknown type: <class 'scaleway.lb.v1.types.Instance'>, Instance(id='2b9730dc-2ab3-4249-b53e-5e8c4cd8d1fa', status='ready', ip_address='', zone='fr-par-1', created_at=datetime.datetime(2024, 8, 29, 9, 48, 41, 375678, tzinfo=tzutc()), updated_at=datetime.datetime(2024, 8, 29, 10, 0, 22, 232706, tzinfo=tzutc()), region='fr-par')

Right now the collection is unusable. Creating via the CLI works.

@DeLoWaN
Copy link

DeLoWaN commented Aug 29, 2024

I managed to workaround using direct calls to the API, but that's defeat the whole point of having a module:

- name: List LoadBalancers
  ansible.builtin.uri:
    method: GET
    headers:
      X-Auth-Token: "{{ awx__scaleway_project.secret_key }}"
    url: "https://api.scaleway.com/lb/v1/zones/{{ awx__scaleway_project.zone }}/lbs?name={{ awx__loadbalancer_name }}"
  register: lbs

- name: Create a LoadBalancer
  ansible.builtin.uri:
    method: POST
    headers:
      X-Auth-Token: "{{ awx__scaleway_project.secret_key }}"
    body_format: json
    url: "https://api.scaleway.com/lb/v1/zones/{{ awx__scaleway_project.zone }}/lbs"
    body:
      name: "{{ awx__loadbalancer_name }}"
      description: "{{ awx__loadbalancer_description }}"
      project_id: "{{ awx__scaleway_project.project_id }}"
  when: lbs.json.total_count == 0
  register: lb

@gionn
Copy link

gionn commented Oct 13, 2024

Most of this collection modules looks broken for the lack of a proper handling of the module.exit_json data parameter, for which a simple .__to_dict__ isn't sufficient in most of the cases - when the api payload contains more than primitive fields.

So as of now almost the entire collection modules are not really in a working state?

@quantumsheep
Copy link
Member

quantumsheep commented Oct 14, 2024

Hi! I wanted to let you know that the collection was stalled because I switched teams and am no longer maintaining Ansible at Scaleway.

However, a new maintainer has started taking over the project, so you should see some updates and fixes coming soon.

Thanks for your patience and sorry for any inconvenience in the meantime!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:medium Improvements that are not the main priority
Projects
None yet
Development

No branches or pull requests

7 participants