Skip to content

na_ontap_host_argument_spec should set use_rest to 'auto' instead of 'always' #354

Description

@joecaruso

Summary

After upgrading from to 23.5.0, the following task now fails with the error
REST API currently does not support 'command_directory_name, access_level

The provided parameters are still valid for ZAPI, so the module should attempt to fall back to using ZAPI, before failing the task. Setting use_rest: never with no other changes, allows the module to work

It looks like the issue is that this line (and the doc fragment) should be 'auto', instead of 'always'
ffa8723#diff-087b41c80aee4f78bbce8576b8519932dd54935adb6118cca57a1e5c11cf53edR163

def na_ontap_host_argument_spec():
    # This is used for Zapi + REST Modules.

    return dict(
        hostname=dict(required=True, type='str'),
        username=dict(required=False, type='str', aliases=['user']),
        password=dict(required=False, type='str', aliases=['pass'], no_log=True),
        https=dict(required=False, type='bool', default=False),
        validate_certs=dict(required=False, type='bool', default=True),
        http_port=dict(required=False, type='int'),
        ontapi=dict(required=False, type='int'),
        use_rest=dict(required=False, type='str', default='always'),

Component Name

na_ontap_user_role

Ansible Version

2.13.13

ONTAP Collection Version

netapp.ontap 23.5.0

ONTAP Version

9.16.1

Playbook

See below

Steps to Reproduce

- name: Create roles
  netapp.ontap.na_ontap_user_role:
    <<: *login
    state: present
    name: "{{ item.0.name }}"
    command_directory_name: "{{ item.1.cmd_dir }}"
    access_level: "{{ item.1.access }}"
    vserver: "{{ item.0.vserver }}"
  loop: "{{ user_roles | subelements('dirs') }}"
  loop_control:
    label: "Vserver: {{ item.0.vserver }} Role: {{ item.0.name }} Command/Directory: {{ item.1.cmd_dir }}"

Expected Results

Module should automatically fall back to ZAPI to maintain the current behavior.

Actual Results

Module fails with no change to task, after collection upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions