stackhpc / stackhpc/openstack-config

KeyError when assigning quotas

Offen
#58 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
Jinja
Sterne
5
Forks
8
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

When attempting to assign quotas to a project if the quotas changes it will cause a KeyError: 'project_id'.

TASK [stackhpc.openstack.os_projects : Ensure quotas are set] ****************************************************************************************************************************************************************************************************************************************
Friday 22 August 2025  12:49:34 +0000 (0:00:01.327)       0:00:22.558 *********
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'project_id'
failed: [localhost] (item=demo) => changed=false
  ansible_loop_var: item
  item:
    description: OpenStack demo project
    keypairs:
    - name: id_ed25519
      public_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICKx4TMa8vtpOe3qHeMX4Z7JZyucBcqlfv8iFY6dZkzB
    name: demo
    project_domain: default
    quotas:
      backup_gigabytes: -1
      backups: -1
      cores: -1
      floatingip: -1
      gigabytes: -1
      injected_file_size: -1
      injected_files: -1
      instances: -1
      key_pairs: -1
      per_volume_gigabytes: -1
      ram: -1
      security_group: -1
      security_group_rule: -1
      snapshots: -1
      volumes: -1
    user_domain: default
    users:
    - description: StackHPC Demo user
      email: demo@stackhpc.com
      name: demo
      password: *****
      roles:
      - member
      - reader
  module_stderr: |-
    Traceback (most recent call last):
      File "/home/stack/.ansible/tmp/ansible-tmp-1755866974.7532272-708515-178033976670647/AnsiballZ_quota.py", line 107, in <module>
        _ansiballz_main()
      File "/home/stack/.ansible/tmp/ansible-tmp-1755866974.7532272-708515-178033976670647/AnsiballZ_quota.py", line 99, in _ansiballz_main
        invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
      File "/home/stack/.ansible/tmp/ansible-tmp-1755866974.7532272-708515-178033976670647/AnsiballZ_quota.py", line 47, in invoke_module
        runpy.run_module(mod_name='ansible_collections.openstack.cloud.plugins.modules.quota', init_globals=dict(_module_fqn='ansible_collections.openstack.cloud.plugins.modules.quota', _modlib_path=modlib_path),
      File "/usr/lib64/python3.9/runpy.py", line 225, in run_module
        return _run_module_code(code, init_globals, run_name, mod_spec)
      File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/tmp/ansible_openstack.cloud.quota_payload_85q5nn83/ansible_openstack.cloud.quota_payload.zip/ansible_collections/openstack/cloud/plugins/modules/quota.py", line 560, in <module>
      File "/tmp/ansible_openstack.cloud.quota_payload_85q5nn83/ansible_openstack.cloud.quota_payload.zip/ansible_collections/openstack/cloud/plugins/modules/quota.py", line 556, in main
      File "/tmp/ansible_openstack.cloud.quota_payload_85q5nn83/ansible_openstack.cloud.quota_payload.zip/ansible_collections/openstack/cloud/plugins/module_utils/openstack.py", line 417, in __call__
      File "/tmp/ansible_openstack.cloud.quota_payload_85q5nn83/ansible_openstack.cloud.quota_payload.zip/ansible_collections/openstack/cloud/plugins/modules/quota.py", line 536, in run
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/openstack/block_storage/v3/_proxy.py", line 1741, in update_quota_set
        return res.commit(self, **query)
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/openstack/resource.py", line 1793, in commit
        request = self._prepare_request(
      File "/home/stack/openstack-config/ansible/openstack-config-venv/lib64/python3.9/site-packages/openstack/resource.py", line 1251, in _prepare_request
        uri = base_path % self._uri.attributes
    KeyError: 'project_id'
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error
  rc: 1

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem Quota-Modul unter ansible_collections/openstack/cloud/plugins/modules/quota.py ungefähr bei Zeile 536 und untersuche anschließend den im Traceback gezeigten openstack block_storage v3 update_quota_set-Aufruf. Reproduziere die Aufgabe Ensure quotas are set mit geänderten Quotas. Fertig ist es, wenn die Zuweisung der Quotas ohne den Fehler KeyError: 'project_id' abgeschlossen wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
ansible, python
Bereich
cloud, infrastructure
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.