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

Feat/add GetChassisInventory to Chassis category of redfish_facts #54269

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
6 participants
@xmadsen
Copy link
Contributor

xmadsen commented Mar 22, 2019

SUMMARY

This pull request adds a GetChassisInventory command to the Chassis category of redfish_facts, and returns a list of Chassis and some useful Chassis properties for each Chassis found in the chassis_uri_list.

Fixes #54233

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

redfish_facts

ADDITIONAL INFORMATION
- name: Test Redfish modules
  hosts: localhost
  gather_facts: false
  vars:
    baseuri: 10.243.5.31
    user: USERID
    password: PASSW0RD

  tasks:

    - name: Get Chassis Inventory
      redfish_facts:
        category: Chassis
        command: GetChassisInventory
        baseuri: "{{ baseuri }}"
        username: "{{ user }}"
        password: "{{ password }}"
ansible-playbook 2.8.0.dev0
  config file = None
  configured module search path = [u'/Users/xandermadsen/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/xandermadsen/ansible/lib/ansible
  executable location = /Users/xandermadsen/ansible/bin/ansible-playbook
  python version = 2.7.15 (default, Feb 12 2019, 11:00:12) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]
No config file found; using defaults
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'


PLAYBOOK: test_redfish_facts.yml **************************************************************************************************************************************************************************
1 plays in ../test_redfish_facts.yml

PLAY [Test Redfish modules] *******************************************************************************************************************************************************************************
META: ran handlers

TASK [Get all information available in Update category] ***************************************************************************************************************************************************
task path: /Users/xandermadsen/test_redfish_facts.yml:11
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: xandermadsen
<127.0.0.1> EXEC /bin/sh -c 'echo ~xandermadsen && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/xandermadsen/.ansible/tmp/ansible-tmp-1553293199.69-162779276806352 `" && echo ansible-tmp-1553293199.69-162779276806352="` echo /Users/xandermadsen/.ansible/tmp/ansible-tmp-1553293199.69-162779276806352 `" ) && sleep 0'
Using module file /Users/xandermadsen/ansible/lib/ansible/modules/remote_management/redfish/redfish_facts.py
<127.0.0.1> PUT /Users/xandermadsen/.ansible/tmp/ansible-local-425987mDPpi/tmpWe33D3 TO /Users/xandermadsen/.ansible/tmp/ansible-tmp-1553293199.69-162779276806352/AnsiballZ_redfish_facts.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/xandermadsen/.ansible/tmp/ansible-tmp-1553293199.69-162779276806352/ /Users/xandermadsen/.ansible/tmp/ansible-tmp-1553293199.69-162779276806352/AnsiballZ_redfish_facts.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/local/opt/python@2/bin/python2.7 /Users/xandermadsen/.ansible/tmp/ansible-tmp-1553293199.69-162779276806352/AnsiballZ_redfish_facts.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/xandermadsen/.ansible/tmp/ansible-tmp-1553293199.69-162779276806352/ > /dev/null 2>&1 && sleep 0'
ok: [localhost] => {
    "ansible_facts": {
        "redfish_facts": {
            "chassis": {
                "entries": [
                    {
                        "AssetTag": "12345", 
                        "ChassisType": "RackMount", 
                        "IndicatorLED": "Off", 
                        "Manufacturer": "Lenovo", 
                        "Model": "7X05RCZ000", 
                        "PartNumber": "SB27A18446", 
                        "SerialNumber": "PROD00000A"
                    }
                ], 
                "ret": true
            }
        }
    }, 
    "changed": false, 
    "invocation": {
        "module_args": {
            "baseuri": "10.243.5.31", 
            "category": [
                "Chassis"
            ], 
            "command": [
                "GetChassisInventory"
            ], 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "username": "USERID"
        }
    }
}
@xmadsen

This comment has been minimized.

Copy link
Contributor Author

xmadsen commented Mar 22, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 22, 2019

@xmadsen this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Mar 22, 2019

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:0: syntax-error invalid syntax (&lt;unknown&gt;, line 250)

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.8 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
PYTHONPATH=../../lib ../bin/dump_config.py --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ -d ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../bin/generate_man.py --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml
PYTHONPATH=../../lib ../bin/plugin_formatter.py -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Evaluating module files...
Makefile:93: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../bin/plugin_formatter.py", line 783, in <module>
    main()
  File "../bin/plugin_formatter.py", line 738, in main
    plugin_info, categories = get_plugin_info(options.module_dir, limit_to=options.limit_to, verbose=(options.verbosity > 0))
  File "../bin/plugin_formatter.py", line 294, in get_plugin_info
    doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose)
  File "/root/ansible/lib/ansible/utils/plugin_docs.py", line 105, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/root/ansible/lib/ansible/parsing/plugin_docs.py", line 40, in read_docstring
    M = ast.parse(b_module_data.read())
  File "/usr/lib/python3.6/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 250
    <<<<<<< HEAD
     ^
SyntaxError: invalid syntax
make: *** [modules] Error 1

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: <<<<<<< HEAD

The test ansible-test sanity --test compile --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: <<<<<<< HEAD

The test ansible-test sanity --test compile --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: <<<<<<< HEAD

The test ansible-test sanity --test compile --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: <<<<<<< HEAD

The test ansible-test sanity --test compile --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: <<<<<<< HEAD

