dell / dellemc-openmanage-ansible-modules

Dell OpenManage Ansible Modules
GNU General Public License v3.0
335 stars 163 forks source link

idrac_firmware firmware is not idempotent #103

Closed silvam11 closed 3 years ago

silvam11 commented 4 years ago

I ran the idrac_firmware module (idrac_firmware) to upgrade firmware for a R640 server and the module failed with the following error:

{"changed": false, "msg": "'GetRepoBasedUpdateList_OUTPUT'"}

As the message above does not allow to identify the root cause of the issue, I started debugging the code and I figured out that the issue happens because all the components of my server are already on the firmware versions described by my catalog.xml.

To confirm the root cause, I manually downgraded the firmware versions on my server then I ran the idrac_firmware module which ran successfully. However, if I re-run the module, it fails as the versions were upgraded on the first execution. Therefore, it shows that this module is not idempotent and fails to execute when the state is already present.

Below are some details about the environment:

  1. dell openmanage and omsdk are the latest version of devel branches
  2. ansible-playbook: 2.8.4
  3. python version = 2.7.5
  4. IDRAC 9 version 4.10.10.10 (Build 32)

The task is below and it is based on http.:

 - name: NEW Update Firmware
    idrac_firmware:
      idrac_ip: "{{ default_idrac_ip }}"
      idrac_user: "{{ default_idrac_user }}"
      idrac_password: "{{ default_idrac_pass }}"
      share_name: "{{ filerepo_service_ip }}/{{ catalog_filePath }}/"
      catalog_file_name: "{{ catalog_fine_name }}"
      apply_update: True
      reboot: True
      job_wait: True
      ignore_cert_warning : True
    register: firmware_update_response
tsquillario commented 4 years ago

Ran into this as well. I'm rerunning a playbook after the firmware was updated from a DRM repo and I'm getting an error instead of a passing green. @jagadeeshnv thoughts?

OMAM 2.0.11 omsdk 1.2.439 iDRAC 4.11.11.11

FAILED! => {"changed": false, "msg": "HTTP Error 400: Bad Request", "update_status": {"error": {"@Message.ExtendedInfo": [{"Message": "Firmware versions on server match catalog, applicable updates are not present in the repository.", "MessageArgs": [], "MessageArgs@odata.count": 0, "MessageId": "IDRAC.2.1.SUP029", "RelatedProperties": [], "RelatedProperties@odata.count": 0, "Resolution": "No response action is required.", "Severity": "Warning"}], "code": "Base.1.5.GeneralError", "message": "A general error has occurred. See ExtendedInfo for more information"}}}

jagadeeshnv commented 4 years ago

Hi @tsquillario We will have a look and get back

ThierryBesancon commented 4 years ago

Hello

Same problem. With OMAM 2.0.14. I use a SUU iso image instead of a live DRM repository but it changes nothing in the final to the error.

Here is my workaround: ignore the raised error from idrac_firmware, register its output and parse it yourself to decide what to do.

- name: iDRAC update component firmwares
  idrac_firmware:
    idrac_ip:                   "{{ idrac.ipaddr }}"
    idrac_user:                 "{{ drac.factory_user }}"
    idrac_password:             "{{ idrac.factory_password }}"
    share_name:                 "{{ idrac.firmwares.share_name }}"
    share_mnt:                  "{{ idrac.firmwares.share_mnt }}"
    catalog_file_name:          "{{ idrac.firmwares.catalog }}"
    reboot:                     true
    job_wait:                   true
  register: command_update_firmware
  ignore_errors: yes

- name: iDRAC firmware update component result
  fail:
    msg: "idrac_firmware failed!"
  when: 
    - command_update_firmware['msg'] not in ["Successfully updated the firmware."]
    - command_update_firmware.update_status.error['@Message.ExtendedInfo'].0.Message not in ["Firmware versions on server match catalog, applicable updates are not present in the repository."]

More precisely i got this error:

fatal: [dell]: FAILED! => {
    "changed": false, 
    "failed_when_result": true, 
    "update_status": {
        "error": {
            "@Message.ExtendedInfo": [
                {
                    "Message": "Firmware versions on server match catalog, applicable updates are not present in the repository.", 
                    "MessageArgs": [], 
                    "MessageArgs@odata.count": 0, 
                    "MessageId": "IDRAC.2.1.SUP029", 
                    "RelatedProperties": [], 
                    "RelatedProperties@odata.count": 0, 
                    "Resolution": "No response action is required.", 
                    "Severity": "Warning"
                }
            ], 
            "code": "Base.1.5.GeneralError", 
            "message": "A general error has occurred. See ExtendedInfo for more information"
        }
    }
}

By reading the full information, it is obvious you can ignore the failure.

Please note my answer is a workaround. It is by no way a fix to the real problem (no idempotency).

By the way, dear DELL developpers, what was the use of this horrible name @Message.ExtendedInfo which makes our life so hard in writing access to the parts of this dict?

Thanks anyway for your work.

jagadeeshnv commented 3 years ago

@silvam11 Please verify this against the latest commit. It has been addressed

silvam11 commented 3 years ago

Thanks @jagadeeshnv