Skip to content

Discover of all devices fail in aix_devices.py module #51754

@ramooncamacho

Description

@ramooncamacho
SUMMARY

Trying to discover all devices, it was returned changed as true, but the new device didn't show up.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

aix_devices.py

ANSIBLE VERSION
ansible 2.8.0.dev0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/tvt.ramoon.camacho/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/tvt.ramoon.camacho/ansible/lib/ansible
  executable location = /home/tvt.ramoon.camacho/ansible/bin/ansible
  python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
CONFIGURATION
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = testuser
DEPRECATION_WARNINGS(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Tests performed in AIX 7.1 environment

STEPS TO REPRODUCE

I think it should be expected this command be always status changed, but I noticed an hidden error, because in AIX if an object class doesn't exist, the return code is still 0:

Trying to discover all devices:

[testuser@controller ansible]$ ansible -s -m aix_devices -a 'device=all state=available' testeram
testeram | CHANGED => {
    "changed": true,
    "msg": ""
}
[testuser@controller ansible]$ 

I realized the new devices didn't show up:

testuser@testeram(/home/testuser)# lsdev -C | grep fcs
testuser@testeram(/home/testuser)#

The module is trying to execute "cfgmgr -l all", and doing it manually, the command is trying to find a device named "all". To discover all devices I have always used cfgmgr with no option, as below:

testuser@testeram(/home/testuser)# lsdev -C | grep fcs
testuser@testeram(/home/testuser)# sudo cfgmgr -l all
cfgmgr: 0514-604 Cannot access the CuDv object class in the
        device configuration database.
testuser@testeram(/home/testuser)# lsdev -C | grep fcs
testuser@testeram(/home/testuser)# sudo cfgmgr
testuser@testeram(/home/testuser)# lsdev -C | grep fcs
fcs0       Available 29-T1       Virtual Fibre Channel Client Adapter
testuser@testeram(/home/testuser)#

Return code in the condition the object class is not found:

testuser@testeram(/home/testuser)# sudo cfgmgr -l all
cfgmgr: 0514-604 Cannot access the CuDv object class in the
        device configuration database.
testuser@testeram(/home/testuser)# echo $?
0
testuser@testeram(/home/testuser)#
EXPECTED RESULTS

The expected result is the device recognized:

testuser@testeram(/home/testuser)# lsdev -C | grep fcs
fcs0       Available 29-T1       Virtual Fibre Channel Client Adapter
testuser@testeram(/home/testuser)#
ACTUAL RESULTS

The actual result is the device not recognized:

testuser@testeram(/home/testuser)# lsdev -C | grep fcs
testuser@testeram(/home/testuser)#

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects_2.8This issue/PR affects Ansible v2.8aixAIX communitybot_closedbugThis issue/PR relates to a bug.collectionRelated to Ansible Collections workcollection:community.generalhas_prThis issue has an associated PR.moduleThis issue/PR relates to a module.needs_collection_redirecthttps://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.mdsupport:communityThis issue/PR relates to code supported by the Ansible community.systemSystem category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions