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

Update na_elementsw_access_group.py #57513

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
3 participants
@arcticgenes
Copy link

commented Jun 6, 2019

SUMMARY

account_id was not being passed correctly with username. String can now be passed and will return correctly.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

na_elementsw_access_group

ADDITIONAL INFORMATION
  na_elementsw_access_group:
    hostname: "{{ elementsw_hostname }}"
    username: "{{ elementsw_username }}"
    password: "{{ elementsw_password }}"
    account_id: "{{ nacluster_accountname }}"
    state: present
    name: "{{ navolume_accessgroup_name }}"
    volumes:
      - "{{ volume_name }}"
    "changed": false,
    "rc": 1
}

MSG:

MODULE FAILURE
See stdout/stderr for the exact error


MODULE_STDERR:

2019-06-06 23:31:26,392 - solidfire.Element - INFO - {"method": "GetAPI", "id": 0, "params": {}}
2019-06-06 23:31:26,577 - solidfire.Element - INFO - Connected to 10.39.48.5 using API version 10.4
2019-06-06 23:31:26,578 - solidfire.Element - INFO -

                                               77
                                              7777
                                               77
                                               ==
                             77IIIIIIIIIIIIIIIIII777
                           =7                       7=
                           7                         7
                          =7                         7=
                          =7                         7=
                         =77   7777777777777777777   77=
                        7777  777777777777777777777  7777
                        7777   7777777777777777777   7777
                         =77                         77=
                          =7                         7=
                           7                         7
                           7=                       =7
                            77=                   =77
                              =7777777777777777777=

                               ====IIIIIIIIII=====
                         =77777=                 =77777=
                     =777=                             =777=
                 =777=                                     =777=

                           NetApp SolidFire Version 10.4


2019-06-06 23:31:26,578 - solidfire.Element - INFO - {"method": "GetAccountByName", "id": 1, "params": {"username": "admin"}}
2019-06-06 23:31:26,731 - solidfire.Element - INFO - {"method": "ListVolumesForAccount", "id": 2, "params": {"accountID": "admin"}}
Traceback (most recent call last):
  File "/home/ubuntu/.ansible/tmp/ansible-tmp-1559863885.8599882-255882656119489/AnsiballZ_na_elementsw_access_group.py", line 114, in <module>
    _ansiballz_main()
  File "/home/ubuntu/.ansible/tmp/ansible-tmp-1559863885.8599882-255882656119489/AnsiballZ_na_elementsw_access_group.py", line 106, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ubuntu/.ansible/tmp/ansible-tmp-1559863885.8599882-255882656119489/AnsiballZ_na_elementsw_access_group.py", line 49, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File "/usr/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 170, in load_source
    module = _exec(spec, sys.modules[name])
  File "<frozen importlib._bootstrap>", line 626, in _exec
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/tmp/ansible_na_elementsw_access_group_payload_ma4h_aif/__main__.py", line 368, in <module>
  File "/tmp/ansible_na_elementsw_access_group_payload_ma4h_aif/__main__.py", line 364, in main
  File "/tmp/ansible_na_elementsw_access_group_payload_ma4h_aif/__main__.py", line 306, in apply
  File "/tmp/ansible_na_elementsw_access_group_payload_ma4h_aif/__main__.py", line 229, in get_volume_id
  File "/tmp/ansible_na_elementsw_access_group_payload_ma4h_aif/ansible_na_elementsw_access_group_payload.zip/ansible/module_utils/netapp_elementsw_module.py", line 96, in volume_exists
  File "/tmp/ansible_na_elementsw_access_group_payload_ma4h_aif/ansible_na_elementsw_access_group_payload.zip/ansible/module_utils/netapp_elementsw_module.py", line 52, in get_volume_id
  File "/usr/local/lib/python3.5/dist-packages/solidfire/__init__.py", line 5529, in list_volumes_for_account
    since=1.0
  File "/usr/local/lib/python3.5/dist-packages/solidfire/common/__init__.py", line 704, in send_request
    response["error"]["message"])
solidfire.common.ApiServerError: ApiServerError(method_name="ListVolumesForAccount", err_json=500 xInvalidParameterType accountID: Invalid type: expected uint64_t but found "admin"
)```
Update na_elementsw_access_group.py
account_id was not being passed correctly with username.  String can now be passed and will return correctly.
@ansibot

This comment has been minimized.

@@ -216,8 +216,8 @@ def get_account_id(self):
# Validate account id
# Return account_id if found, None otherwise
try:
account_id = self.elementsw_helper.account_exists(self.account_id)
return account_id
self.account_id = self.elementsw_helper.account_exists(self.account_id)

This comment has been minimized.

Copy link
@lonico

lonico Jun 11, 2019

Contributor

The issue is really in line 233

volume_id = self.elementsw_helper.volume_exists(volume, self.account_id)

it should be

volume_id = self.elementsw_helper.volume_exists(volume, self.account_id_valid)

as we are trying to preserver self.account_id for an error message. We want to preserve the original value.

(I agree it's a bit confusing as written, and could be better to use a new name for the original value)

@ansibot ansibot removed the needs_triage label Jun 11, 2019

@ansibot ansibot added the stale_ci label Jun 19, 2019

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.