#NEWLINE# @ staticmethod #NEWLINE# def _getHostname( ) : #NEWLINE# #INDENT# 'Generate hostname by BOOTIF kernel option or use os.uname().' #NEWLINE# with open ( '/proc/cmdline' ) as fo : #NEWLINE# #INDENT# cpu_cmdline = fo . readline ( ) . strip ( ) #NEWLINE# #UNINDENT# regex = re . search ( '(?<=BOOTIF=)([0-9a-fA-F-]*)' , cpu_cmdline ) #NEWLINE# if regex : #NEWLINE# #INDENT# mac = regex . group ( 0 ) . upper ( ) #NEWLINE# return '' . join ( mac . split ( '-' ) ) #NEWLINE# #UNINDENT# return os . uname ( ) [ 1 ]