def _validate_customization_args_and_values(item_name, item_type, customization_args, ca_specs_to_validate_against):
 ca_spec_names = [ca_spec.name for ca_spec in ca_specs_to_validate_against]
 if (not isinstance(customization_args, dict)):
  raise utils.ValidationError(('Expected customization args to be a dict, received %s' % customization_args))
 customization_args = _get_full_customization_args(customization_args, ca_specs_to_validate_against)
 extra_args = []
 for arg_name in customization_args.keys():
  if (not isinstance(arg_name, basestring)):
   raise utils.ValidationError(('Invalid customization arg name: %s' % arg_name))
  if (arg_name not in ca_spec_names):
   extra_args.append(arg_name)
   logging.warning(('%s %s does not support customization arg %s.' % (item_name.capitalize(), item_type, arg_name)))
 for extra_arg in extra_args:
  del customization_args[extra_arg]
 for ca_spec in ca_specs_to_validate_against:
  try:
   customization_args[ca_spec.name]['value'] = schema_utils.normalize_against_schema(customization_args[ca_spec.name]['value'], ca_spec.schema)
  except Exception:
   pass

def _validate_customization_args_and_values ( item_name , item_type , customization_args , ca_specs_to_validate_against ) : ca_spec_names = [ ca_spec . name for ca_spec in ca_specs_to_validate_against ] if ( not isinstance ( customization_args , dict ) ) : raise utils . ValidationError ( ( 'Expected customization args to be a dict, received %s' % customization_args ) ) customization_args = _get_full_customization_args ( customization_args , ca_specs_to_validate_against ) extra_args = [ ] for arg_name in customization_args . keys ( ) : if ( not isinstance ( arg_name , basestring ) ) : raise utils . ValidationError ( ( 'Invalid customization arg name: %s' % arg_name ) ) if ( arg_name not in ca_spec_names ) : extra_args . append ( arg_name ) logging . warning ( ( '%s %s does not support customization arg %s.' % ( item_name . capitalize ( ) , item_type , arg_name ) ) ) for extra_arg in extra_args : del customization_args [ extra_arg ] for ca_spec in ca_specs_to_validate_against : try : customization_args [ ca_spec . name ] [ 'value' ] = schema_utils . normalize_against_schema ( customization_args [ ca_spec . name ] [ 'value' ] , ca_spec . schema ) except Exception : pass
validates the given customization_args dict against the specs set out in ca_specs_to_validate_against .