The test ansible-test sanity --test compile --python 3.8 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:1: SyntaxError: <<<<<<< HEAD

The test ansible-test sanity --test import --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: invalid syntax

The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: invalid syntax

The test ansible-test sanity --test import --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: invalid syntax

The test ansible-test sanity --test import --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: invalid syntax

The test ansible-test sanity --test import --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: SyntaxError: invalid syntax

The test ansible-test sanity --test import --python 3.8 [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:1: SyntaxError: invalid syntax

The test ansible-test sanity --test pep8 [explain] failed with 11 errors:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:1: E305 expected 2 blank lines after class or function definition, found 0
lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:3: E227 missing whitespace around bitwise or shift operator
lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:7: E225 missing whitespace around operator
lib/ansible/modules/remote_management/redfish/redfish_facts.py:251:17: E113 unexpected indentation
lib/ansible/modules/remote_management/redfish/redfish_facts.py:253:3: E225 missing whitespace around operator
lib/ansible/modules/remote_management/redfish/redfish_facts.py:253:5: E225 missing whitespace around operator
lib/ansible/modules/remote_management/redfish/redfish_facts.py:253:7: E225 missing whitespace around operator
lib/ansible/modules/remote_management/redfish/redfish_facts.py:254:17: E113 unexpected indentation
lib/ansible/modules/remote_management/redfish/redfish_facts.py:256:7: E225 missing whitespace around operator
lib/ansible/modules/remote_management/redfish/redfish_facts.py:258:9: E113 unexpected indentation
lib/ansible/modules/remote_management/redfish/redfish_facts.py:291:5: E901 IndentationError: unindent does not match any outer indentation level

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:0:0: E401 Python SyntaxError while parsing module

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/remote_management/redfish/redfish_facts.py:250:2: python-syntax-error invalid syntax (<unknown>, line 250)

click here for bot help

@ansibot

This comment has been minimized.

@samerhaj

This comment has been minimized.

Copy link

samerhaj commented Mar 27, 2019

since you are looping through all Chassis instances, you might wan to at least output the chassis URI for each instance. Or maybe even go one step further and build an aggregate function similar to the existing System aggregate calls

@billdodd
Copy link
Contributor

billdodd left a comment

Agree with @samerhaj about the chassis URI. But that will also apply to the GetPsuInventory and GetFanInventory commands.

That could be done in this PR. Or it may make sense to go ahead and approve this PR as-is and then use a new issue and PR to make an aggregate function for all the chassis inventory commands. I'm fine with either approach.

@ansibot ansibot removed the needs_triage label Mar 28, 2019

@xmadsen

This comment has been minimized.

Copy link
Contributor Author

xmadsen commented Mar 30, 2019

@billdodd I think to keep things clean let's ship this PR and I'll write a new one to implement the aggregate function for the chassis commands. Design-wise I think there are a couple of routes we could take.

@billdodd

This comment has been minimized.

Copy link
Contributor

billdodd commented Apr 1, 2019

@billdodd I think to keep things clean let's ship this PR and I'll write a new one to implement the aggregate function for the chassis commands. Design-wise I think there are a couple of routes we could take.

That sounds good to me. I'll approve this one and watch for a new PR for the overall chassis aggregation improvement. Thanks.

@billdodd
Copy link
Contributor

billdodd left a comment

shipit

@jose-delarosa

This comment has been minimized.

Copy link
Contributor

jose-delarosa commented Apr 1, 2019

Looks good.

shipit

@ansibot ansibot added shipit and removed community_review labels Apr 1, 2019

@gundalow

This comment has been minimized.

Copy link
Contributor

gundalow commented Apr 5, 2019

@xmadsen Could you please rebase?
Once this has been rebased if someone could ask for merged in #ansible-devel we will get this in.

@ansibot ansibot added needs_rebase and removed shipit labels Apr 5, 2019

@xmadsen xmadsen closed this Apr 15, 2019

@xmadsen xmadsen force-pushed the xmadsen:feat/add-getchassisinventory branch from 8671bf9 to f8c4726 Apr 15, 2019

@billdodd

This comment has been minimized.

Copy link
Contributor

billdodd commented Apr 16, 2019

bot_status

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Apr 16, 2019

Components

lib/ansible/module_utils/redfish_utils.py
support: community
maintainers: billdodd jose-delarosa mraineri tomasg2012

lib/ansible/modules/remote_management/redfish/redfish_facts.py
support: community
maintainers: billdodd jose-delarosa mraineri tomasg2012

Metadata

waiting_on: xmadsen
changes_requested_by: null
needs_info: False
needs_revision: True
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: unstable
shippable_status: failure
maintainer_shipits (module maintainers): False
community_shipits (namespace maintainers): False
ansible_shipits (core team members): False
shipit_actors (maintainer or core team member): None
shipit_actors_other:
automerge: automerge shipit test failed

click here for bot help

@billdodd

This comment has been minimized.

Copy link
Contributor

billdodd commented Apr 16, 2019

Not sure what exactly is going on with the status of this PR (why the CI job was canceled and the needs_revision label added).

@xmadsen - You might try adding the ready_for_review command in a comment and see if that helps.

@xmadsen

This comment has been minimized.

Copy link
Contributor Author

xmadsen commented Apr 16, 2019

ready_for_review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.