lookup: return list even if single item found (#117)

Always return list from k8s lookup plugin

Fixes: #9

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde
2021-06-04 10:23:21 +05:30
committed by GitHub
parent dd53fde0e1
commit cf0b71f93e
4 changed files with 67 additions and 15 deletions

View File

@@ -1,20 +1,7 @@
#
# Copyright 2018 Red Hat | Ansible
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# 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)
@@ -277,7 +264,7 @@ class KubernetesLookup(K8sAnsibleMixin):
if self.name:
return [k8s_obj.to_dict()]
return k8s_obj.to_dict().get('items')
return [k8s_obj.to_dict().get('items')]
class LookupModule(LookupBase):