#NEWLINE# def _make_partition( session , dev , partition_start , partition_end ) : #NEWLINE# #INDENT# dev_path = utils . make_dev_path ( dev ) #NEWLINE# utils . execute ( 'parted' , '--script' , dev_path , 'mklabel' , 'msdos' , run_as_root = True , check_exit_code = ( not session . is_local_connection ) ) #NEWLINE# utils . execute ( 'parted' , '--script' , dev_path , '--' , 'mkpart' , 'primary' , partition_start , partition_end , run_as_root = True , check_exit_code = ( not session . is_local_connection ) ) #NEWLINE# partition_path = utils . make_dev_path ( dev , partition = 1 ) #NEWLINE# if session . is_local_connection : #NEWLINE# #INDENT# utils . trycmd ( 'kpartx' , '-a' , dev_path , run_as_root = True , discard_warnings = True ) #NEWLINE# mapper_path = ( '/dev/mapper/%s' % os . path . basename ( partition_path ) ) #NEWLINE# if os . path . exists ( mapper_path ) : #NEWLINE# #INDENT# return mapper_path #NEWLINE# #UNINDENT# #UNINDENT# return partition_path