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

[Bug]: netscaler.adc.nspartition makes changes to partition when trying to switch session to custom partition #310

Closed
pkodzis opened this issue Nov 28, 2023 · 2 comments
Assignees
Labels

Comments

@pkodzis
Copy link

pkodzis commented Nov 28, 2023

Summary

When trying to use netscaler.adc.nspartition to switch my session to custom partition like this:

  • name: switch to partition {{ provider.partitionname }}
    delegate_to: localhost
    netscaler.adc.nspartition:
    nsip: "{{ provider.nsip }}"
    nitro_auth_token: "{{ provider.nitro_auth_token | default(omit) }}"
    nitro_protocol: "{{ provider.nitro_protocol | default(omit) }}"
    validate_certs: "{{ provider.validate_certs | default(omit) }}"
    partitionname: "{{ provider.partitionname }}"
    check_mode: false

    netscaler.adc.nspartition is making changes to the partition, instead of simply switching my session:

... => {
"changed": true,
"diff_list": [
"Attribute maxbandwidth differs. Desired: (<class 'float'>) 10240.0. Existing: (<class 'str'>) 4500000",
"Attribute maxconn differs. Desired: (<class 'float'>) 1024.0. Existing: (<class 'str'>) 0",
"Attribute maxmemlimit differs. Desired: (<class 'float'>) 10.0. Existing: (<class 'int'>) 0",
"Attribute minbandwidth differs. Desired: (<class 'float'>) 10240.0. Existing: (<class 'NoneType'>) None"
],

I'm not sure if this is a bug in this module, or it works as expected but the netscaler.adc.login is missing option to login to specific partition.

Issue Type

Bug Report

Component Name

netscaler.adc.nspartition or netscaler.adc.login

Python Version

$ python3 --version
Python 3.9.5

Ansible Version

$ ansible --version
ansible [core 2.15.6]
  config file = None
  configured module search path = ['/home/pkodzis/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/pkodzis/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/pkodzis/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.5 (default, Nov 18 2021, 16:00:48) [GCC 10.3.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

Ansible Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = None

netscaler.adc Collection Version

$ ansible-galaxy collection list netscaler.adc

# /home/pkodzis/.ansible/collections/ansible_collections
Collection    Version
------------- -------
netscaler.adc 2.0.3

Target NetScaler Version

> show ns version
 NetScaler NS13.1: Build 42.47.nc, Date: Feb 22 2023, 08:08:13  

Equivalent NetScaler CLI Command

sw par <partition name>

Steps to Reproduce

- name: login to NetScaler
  delegate_to: localhost
  netscaler.adc.login:
    nsip: "{{ nsip }}"
    username: "{{ username }}"
    password: "{{ password }}"
    nitro_protocol: https
    validate_certs: no
  check_mode: false
  register: result
 
- name: setup provider
  set_fact:
    provider:
      nitro_auth_token: "{{ result.sessionid }}"
      nsip: "{{ nsip }}"
      validate_certs: "{{ provider_defaults.validate_certs }}"
      partitionname: "{{ provider_defaults.partitionname }}"
      comment: "{{ provider_defaults.comment }}"
 
- debug:
    var: provider
 
- name: switch to partition {{ provider.partitionname }}
  delegate_to: localhost
  netscaler.adc.nspartition:
    nsip: "{{ provider.nsip }}"
    nitro_auth_token: "{{ provider.nitro_auth_token | default(omit) }}"
    nitro_protocol: "{{ provider.nitro_protocol | default(omit) }}"
    validate_certs: "{{ provider.validate_certs | default(omit) }}"
    partitionname: "{{ provider.partitionname }}"
  check_mode: false
  register: result
 
- debug:
    var: result

Expected Results

session related to nitro_auth_token switched to partition without making any changes

Actual Results

modified partition limits => catastrofic behavior for PROD...

... => {
    "changed": true,
    "diff_list": [
        "Attribute `maxbandwidth` differs. Desired: (<class 'float'>) 10240.0. Existing: (<class 'str'>) 4500000",
        "Attribute `maxconn` differs. Desired: (<class 'float'>) 1024.0. Existing: (<class 'str'>) 0",
        "Attribute `maxmemlimit` differs. Desired: (<class 'float'>) 10.0. Existing: (<class 'int'>) 0",
        "Attribute `minbandwidth` differs. Desired: (<class 'float'>) 10240.0. Existing: (<class 'NoneType'>) None"
    ],

Additioinal Notes

No response

@sumanth-lingappa
Copy link
Collaborator

Fixed in version 2.3.0

A new state switched is introduced.

Example can be found here HERE

For more details, you can refer PR #342

@pkodzis
Copy link
Author

pkodzis commented Jan 15, 2024

ack, works as expected - thank you so much! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants