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_utils: fix language check #8613

Merged

Conversation

mkoreneff
Copy link
Contributor

SUMMARY

Fixes bug when Language is not exactly en

community.general.redfish_info:
  category: Systems
  command: GetBiosRegistries

incorrectly returns

        if not rsp_uri:
            msg = "Language 'en' not found in BIOS Attribute Registries location, URI: %s, response: %s"

example:

            "bios_registries": {
                "msg": "Language 'en' not found in BIOS Attribute Registries location, <snip>
                "ret": false
            }
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

plugins/module_utils/redfish_utils.py

ADDITIONAL INFORMATION

Reproduce the issue:

bios_registry.yaml:

  tasks:    
  - delegate_to: localhost    
    block:    
      - name: Get Bios Registries    
        community.general.redfish_info:    
          <<: *redfish    
          category: Systems    
          command: GetBiosRegistries    
        register: bios_data    
    
      - ansible.builtin.debug: var=bios_data    

ansible-playbook --inventory "host," bios_registry.yaml

TASK [Get Bios Registries] ********************************************************************************************
[DEPRECATION WARNING]: The default value 10 for parameter param1 is being deprecated and it will be replaced by 60. 
This feature will be removed from community.general in version 9.0.0. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
ok: [host -> localhost]

TASK [ansible.builtin.debug] ******************************************************************************************
ok: [host -> localhost] => {
    "bios_data": {
        "changed": false,
        "deprecations": [
            {
                "collection_name": "community.general",
                "msg": "The default value 10 for parameter param1 is being deprecated and it will be replaced by 60",
                "version": "9.0.0"
            }
        ],
        "failed": false,
        "redfish_facts": {
            "bios_registries": {
                "msg": "Language 'en' not found in BIOS Attribute Registries location, URI: https://host-ipmi/redfish/v1/Registries/BiosAttributeRegistryA3167.1.17.1, response: {'@odata.context': '/redfish/v1/$metadata#MessageRegistryFile.MessageRegistryFile', '@odata.etag': '\"1720539421\"', '@odata.id': '/redfish/v1/Registries/BiosAttributeRegistryA3167.1.17.1', '@odata.type': '#MessageRegistryFile.v1_1_3.MessageRegistryFile', 'Description': 'Registry for BiosAttributeRegistryA3167.1.17.1', 'Id': 'BiosAttributeRegistryA3167.1.17.1', 'Languages': ['en-US'], 'Location': [{'Language': 'en-US', 'Uri': '/redfish/v1/Registries/BiosAttributeRegistryA3167.en-US.1.17.1.json'}], 'Name': 'BiosAttributeRegistryA3167.1.17.1 Registry', 'Registry': 'BiosAttributeRegistryA3167.1.17.1'}",
                "ret": false
            }
        }
    }
}

with the fix in place
ansible-playbook --inventory "host," bios_registry.yaml

TASK [Get Bios Registries] **********************************************************************************************
[DEPRECATION WARNING]: The default value 10 for parameter param1 is being deprecated and it will be replaced by 60. This
 feature will be removed from community.general in version 9.0.0. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
ok: [host -> localhost]

TASK [ansible.builtin.debug] ********************************************************************************************
ok: [host -> localhost] => {
    "bios_data": {
        "changed": false,
        "deprecations": [
            {
                "collection_name": "community.general",
                "msg": "The default value 10 for parameter param1 is being deprecated and it will be replaced by 60",
                "version": "9.0.0"
            }
        ],
        "failed": false,
        "redfish_facts": {
            "bios_registries": {
                "bios_registry": {
                    "@odata.context": "/redfish/v1/$metadata#AttributeRegistry.AttributeRegistry",
                    "@odata.etag": "Dummyetag",
                    "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistryA3167.en-US.1.17.1.json",
                    "@odata.type": "#AttributeRegistry.v1_3_1.AttributeRegistry",
                    "Description": "This registry defines a representation of BIOS Attribute instances",
                    "Id": "BiosAttributeRegistryA3167.en-US.1.17.1",
                    "Language": "en-US",
                    "Name": "A3167 BIOS Attribute Registry",
                    "OwningEntity": "AMI",
                    "RegistryEntries": {
                        "Attributes": [

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type) labels Jul 11, 2024
Mike Koreneff added 2 commits July 11, 2024 08:24
@mraineri
Copy link
Contributor

Looks good to me, thanks for the contribution!

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-8 Automatically create a backport for the stable-8 branch backport-9 Automatically create a backport for the stable-9 branch labels Jul 12, 2024
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

changelogs/fragments/8613-redfish_utils-language.yaml Outdated Show resolved Hide resolved
@mkoreneff
Copy link
Contributor Author

Thanks for the quick review!

@felixfontein felixfontein merged commit ca8ecb1 into ansible-collections:main Jul 12, 2024
147 checks passed
Copy link

patchback bot commented Jul 12, 2024

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/ca8ecb1df1544ba702a422b32f927778a80bd6b9/pr-8613

Backported as #8616

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jul 12, 2024
patchback bot pushed a commit that referenced this pull request Jul 12, 2024
* redfish_utils: fix language check

* add fragment file

* typo

* improve words

* improve words based on suggestion

---------

Co-authored-by: Mike Koreneff <[email protected]>
(cherry picked from commit ca8ecb1)
Copy link

patchback bot commented Jul 12, 2024

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/ca8ecb1df1544ba702a422b32f927778a80bd6b9/pr-8613

Backported as #8617

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein
Copy link
Collaborator

@mkoreneff thanks for your contribution!
@mraineri thanks for reviewing!

patchback bot pushed a commit that referenced this pull request Jul 12, 2024
* redfish_utils: fix language check

* add fragment file

* typo

* improve words

* improve words based on suggestion

---------

Co-authored-by: Mike Koreneff <[email protected]>
(cherry picked from commit ca8ecb1)
felixfontein pushed a commit that referenced this pull request Jul 12, 2024
…eck (#8616)

redfish_utils: fix language check (#8613)

* redfish_utils: fix language check

* add fragment file

* typo

* improve words

* improve words based on suggestion

---------

Co-authored-by: Mike Koreneff <[email protected]>
(cherry picked from commit ca8ecb1)

Co-authored-by: Mike Koreneff <[email protected]>
felixfontein pushed a commit that referenced this pull request Jul 12, 2024
…eck (#8617)

redfish_utils: fix language check (#8613)

* redfish_utils: fix language check

* add fragment file

* typo

* improve words

* improve words based on suggestion

---------

Co-authored-by: Mike Koreneff <[email protected]>
(cherry picked from commit ca8ecb1)

Co-authored-by: Mike Koreneff <[email protected]>
aioue pushed a commit to aioue/community.general that referenced this pull request Oct 1, 2024
* redfish_utils: fix language check

* add fragment file

* typo

* improve words

* improve words based on suggestion

---------

Co-authored-by: Mike Koreneff <[email protected]>
TobiasZeuch181 pushed a commit to TobiasZeuch181/zypper_repository_add_list that referenced this pull request Oct 2, 2024
* redfish_utils: fix language check

* add fragment file

* typo

* improve words

* improve words based on suggestion

---------

Co-authored-by: Mike Koreneff <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 Automatically create a backport for the stable-8 branch backport-9 Automatically create a backport for the stable-9 branch bug This issue/PR relates to a bug module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants