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

Rework required using standard functionality #1212

Conversation

ashemedai
Copy link
Contributor

SUMMARY

Ansible provides various mechanisms to describe what parameters are required. This commit converts them, reducing custom logic.

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

community.zabbix.zabbix_script

ADDITIONAL INFORMATION

Ansible provides ways to specify dependencies between module options. This change converts this module to using them. This also reduces required parameters that the HTTP API does not mandate, e.g. deletion of a script.

Before it was necessary to specify something like this:

- name: Delete test script
  community.zabbix.zabbix_script:
    name: Test script
    script_type: webhook
    command: ""
    state: absent

Now it suffices to use:

- name: Delete test script
  community.zabbix.zabbix_script:
    name: Test script
    state: absent

Some output to show the requirements are still in place with this:

TASK [zabbix : Create a new SSH script] **************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "script_type is ssh but all of the following are missing: authtype, username"}

TASK [zabbix : Create a new SSH password script] *****************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "authtype is password but all of the following are missing: password"}

TASK [zabbix : Create a new SSH key script] **********************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "authtype is public_key but all of the following are missing: publickey, privatekey"}

TASK [zabbix : Create a new telnet script] ***********************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "script_type is telnet but all of the following are missing: password"}

@ashemedai ashemedai force-pushed the reduce_script_mandatory_parameters branch from dc88c2c to 02d7e8a Compare April 22, 2024 06:45
@ashemedai ashemedai force-pushed the reduce_script_mandatory_parameters branch 3 times, most recently from 98a45dd to f9d8d0c Compare May 14, 2024 11:47
@pyrodie18 pyrodie18 merged commit 3df5dc2 into ansible-collections:main May 16, 2024
26 checks passed
@ashemedai ashemedai deleted the reduce_script_mandatory_parameters branch May 16, 2024 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants