From f0b7233e8d300ab6d74b5649f6b7cfdb240f6de2 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 27 Jun 2021 10:24:38 +0200 Subject: [PATCH] Add option type validation. (#2878) (#2886) (cherry picked from commit 1b94d092099be2b882a83b750c87d7c3438b28ab) Co-authored-by: Felix Fontein --- .../fragments/2878-validate-certs-bool.yml | 2 ++ plugins/callback/nrdp.py | 33 +++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 changelogs/fragments/2878-validate-certs-bool.yml diff --git a/changelogs/fragments/2878-validate-certs-bool.yml b/changelogs/fragments/2878-validate-certs-bool.yml new file mode 100644 index 0000000000..e636f4981b --- /dev/null +++ b/changelogs/fragments/2878-validate-certs-bool.yml @@ -0,0 +1,2 @@ +minor_changes: +- "nrdp callback plugin - parameters are now converted to strings, except ``validate_certs`` which is converted to boolean (https://github.com/ansible-collections/community.general/pull/2878)." diff --git a/plugins/callback/nrdp.py b/plugins/callback/nrdp.py index f17785a92f..744c2d2ed4 100644 --- a/plugins/callback/nrdp.py +++ b/plugins/callback/nrdp.py @@ -10,22 +10,23 @@ DOCUMENTATION = ''' name: nrdp type: notification author: "Remi VERCHERE (@rverchere)" - short_description: post task result to a nagios server through nrdp + short_description: Post task results to a Nagios server through nrdp description: - - this callback send playbook result to nagios - - nagios shall use NRDP to recive passive events - - the passive check is sent to a dedicated host/service for ansible + - This callback send playbook result to Nagios. + - Nagios shall use NRDP to recive passive events. + - The passive check is sent to a dedicated host/service for Ansible. options: url: - description: url of the nrdp server - required: True + description: URL of the nrdp server. + required: true env: - name : NRDP_URL ini: - section: callback_nrdp key: url + type: string validate_certs: - description: (bool) validate the SSL certificate of the nrdp server. (For HTTPS url) + description: Validate the SSL certificate of the nrdp server. (Used for HTTPS URLs.) env: - name: NRDP_VALIDATE_CERTS ini: @@ -33,32 +34,36 @@ DOCUMENTATION = ''' key: validate_nrdp_certs - section: callback_nrdp key: validate_certs - default: False + type: boolean + default: false aliases: [ validate_nrdp_certs ] token: - description: token to be allowed to push nrdp events - required: True + description: Token to be allowed to push nrdp events. + required: true env: - name: NRDP_TOKEN ini: - section: callback_nrdp key: token + type: string hostname: - description: hostname where the passive check is linked to - required: True + description: Hostname where the passive check is linked to. + required: true env: - name : NRDP_HOSTNAME ini: - section: callback_nrdp key: hostname + type: string servicename: - description: service where the passive check is linked to - required: True + description: Service where the passive check is linked to. + required: true env: - name : NRDP_SERVICENAME ini: - section: callback_nrdp key: servicename + type: string ''' import os