mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 22:51:23 -07:00
[k8s] allow user to pass list of resources in to definition parameter (#42377)
* allow user to pass list of resources in to definition parameter * Add new validator for list|dict|string * use string_types instead of string * state/force information is lost after the first item in the list * Add tests * Appease ansibot
This commit is contained in:
parent
dfb2b3fdd5
commit
e9c7b513a1
4 changed files with 125 additions and 5 deletions
|
@ -22,8 +22,8 @@ import os
|
|||
import copy
|
||||
|
||||
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems, string_types
|
||||
|
||||
try:
|
||||
import kubernetes
|
||||
|
@ -51,6 +51,16 @@ try:
|
|||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
def list_dict_str(value):
|
||||
if isinstance(value, list):
|
||||
return value
|
||||
elif isinstance(value, dict):
|
||||
return value
|
||||
elif isinstance(value, string_types):
|
||||
return value
|
||||
raise TypeError
|
||||
|
||||
ARG_ATTRIBUTES_BLACKLIST = ('property_path',)
|
||||
|
||||
COMMON_ARG_SPEC = {
|
||||
|
@ -63,6 +73,7 @@ COMMON_ARG_SPEC = {
|
|||
'default': False,
|
||||
},
|
||||
'resource_definition': {
|
||||
'type': list_dict_str,
|
||||
'aliases': ['definition', 'inline']
|
||||
},
|
||||
'src': {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue