From 30a7670f3675aa045d6959e6195af42b9d4b97b4 Mon Sep 17 00:00:00 2001 From: Chris Archibald Date: Tue, 2 Jul 2019 14:35:38 -0700 Subject: [PATCH] fixes (#58598) --- .../storage/netapp/na_ontap_vscan_scanner_pool.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/storage/netapp/na_ontap_vscan_scanner_pool.py b/lib/ansible/modules/storage/netapp/na_ontap_vscan_scanner_pool.py index f0360382c9a..05e71b1c4ac 100644 --- a/lib/ansible/modules/storage/netapp/na_ontap_vscan_scanner_pool.py +++ b/lib/ansible/modules/storage/netapp/na_ontap_vscan_scanner_pool.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# (c) 2018, NetApp, Inc +# (c) 2018-2019, NetApp, Inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function @@ -163,6 +163,7 @@ class NetAppOntapVscanScannerPool(object): scanner_pool_obj = netapp_utils.zapi.NaElement('vscan-scanner-pool-get-iter') scanner_pool_info = netapp_utils.zapi.NaElement('scan-scanner-pool-info') scanner_pool_info.add_new_child('scanner-pool', self.scanner_pool) + scanner_pool_info.add_new_child('vserver', self.vserver) query = netapp_utils.zapi.NaElement('query') query.add_child_elem(scanner_pool_info) scanner_pool_obj.add_child_elem(query) @@ -172,7 +173,7 @@ class NetAppOntapVscanScannerPool(object): self.module.fail_json(msg='Error searching for Vscan Scanner Pool %s: %s' % (self.scanner_pool, to_native(error)), exception=traceback.format_exc()) - if result.get_child_by_name('num-records'): + if result.get_child_by_name('num-records') and int(result.get_child_content('num-records')) >= 1: if result.get_child_by_name('attributes-list').get_child_by_name('vscan-scanner-pool-info').get_child_content( 'scanner-pool') == self.scanner_pool: return result.get_child_by_name('attributes-list').get_child_by_name('vscan-scanner-pool-info') @@ -216,9 +217,10 @@ class NetAppOntapVscanScannerPool(object): changed = True # apply Scanner policy if scanner_pool_obj: - if scanner_pool_obj.get_child_content('scanner-policy') != self.scanner_policy: - self.apply_policy() - changed = True + if self.scanner_policy: + if scanner_pool_obj.get_child_content('scanner-policy') != self.scanner_policy: + self.apply_policy() + changed = True if self.state == 'absent': if scanner_pool_obj: self.delete_scanner_pool()