From 7e25a614647c7ced41b38f869dfd49e06a29d22c Mon Sep 17 00:00:00 2001 From: n3pjk Date: Thu, 18 Jul 2019 01:23:23 -0400 Subject: [PATCH] snow: Call Refactored login from snow modules (#59201) * Remove python shebang from snow_record* * Add python shebang to all snow modules * Remove NO_LOG from username * Call Refactored login from snow modules --- lib/ansible/module_utils/service_now.py | 3 ++- lib/ansible/modules/notification/snow_record.py | 3 +++ lib/ansible/modules/notification/snow_record_find.py | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/service_now.py b/lib/ansible/module_utils/service_now.py index ab395ebcddd..18b25fab54e 100644 --- a/lib/ansible/module_utils/service_now.py +++ b/lib/ansible/module_utils/service_now.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- + # Copyright: (c) 2019, Ansible Project # Copyright: (c) 2017, Tim Rightnour # Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) @@ -87,7 +88,7 @@ class ServiceNowClient(object): def snow_argument_spec(): return dict( instance=dict(type='str', required=True), - username=dict(type='str', required=True, no_log=True), + username=dict(type='str', required=True), password=dict(type='str', required=True, no_log=True), client_id=dict(type='str', no_log=True), client_secret=dict(type='str', no_log=True), diff --git a/lib/ansible/modules/notification/snow_record.py b/lib/ansible/modules/notification/snow_record.py index c94b3cdf20c..af21b18c317 100644 --- a/lib/ansible/modules/notification/snow_record.py +++ b/lib/ansible/modules/notification/snow_record.py @@ -1,4 +1,6 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- + # Copyright: (c) 2017, Tim Rightnour # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -200,6 +202,7 @@ def run_module(): # Connect to ServiceNow service_now_client = ServiceNowClient(module) + service_now_client.login() conn = service_now_client.conn params = module.params diff --git a/lib/ansible/modules/notification/snow_record_find.py b/lib/ansible/modules/notification/snow_record_find.py index 5ea03aa934f..a9de154623c 100644 --- a/lib/ansible/modules/notification/snow_record_find.py +++ b/lib/ansible/modules/notification/snow_record_find.py @@ -1,4 +1,6 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- + # Copyright: (c) 2017, Tim Rightnour # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -227,6 +229,7 @@ def run_module(): # Connect to ServiceNow service_now_client = ServiceNowClient(module) + service_now_client.login() conn = service_now_client.conn params = module.params