Upgrade to openshift client 0.4.0 (#35127)

pull/36122/head
Chris Houseknecht 7 years ago committed by GitHub
parent 76ff3e9efc
commit 69be2c169f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -381,7 +381,7 @@ class AnsibleMixin(object):
if not request_value: if not request_value:
return return
sample_obj = self.model_class_from_name(obj_class)() model_class = self.model_class_from_name(obj_class)
# Try to determine the unique key for the array # Try to determine the unique key for the array
key_names = [ key_names = [
@ -390,7 +390,7 @@ class AnsibleMixin(object):
] ]
key_name = None key_name = None
for key in key_names: for key in key_names:
if hasattr(sample_obj, key): if hasattr(model_class, key):
key_name = key key_name = key
break break
@ -421,14 +421,14 @@ class AnsibleMixin(object):
found = True found = True
for key, value in iteritems(item): for key, value in iteritems(item):
snake_key = self.attribute_to_snake(key) snake_key = self.attribute_to_snake(key)
item_kind = sample_obj.swagger_types.get(snake_key) item_kind = model_class.swagger_types.get(snake_key)
if item_kind and item_kind in PRIMITIVES or type(value).__name__ in PRIMITIVES: if item_kind and item_kind in PRIMITIVES or type(value).__name__ in PRIMITIVES:
setattr(obj, snake_key, value) setattr(obj, snake_key, value)
elif item_kind and item_kind.startswith('list['): elif item_kind and item_kind.startswith('list['):
obj_type = item_kind.replace('list[', '').replace(']', '') obj_type = item_kind.replace('list[', '').replace(']', '')
if getattr(obj, snake_key) is None: if getattr(obj, snake_key) is None:
setattr(obj, snake_key, []) setattr(obj, snake_key, [])
if obj_type not in ('str', 'int', 'bool'): if obj_type not in ('str', 'int', 'bool', 'object'):
self.__compare_obj_list(getattr(obj, snake_key), value, obj_type, param_name) self.__compare_obj_list(getattr(obj, snake_key), value, obj_type, param_name)
else: else:
# Straight list comparison # Straight list comparison
@ -462,7 +462,7 @@ class AnsibleMixin(object):
) )
if not found: if not found:
# Requested item not found. Adding. # Requested item not found. Adding.
obj = self.__update_object_properties(self.model_class_from_name(obj_class)(), item) obj = self.model_class_from_name(obj_class)(**item)
src_value.append(obj) src_value.append(obj)
else: else:
# There isn't a key, or we don't know what it is, so check for all properties to match # There isn't a key, or we don't know what it is, so check for all properties to match
@ -480,7 +480,7 @@ class AnsibleMixin(object):
found = True found = True
break break
if not found: if not found:
obj = self.__update_object_properties(self.model_class_from_name(obj_class)(), item) obj = self.model_class_from_name(obj_class)(**item)
src_value.append(obj) src_value.append(obj)
def __update_object_properties(self, obj, item): def __update_object_properties(self, obj, item):
@ -512,7 +512,7 @@ class AnsibleMixin(object):
""" """
Convert a list of properties to an argument_spec dictionary Convert a list of properties to an argument_spec dictionary
:param properties: List of properties from self.properties_from_model_obj() :param properties: List of properties from self.properties_from_model_class()
:param prefix: String to prefix to argument names. :param prefix: String to prefix to argument names.
:param path: List of property names providing the recursive path through the model to the property :param path: List of property names providing the recursive path through the model to the property
:param alternate_prefix: a more minimal version of prefix :param alternate_prefix: a more minimal version of prefix
@ -598,7 +598,7 @@ class AnsibleMixin(object):
} }
args.update(self.__transform_properties(sub_props, prefix=p, path=paths, alternate_prefix=a)) args.update(self.__transform_properties(sub_props, prefix=p, path=paths, alternate_prefix=a))
else: else:
sub_props = self.properties_from_model_obj(prop_attributes['class']()) sub_props = self.properties_from_model_class(prop_attributes['class'])
args.update(self.__transform_properties(sub_props, prefix=p, path=paths, alternate_prefix=a)) args.update(self.__transform_properties(sub_props, prefix=p, path=paths, alternate_prefix=a))
else: else:
# Adds a primitive property # Adds a primitive property
@ -608,7 +608,7 @@ class AnsibleMixin(object):
paths.append(prop) paths.append(prop)
property_type = prop_attributes['class'].__name__ property_type = prop_attributes['class'].__name__
if property_type == 'IntstrIntOrString': if property_type == 'object':
property_type = 'str' property_type = 'str'
args[arg_prefix + prop] = { args[arg_prefix + prop] = {

@ -39,7 +39,7 @@ extends_documentation_fragment:
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
- "openshift >= 0.3" - "openshift == 0.4.1"
- "PyYAML >= 3.11" - "PyYAML >= 3.11"
''' '''

@ -35,7 +35,7 @@ extends_documentation_fragment:
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
- "openshift >= 0.3" - "openshift == 0.4.1"
- "PyYAML >= 3.11" - "PyYAML >= 3.11"
''' '''

@ -49,7 +49,7 @@ options:
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
- "openshift >= 0.3" - "openshift == 0.4.1"
- "PyYAML >= 3.11" - "PyYAML >= 3.11"
''' '''

@ -35,7 +35,7 @@ extends_documentation_fragment:
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
- "openshift >= 0.3" - "openshift == 0.4.1"
- "PyYAML >= 3.11" - "PyYAML >= 3.11"
''' '''

@ -73,6 +73,11 @@ DOCUMENTATION = '''
description: description:
- List of namespaces. If not specified, will fetch all containers for all namespaces user is authorized - List of namespaces. If not specified, will fetch all containers for all namespaces user is authorized
to access. to access.
requirements:
- "python >= 2.7"
- "openshift == 0.4.1"
- "PyYAML >= 3.11"
''' '''
EXAMPLES = ''' EXAMPLES = '''

@ -74,6 +74,11 @@ DOCUMENTATION = '''
description: description:
- List of namespaces. If not specified, will fetch all containers for all namespaces user is authorized - List of namespaces. If not specified, will fetch all containers for all namespaces user is authorized
to access. to access.
requirements:
- "python >= 2.7"
- "openshift == 0.4.1"
- "PyYAML >= 3.11"
''' '''
EXAMPLES = ''' EXAMPLES = '''

@ -115,7 +115,7 @@ DOCUMENTATION = """
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
- "openshift >= 0.3" - "openshift == 0.4.1"
- "PyYAML >= 3.11" - "PyYAML >= 3.11"
notes: notes:

@ -115,7 +115,7 @@ DOCUMENTATION = """
requirements: requirements:
- "python >= 2.7" - "python >= 2.7"
- "openshift >= 0.3" - "openshift == 0.4.1"
- "PyYAML >= 3.11" - "PyYAML >= 3.11"
notes: notes:

Loading…
Cancel
Save