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

Netscaler_nitro_request should do url-/percent-encoding in the code instead of expecting already-encoded params #53

Open
JonasVerhofste opened this issue Jun 7, 2020 · 3 comments
Labels
affects_1 feature This issue/PR relates to a feature request module module needs_triage plugins plugin (any type)

Comments

@JonasVerhofste
Copy link
Contributor

SUMMARY

As discussed in #52 , the module currently expects parameters to be url-/percent-encoded in the play (either hardcoded or through jinja-templating), whilst it would make more sense to do this in the module itself (making them easier to read and write).

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

netscaler_nitro_request

ADDITIONAL INFORMATION

Because of the weirdness that is the netscaler API, some parameters need to be url-encoded, whilst others don't. Currently, this is left up to the user: the code only builds the correct query, but doesn't do any parsing of the parameter-strings themselves. This makes for pretty confusing plays, where you have parameters that need {{ myvar | urlencode | replace('/', '%2F') }} and others don't.

It would make more sense to decide and do this in the code, making writing tasks a lot easier (as you don't need to go verify if this particular param needs encoding or not).

However, since changing this would be a backwards incompatible change, we'll have to feature flag this option, as kindly and correctly suggested by @felixfontein.

Example of how current tasks look:

- name: Do some filter
  netscaler_nitro_request:
    nsip: mynetscaler.mydomain.mytld
    nitro_user: myuser
    nitro_pass: mypass
    nitro_protocol: https
    operation: get_filtered
    resource: sslcertkey
    filter:
      certificatetype: "{{ '/ROOT_CERT|INTM_CERT/' | urlencode | replace('/', '%2F') }}"
      subject: "{{ '/COMODO/' | replace('/', '%2F') }}"

Example of how this would look with the feature flag:

- name: Do some filter
  netscaler_nitro_request:
    nsip: mynetscaler.mydomain.mytld
    nitro_user: myuser
    nitro_pass: mypass
    nitro_protocol: https
    operation: get_filtered
    resource: sslcertkey
    percent-encode: yes
    filter:
      certificatetype: /ROOT_CERT|INTM_CERT/
      subject: /COMODO/
@JonasVerhofste JonasVerhofste changed the title Netscaler_nitro_request should de url-/percent-encoding in the module instead of expecting already-encoded params Netscaler_nitro_request should do url-/percent-encoding in the module instead of expecting already-encoded params Jun 7, 2020
@JonasVerhofste JonasVerhofste changed the title Netscaler_nitro_request should do url-/percent-encoding in the module instead of expecting already-encoded params Netscaler_nitro_request should do url-/percent-encoding in the code instead of expecting already-encoded params Jun 7, 2020
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot
Copy link
Collaborator

@JonasVerhofste, just so you are aware we have a dedicated Working Group for network.
You can find other people interested in this in #ansible-network on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibullbot ansibullbot added affects_1 feature This issue/PR relates to a feature request module module needs_triage plugins plugin (any type) labels Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_1 feature This issue/PR relates to a feature request module module needs_triage plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

2 participants