#NEWLINE# def set_val( name , value ) : #NEWLINE# #INDENT# '\n    :param name: name of paramater\n    :type name: str\n    :param value: value to set to paramater `name`\n    :type param: str\n    :returns: Toml config\n    :rtype: Toml\n    ' #NEWLINE# toml_config = util . get_config ( True ) #NEWLINE# ( section , subkey ) = split_key ( name ) #NEWLINE# config_schema = get_config_schema ( section ) #NEWLINE# new_value = jsonitem . parse_json_value ( subkey , value , config_schema ) #NEWLINE# toml_config_pre = copy . deepcopy ( toml_config ) #NEWLINE# if ( section not in toml_config_pre . _dictionary ) : #NEWLINE# #INDENT# toml_config_pre . _dictionary [ section ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# value_exists = ( name in toml_config ) #NEWLINE# old_value = toml_config . get ( name ) #NEWLINE# toml_config [ name ] = new_value #NEWLINE# check_config ( toml_config_pre , toml_config ) #NEWLINE# save ( toml_config ) #NEWLINE# msg = '[{}]: ' . format ( name ) #NEWLINE# if ( name == 'core.dcos_acs_token' ) : #NEWLINE# #INDENT# if ( not value_exists ) : #NEWLINE# #INDENT# msg += 'set' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( old_value == new_value ) : #NEWLINE# #INDENT# msg += 'already set to that value' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg += 'changed' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( not value_exists ) : #NEWLINE# #INDENT# msg += "set to '{}'" . format ( new_value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( old_value == new_value ) : #NEWLINE# #INDENT# msg += "already set to '{}'" . format ( old_value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg += "changed from '{}' to '{}'" . format ( old_value , value_exists ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# emitter . publish ( DefaultError ( msg ) ) #NEWLINE# return toml_config