dellemc-openmanage-ansible-modules
dellemc-openmanage-ansible-modules copied to clipboard
Try the legacy jobs URI if the primary jobs URI fails
Description
iDRAC7 and iDRAC8 respond to iDRAC_JOB_URI, but not JOB_URI. This results in a failed condition when exporting SCP with job_wait=true. Falling back from JOB_URI to iDRAC_JOB_URI allows successful job_wait for iDRAC7-9. This PR will try the legacy jobs URI if the primary jobs URI fails.
GitHub Issues
List the GitHub issues impacted by this PR:
| GitHub Issue # |
|---|
| Fixes #617 |
ISSUE TYPE
- Bugfix Pull Request
COMPONENT NAME
idrac_server_config_profile
OUTPUT
After applying the fix in this PR:
$ ansible-playbook idrac_system_info.yml -i inventory.ini --limit <REDACTED-IDRAC8-13G>,<REDACTED-IDRAC7-12G>,<REDACTED-IDRAC9-16G>
PLAY [Get Info] **********************************************************************************************************************
TASK [Export SCP File (job_wait=false)] **********************************************************************************************
ok: [<REDACTED-IDRAC9-16G>]
ok: [<REDACTED-IDRAC8-13G>]
ok: [<REDACTED-IDRAC7-12G>]
TASK [Export SCP File (job_wait=true)] ***********************************************************************************************
ok: [<REDACTED-IDRAC9-16G>]
ok: [<REDACTED-IDRAC8-13G>]
ok: [<REDACTED-IDRAC7-12G>]
PLAY RECAP ***************************************************************************************************************************
<REDACTED-IDRAC8-13G> : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
<REDACTED-IDRAC9-16G> : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
<REDACTED-IDRAC7-12G> : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ADDITIONAL INFORMATION
Output prior to the changes included in this PR:
$ ansible-playbook idrac_system_info.yml -i inventory.ini --limit <REDACTED-IDRAC8-13G>,<REDACTED-IDRAC7-12G>,<REDACTED-IDRAC9-16G>
PLAY [Get Info] **********************************************************************************************************************
TASK [Export SCP File (job_wait=false)] **********************************************************************************************
ok: [<REDACTED-IDRAC9-16G>]
ok: [<REDACTED-IDRAC7-12G>]
ok: [<REDACTED-IDRAC8-13G>]
TASK [Export SCP File (job_wait=true)] ***********************************************************************************************
ok: [<REDACTED-IDRAC9-16G>]
fatal: [<REDACTED-IDRAC7-12G>]: FAILED! => {"changed": false, "error_info": {"error": {"@Message.ExtendedInfo": [{"Message": "Unable to complete the operation because the resource Oem entered in not found.", "MessageArgs": ["Oem"], "[email protected]": 1, "MessageId": "IDRAC.1.6.SYS403", "RelatedProperties": [], "[email protected]": 0, "Resolution": "Enter the correct resource and retry the operation. For information about valid resource, see the Redfish Users Guide available on the support site.", "Severity": "Critical"}, {"Message": "The resource at the URI Oem was not found.", "MessageArgs": ["Oem"], "[email protected]": 1, "MessageId": "Base.1.2.ResourceMissingAtURI", "RelatedProperties": [""], "[email protected]": 1, "Resolution": "Place a valid resource at the URI or correct the URI and resubmit the request.", "Severity": "Critical"}], "code": "Base.1.2.GeneralError", "message": "A general error has occurred. See ExtendedInfo for more information"}}, "msg": "HTTP Error 404: Not Found"}
fatal: [<REDACTED-IDRAC8-13G>]: FAILED! => {"changed": false, "error_info": {"error": {"@Message.ExtendedInfo": [{"Message": "Unable to complete the operation because the resource Oem entered is not found.", "MessageArgs": ["Oem"], "[email protected]": 1, "MessageId": "IDRAC.1.6.SYS403", "RelatedProperties": [], "[email protected]": 0, "Resolution": "Enter the correct resource and retry the operation. For information about valid resource, see the Redfish Users Guide available on the support site.", "Severity": "Critical"}, {"Message": "The resource at the URI Oem was not found.", "MessageArgs": ["Oem"], "[email protected]": 1, "MessageId": "Base.1.2.ResourceMissingAtURI", "RelatedProperties": [""], "[email protected]": 1, "Resolution": "Place a valid resource at the URI or correct the URI and resubmit the request.", "Severity": "Critical"}], "code": "Base.1.2.GeneralError", "message": "A general error has occurred. See ExtendedInfo for more information"}}, "msg": "HTTP Error 404: Not Found"}
PLAY RECAP ***************************************************************************************************************************
<REDACTED-IDRAC8-13G> : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
<REDACTED-IDRAC9-16G> : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
<REDACTED-IDRAC7-12G> : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Playbook used:
---
- name: "Get Info"
hosts: idrac_supported
gather_facts: false
tasks:
- name: "Export SCP File (job_wait=false)"
dellemc.openmanage.idrac_server_config_profile:
idrac_ip: "{{ ipv4_address }}"
idrac_user: "{{ username }}"
idrac_password: "{{ password }}"
share_name: "{{ playbook_dir }}/files/tmp"
command: "export"
export_format: "JSON"
export_use: "Default"
job_wait: false
scp_components: "ALL"
scp_file: "{{ inventory_hostname }}_testing.json"
validate_certs: false
- name: "Export SCP File (job_wait=true)"
dellemc.openmanage.idrac_server_config_profile:
idrac_ip: "{{ ipv4_address }}"
idrac_user: "{{ username }}"
idrac_password: "{{ password }}"
share_name: "{{ playbook_dir }}/files/tmp"
command: "export"
export_format: "JSON"
export_use: "Default"
job_wait: true
scp_components: "ALL"
scp_file: "{{ inventory_hostname }}_testing.json"
validate_certs: false
Checklist:
- [x] I have performed a self-review of my own code to ensure there are no formatting, vetting, linting, or security issues
- [x] I have verified that new and existing unit tests pass locally with my changes
- [x] I have not allowed coverage numbers to degenerate
- [x] I have maintained at least 90% code coverage
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation - N/A
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] I have maintained backward compatibility
Can one of the admins verify this patch?
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 93.26%. Comparing base (
14bef55) to head (13dd0aa).
Additional details and impacted files
@@ Coverage Diff @@
## collections #618 +/- ##
============================================
Coverage 93.26% 93.26%
============================================
Files 195 195
Lines 32303 32300 -3
Branches 4973 4972 -1
============================================
- Hits 30126 30125 -1
+ Misses 1332 1331 -1
+ Partials 845 844 -1
| Flag | Coverage Δ | |
|---|---|---|
| units | 93.26% <100.00%> (+<0.01%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@dlehrman Can you please update the UT for the above code. All 5 lines added is not covered by the UT. https://github.com/dell/dellemc-openmanage-ansible-modules/pull/618#issuecomment-1951038424
@dlehrman Can you please update the UT for the above code. All 5 lines added is not covered by the UT. #618 (comment)
@sachin-apa I was having difficulty figuring out how to trip the exception in the unit test, but discovered a better approach to fix #617 that I believe will be covered by existing unit tests and have updated the PR to include that change.
@dlehrman Looks like the changes is done only for export operation, I think its good to make the changes for import and preview as well to keep it consistent.
@dlehrman Looks like the changes is done only for export operation, I think its good to make the changes for import and preview as well to keep it consistent.
@sachin-apa #617 and the changes in this PR are only applicable to the export operation. Import and preview operations already use the wait_for_job_tracking_redfish function.