Skip to content
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

redfish_facts: GetLogs can raise KeyError #59797

Closed
billdodd opened this issue Jul 30, 2019 · 3 comments · Fixed by #59877
Closed

redfish_facts: GetLogs can raise KeyError #59797

billdodd opened this issue Jul 30, 2019 · 3 comments · Fixed by #59877
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. remote_management Working Group: https://docs.ansible.com/ansible/latest/community/communication.html support:community This issue/PR relates to code supported by the Ansible community.

Comments

@billdodd
Copy link
Contributor

SUMMARY

The GetLogs command can raise a KeyError if any of the properties it tries to read are not present. The properties being gathered are not required, so it should not be an error condition for them to be absent.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

redfish_facts.py
redfish_utils.py

ANSIBLE VERSION
ansible 2.9.0.dev0
  config file = $HOME/.ansible.cfg
  configured module search path = ['$HOME/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = $HOME/Development/git/ansible/lib/ansible
  executable location = $HOME/Development/git/ansible/bin/ansible
  python version = 3.6.5 (default, Apr 25 2018, 14:26:36) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
CONFIGURATION
[no output]
OS / ENVIRONMENT

Applies to Redfish OOB controllers.

STEPS TO REPRODUCE

Run the GetLogs commands against a Redfish service that does not include one or more of these properties in the LogServices resources:

  • Description
  • Name
  • Created
  • Message
  • Severity
---
- hosts: myhosts
  connection: local
  name: Get Manager Logs
  gather_facts: False

  vars:
    datatype: Logs

  tasks:

  - name: Define output file
    include_tasks: create_output_file.yml

  - name: Get Manager Logs
    redfish_facts:
      category: Manager
      command: GetLogs
      baseuri: "{{ baseuri }}"
      username: "{{ username }}"
      password: "{{ password }}"
    register: result

  - name: Copy results to output file
    copy:
      content: "{{ result | to_nice_json }}"
      dest: "{{ template }}.json"
EXPECTED RESULTS

Playbook runs without error

ACTUAL RESULTS
redfish_utils.py, line 316, in get_logs KeyError: 'Created'
@ansibot
Copy link
Contributor

ansibot commented Jul 30, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jul 30, 2019

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. remote_management Working Group: https://docs.ansible.com/ansible/latest/community/communication.html support:community This issue/PR relates to code supported by the Ansible community. labels Jul 30, 2019
@Akasurde Akasurde changed the title GetLogs can raise KeyError redfish_facts: GetLogs can raise KeyError Jul 31, 2019
@ansibot ansibot added the has_pr This issue has an associated PR. label Aug 22, 2019
@ansibot
Copy link
Contributor

ansibot commented Aug 30, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Sep 6, 2019
@ansible ansible locked and limited conversation to collaborators Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. remote_management Working Group: https://docs.ansible.com/ansible/latest/community/communication.html support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants