#NEWLINE# def rename_state_ids( data , sls , is_extend = False ) : #NEWLINE# #INDENT# if ( ( 'extend' in data ) and ( not is_extend ) ) : #NEWLINE# #INDENT# rename_state_ids ( data [ 'extend' ] , sls , True ) #NEWLINE# #UNINDENT# for ( sid , _ , _ , args ) in statelist ( data ) : #NEWLINE# #INDENT# for ( req , sname , sid ) in nvlist2 ( args , REQUISITES ) : #NEWLINE# #INDENT# if sid . startswith ( '.' ) : #NEWLINE# #INDENT# req [ sname ] = _local_to_abs_sid ( sid , sls ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for sid in data : #NEWLINE# #INDENT# if sid . startswith ( '.' ) : #NEWLINE# #INDENT# newsid = _local_to_abs_sid ( sid , sls ) #NEWLINE# if ( newsid in data ) : #NEWLINE# #INDENT# raise SaltRenderError ( "Can't rename state id({0}) into {1} because the later already exists!" . format ( sid , newsid ) ) #NEWLINE# #UNINDENT# for ( sname , args ) in six . iteritems ( data [ is_extend ] ) : #NEWLINE# #INDENT# if ( state_name ( sname ) == STATE_NAME ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# for arg in args : #NEWLINE# #INDENT# if ( isinstance ( arg , dict ) and ( next ( iter ( arg ) ) == 'name' ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# args . insert ( 0 , dict ( name = sid [ 1 : ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# data [ newsid ] = data [ sid ] #NEWLINE# del data [ sid ]