#NEWLINE# def __init__( self , request , context_seed , entry_point , * args , **kwargs ) : #NEWLINE# #INDENT# template_id = context_seed [ 'template_id' ] #NEWLINE# try : #NEWLINE# #INDENT# template = saharaclient . cluster_template_get ( request , template_id ) #NEWLINE# self . _set_configs_to_copy ( template . cluster_configs ) #NEWLINE# request . GET = request . GET . copy ( ) #NEWLINE# request . GET . update ( { #NEWLINE# #INDENT# 'plugin_name' : template . plugin_name , #NEWLINE# 'hadoop_version' : template . hadoop_version , #NEWLINE# 'aa_groups' : template . anti_affinity , #NEWLINE# #UNINDENT# } ) #NEWLINE# super ( CopyClusterTemplate , self ) . __init__ ( request , context_seed , entry_point , * args , ** kwargs ) #NEWLINE# for step in self . steps : #NEWLINE# #INDENT# if isinstance ( step , create_flow . ConfigureNodegroups ) : #NEWLINE# #INDENT# ng_action = step . action #NEWLINE# template_ngs = template . node_groups #NEWLINE# if ( 'forms_ids' in request . POST ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# ng_action . groups = [ ] #NEWLINE# for ( i , templ_ng ) in enumerate ( template_ngs ) : #NEWLINE# #INDENT# group_name = ( 'group_name_%d' % i ) #NEWLINE# template_id = ( 'template_id_%d' % i ) #NEWLINE# count = ( 'count_%d' % i ) #NEWLINE# serialized = ( 'serialized_%d' % i ) #NEWLINE# serialized_val = base64 . urlsafe_b64encode ( json . dumps ( wf_helpers . clean_node_group ( templ_ng ) ) ) #NEWLINE# ng = { #NEWLINE# #INDENT# 'name' : templ_ng [ 'name' ] , #NEWLINE# 'count' : templ_ng [ 'count' ] , #NEWLINE# 'id' : i , #NEWLINE# 'deletable' : 'true' , #NEWLINE# 'serialized' : serialized_val , #NEWLINE# #UNINDENT# } #NEWLINE# if ( 'node_group_template_id' in templ_ng ) : #NEWLINE# #INDENT# ng [ 'template_id' ] = templ_ng [ 'node_group_template_id' ] #NEWLINE# #UNINDENT# ng_action . groups . append ( ng ) #NEWLINE# wf_helpers . build_node_group_fields ( ng_action , group_name , template_id , count , serialized ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( step , create_flow . GeneralConfig ) : #NEWLINE# #INDENT# fields = step . action . fields #NEWLINE# fields [ 'cluster_template_name' ] . initial = ( template . name + '-copy' ) #NEWLINE# fields [ 'description' ] . initial = self . description #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# exceptions . handle ( request , _ ( 'Unable to fetch template to copy.' ) )