Skip to content

Instantly share code, notes, and snippets.

@thedoubl3j
Created January 28, 2019 15:09
Show Gist options
  • Save thedoubl3j/83830e336f493d6fc99d92c79718c469 to your computer and use it in GitHub Desktop.
Save thedoubl3j/83830e336f493d6fc99d92c79718c469 to your computer and use it in GitHub Desktop.
public because I am noob
_______________________________________________________________________________ TestMyModule.test_ensure_apply_for_ucadapter_called _______________________________________________________________________________
self = <units.modules.storage.netapp.test_na_ontap_ucadapter.TestMyModule testMethod=test_ensure_apply_for_ucadapter_called>
def test_ensure_apply_for_ucadapter_called(self):
''' configuring ucadaptor and checking idempotency '''
module_args = {}
module_args.update(self.set_default_args())
module_args.update({'type': 'target'})
module_args.update({'mode': 'initiator'})
set_module_args(module_args)
my_obj = my_module()
my_obj.autosupport_log = Mock(return_value=None)
if not self.use_vsim:
my_obj.server = self.server
with pytest.raises(AnsibleExitJson) as exc:
> my_obj.apply()
test/units/modules/storage/netapp/test_na_ontap_ucadapter.py:151:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../partner/lib/python3.7/site-packages/ansible/modules/storage/netapp/na_ontap_ucadapter.py:191: in apply
results = netapp_utils.get_cserver(self.server)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
server = <units.modules.storage.netapp.test_na_ontap_ucadapter.MockONTAPConnection object at 0x7fc348b34630>
def get_cserver(server):
vserver_info = zapi.NaElement('vserver-get-iter')
query_details = zapi.NaElement.create_node_with_children('vserver-info', **{'vserver-type': 'admin'})
query = zapi.NaElement('query')
query.add_child_elem(query_details)
vserver_info.add_child_elem(query)
result = server.invoke_successfully(vserver_info,
enable_tunneling=False)
attribute_list = result.get_child_by_name('attributes-list')
> vserver_list = attribute_list.get_child_by_name('vserver-info')
E AttributeError: 'NoneType' object has no attribute 'get_child_by_name'
../partner/lib/python3.7/site-packages/ansible/module_utils/netapp.py:270: AttributeError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment