#NEWLINE# def create_nvram( self , verbosity ) : #NEWLINE# #INDENT# nvram = '[args]\n' #NEWLINE# nvram += ( 'args = %s\n' % ' ' . join ( [ ( '%s' % a . replace ( ',' , '\\x2c' ) . replace ( ' ' , '\\x20' ) ) for a in self . nvram_args [ 'args' ] ] ) ) #NEWLINE# if ( len ( self . config [ 'env' ] ) > 0 ) : #NEWLINE# #INDENT# nvram += '[env]\n' #NEWLINE# for ( k , v ) in self . config [ 'env' ] . items ( ) : #NEWLINE# #INDENT# nvram += ( 'name=%s,value=%s\n' % ( k , v . replace ( ',' , '\\x2c' ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( self . nvram_fstab ) > 0 ) : #NEWLINE# #INDENT# nvram += '[fstab]\n' #NEWLINE# for ( channel , mp , access ) in self . nvram_fstab : #NEWLINE# #INDENT# nvram += ( 'channel=%s,mountpoint=%s,access=%s,removable=no\n' % ( channel , mp , access ) ) #NEWLINE# #UNINDENT# #UNINDENT# mapping = '' #NEWLINE# for std_name in ( 'stdin' , 'stdout' , 'stderr' ) : #NEWLINE# #INDENT# std_chan = getattr ( sys , std_name ) #NEWLINE# if std_chan . isatty ( ) : #NEWLINE# #INDENT# mapping += ( CHANNEL_MAPPING_TEMPLATE % ( std_name , 'char' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mapping += ( CHANNEL_MAPPING_TEMPLATE % ( std_name , 'file' ) ) #NEWLINE# #UNINDENT# #UNINDENT# for dev in self . nvram_reg_files : #NEWLINE# #INDENT# mapping += ( 'channel=%s,mode=file\n' % nvram ) #NEWLINE# #UNINDENT# if mapping : #NEWLINE# #INDENT# nvram += ( '[mapping]\n' + mapping ) #NEWLINE# #UNINDENT# if verbosity : #NEWLINE# #INDENT# nvram += ( '[debug]\nverbosity=%d\n' % verbosity ) #NEWLINE# #UNINDENT# self . nvram_filename = os . path . join ( self . tmpdir , ( 'nvram.%d' % self . node_id ) ) #NEWLINE# nvram_fd = open ( self . nvram_filename , 'wb' ) #NEWLINE# nvram_fd . write ( nvram . encode ( 'utf-8' ) ) #NEWLINE# nvram_fd . close ( )