-
Notifications
You must be signed in to change notification settings - Fork 164
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
Server error due to stale (?) when creating multiple compute_profiles with VMware #1677
Comments
What is the cache refresh API?! :) |
- name: "Get the compute resource id"
redhat.satellite.compute_resource:
username: "{{ satellite_admin_username }}"
password: "{{ satellite_admin_password }}"
server_url: "{{ satellite_url }}"
validate_certs: "{{ satellite_validate_certs }}"
name: "{{ cpr.compute_attributes[0].compute_resource }}"
state: "present"
register: result
- ansible.builtin.set_fact:
cr_id: "{{ result.entity.compute_resources[0].id }}"
# you can change the name of the compute profile by simply passing name and updated_name
- name: "Force refresh of Compute Resource API cache"
ansible.builtin.uri:
url: "{{ satellite_url }}/api/compute_resources/{{ cr_id }}-{{ cpr.compute_attributes[0].compute_resource }}/refresh_cache"
method: "PUT"
body_format: "json"
user: "{{ satellite_admin_username }}"
password: "{{ satellite_admin_password }}"
force_basic_auth: true
validate_certs: "{{ satellite_validate_certs }}"
register: refresh_result
- debug:
var: refresh_result.json.message |
Wait, you create a fresh CR and after that the cache is invalid? That sounds like a Foreman bug, not something we should (have to) workaround in FAM. Interestingly, https://github.com/theforeman/foreman/blob/develop/app/models/concerns/compute_resource_caching.rb only calls a refresh automatically Wonder what @ares thinks about this. |
That patch was create to only solve the issue of updating the CR. I'm not sure how the cache could be invalid right after the CR creation, but if it helps, I think replacing |
Yeah, I am too curious how this ended up with a "bad" cache, but here we are. @parmstro if the issue is sufficiently reproducible in your env, could you try patching it to use |
Yes. I will patch to use after_save and set caching_enabled to true for my next test run. |
Could you by any chance provide access to a reproducer system? |
The systems are built and torn down constantly. I would have to spin you up one, but that can be done. Let me see if I can work on it. I am in the middle of a test right now with caching_enabled: false .. The environment build is past the compute_resource creation and is actively using it to build systems. I am switching it back for the next run and creating the edit that you requested in comment 5. Currently building tang hosts, so environment should be finished in about 90 minutes or so. |
SUMMARY
FAILED! => {"changed": false, "error": {"message": "undefined method `resource_pools' for nil:NilClass"}, "msg": "Failed to show resource: HTTPError: 500 Server Error: Internal Server Error for url: https://sat.example.ca/api/compute_resources/1"}
ISSUE TYPE
ANSIBLE VERSION
COLLECTION VERSION
KATELLO/FOREMAN VERSION
STEPS TO REPRODUCE
EXPECTED RESULTS
No errors, all profiles created successfully.
ACTUAL RESULTS
NOTE: If I call the cache_refresh api before creating the profiles, all is good. However, I have run into the problem that trying to query the Satellite to get the info so I can call a cache refresh can also run into the error. This is a real bummer when you are an hour and a half in on a build and things bomb out. I am currently testing with the compute resource created with the cache off.
It would be nice to have a cache refresh embedded in the background as this is an automation task and not a UI thing. No one is waiting and watching.
The text was updated successfully, but these errors were encountered: