#NEWLINE# def action_generate_nodes_fixture( params ) : #NEWLINE# #INDENT# from oslo_serialization import jsonutils #NEWLINE# from nailgun.logger import logger #NEWLINE# from nailgun.utils import fake_generator #NEWLINE# logger . info ( 'Generating new nodes fixture...' ) #NEWLINE# total_nodes_count = params . total_nodes #NEWLINE# fixtures_dir = os . path . join ( os . path . dirname ( os . path . abspath ( __file__ ) ) , 'nailgun/fixtures/' ) #NEWLINE# file_path = os . path . join ( fixtures_dir , '{0}_fake_nodes_environment.json' . format ( file_path ) ) #NEWLINE# generator = fake_generator . FakeNodesGenerator ( ) #NEWLINE# res = generator . generate_fake_nodes ( total_nodes_count , error_nodes_count = params . error_nodes , offline_nodes_count = params . offline_nodes , min_ifaces_num = params . min_ifaces_num ) #NEWLINE# with open ( file_path , 'w' ) as file_to_write : #NEWLINE# #INDENT# jsonutils . dump ( res , file_to_write , indent = 4 ) #NEWLINE# #UNINDENT# logger . info ( 'Done. New fixture was stored in {0} file' . format ( file_path ) )