apevec / rpms / ansible

Forked from rpms/ansible 5 years ago
Clone

Blame SOURCES/ansible-pr-30875.patch

0706bb
diff --git a/lib/ansible/modules/web_infrastructure/jenkins_plugin.py b/lib/ansible/modules/web_infrastructure/jenkins_plugin.py
0706bb
index 9aba61a..6d2bad6 100644
0706bb
--- a/lib/ansible/modules/web_infrastructure/jenkins_plugin.py
0706bb
+++ b/lib/ansible/modules/web_infrastructure/jenkins_plugin.py
0706bb
@@ -52,6 +52,8 @@ options:
0706bb
     description:
0706bb
       - Option used to allow the user to overwrite any of the other options. To
0706bb
         remove an option, set the value of the option to C(null).
0706bb
+      - Changed in 2.5.0, 2.4.1, 2.3.3 to raise an error if C(url_password) is specified in params.
0706bb
+        Use the actual C(url_password) argument instead.
0706bb
   state:
0706bb
     required: false
0706bb
     choices: [absent, present, pinned, unpinned, enabled, disabled, latest]
0706bb
@@ -166,20 +168,18 @@ EXAMPLES = '''
0706bb
     state: absent
0706bb
 
0706bb
 #
0706bb
-# Example of how to use the params
0706bb
-#
0706bb
-# Define a variable and specify all default parameters you want to use across
0706bb
-# all jenkins_plugin calls:
0706bb
+# Example of how to authenticate
0706bb
 #
0706bb
 # my_jenkins_params:
0706bb
 #   url_username: admin
0706bb
-#   url_password: p4ssw0rd
0706bb
-#   url: http://localhost:8888
0706bb
 #
0706bb
 - name: Install plugin
0706bb
   jenkins_plugin:
0706bb
     name: build-pipeline-plugin
0706bb
     params: "{{ my_jenkins_params }}"
0706bb
+    url_password: p4ssw0rd
0706bb
+    url: http://localhost:8888
0706bb
+# Note that url_password **can not** be placed in params as params could end up in a log file
0706bb
 
0706bb
 #
0706bb
 # Example of a Play which handles Jenkins restarts during the state changes
0706bb
@@ -764,6 +764,11 @@ def main():
0706bb
 
0706bb
     # Update module parameters by user's parameters if defined
0706bb
     if 'params' in module.params and isinstance(module.params['params'], dict):
0706bb
+        if 'url_password' in module.params['params']:
0706bb
+            # The params argument should be removed eventually.  Until then, raise an error if
0706bb
+            # url_password is specified there as it can lead to the password being logged
0706bb
+            module.fail_json(msg='Do not specify url_password in params as it may get logged')
0706bb
+
0706bb
         module.params.update(module.params['params'])
0706bb
         # Remove the params
0706bb
         module.params.pop('params', None)