ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.5k stars 3.34k forks source link

Fix terraform backend credential issue #15141

Closed abikouo closed 3 days ago

abikouo commented 3 weeks ago
SUMMARY

When trying to sync inventory using terraform backend credentials, the job failed when the credential is not a google credential type.

  File "/awx_devel/awx/main/models/inventory.py", line 1507, in build_private_data
    return self.build_plugin_private_data(inventory_update, private_data_dir)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/models/inventory.py", line 1663, in build_plugin_private_data
    gce_cred = credential.get_input('gce_credentials')
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/models/credential/__init__.py", line 290, in get_input
    raise AttributeError(field_name)
AttributeError: gce_credentials

This issue has been introduced by the merge of #15055 This fix consists in checking whether the user as provided some google credentials.

ISSUE TYPE
COMPONENT NAME
AWX VERSION
24.3.1.dev7+g2fbbd10b1d
ADDITIONAL INFORMATION