HewlettPackard / squest

Service request portal on top of Ansible Tower/AWX

Home Page:https://hewlettpackard.github.io/squest/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resource groups/Graph don't update when using API

ngdoc opened this issue · comments

Describe the bug
When using an API call from AWX to Squest to add a resource instance, the Resource Groups and Graph menus in the GUI do not update to reflect the new attribute counts.

To Reproduce
Steps to reproduce the behavior:

  1. Run a Squest request with the API callback to create a resource with attributes
  2. On completion go to resource groups in the side menu
  3. Go to table view
  4. notice that there are no new attributes logged
  5. Go to graph in the sidebar
  6. notice that no new attributes are logged

Expected behavior
Squest sends request to AWX for new instance of an object
AWX creates the object
AWX sends an API call back to squest to log the new resource
Squest logs the new resource and its attributes
The Resource groups menu is updated to reflect the new usage of the attributes
The graph menu is updated to reflect the new usage of the attributes

Additional context
When adding a resource manually through the GUI it appears to update all of the above successfully, it seems to be just a problem with the API call

Well, it's weird, adding a resource in a resource group is what we do everyday. And it works.
Sure you got a 200 answer from the api?
Be sure to insert all attributes required by the resource group.

Code example

    - name: Create a resource in squest
      uri:
        url: "{{ squest_api }}resource-tracker/resource/"
        headers:
          Authorization: "{{ squest_bearer_token }}"
        method: POST
        status_code: 201
        body_format: json
        body:
          name: "{{ vm_name }}"
          resource_group: "{{ resource_group_vm_id }}"
          service_catalog_instance: "{{ squest['instance']['id'] }}"
          resource_attributes:
            - name: "vCPU"
              value: "{{ vm_vcpu }}"
            - name: "Memory"
              value: "{{ vm_memory }}"

We have been able to reproduce on our side. We'll work on a fix.
Thanks for the heads up !

@Sispheor, thank you for looking onto this

one more issue that I noticed in this case is that, if I remove the instance attached to the RG, the count is 0 but the attribute value is not refreshed to 0
image

Fix available in v2.5.2.