#NEWLINE# def remount( name , device , mkmnt = False , fstype = '' , opts = 'defaults' , user = None ) : #NEWLINE# #INDENT# "\n    Attempt to remount a device, if the device is not already mounted, mount\n    is called\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' mount.remount /mnt/foo /dev/sdz1 True\n    " #NEWLINE# force_mount = False #NEWLINE# if ( __grains__ [ 'os' ] in [ 'MacOS' , 'Darwin' ] ) : #NEWLINE# #INDENT# if ( opts == 'defaults' ) : #NEWLINE# #INDENT# opts = 'noowners' #NEWLINE# #UNINDENT# if ( fstype == 'smbfs' ) : #NEWLINE# #INDENT# force_mount = True #NEWLINE# #UNINDENT# #UNINDENT# if isinstance ( args , six . string_types ) : #NEWLINE# #INDENT# opts = opts . split ( ',' ) #NEWLINE# #UNINDENT# mnts = active ( ) #NEWLINE# if ( name in mnts ) : #NEWLINE# #INDENT# if ( ( 'remount' not in opts ) and ( __grains__ [ 'os' ] not in [ 'OpenBSD' , 'MacOS' , 'Darwin' ] ) ) : #NEWLINE# #INDENT# opts . append ( 'remount' ) #NEWLINE# #UNINDENT# if force_mount : #NEWLINE# #INDENT# umount ( name , device , user = user ) #NEWLINE# #UNINDENT# lopts = ',' . join ( opts ) #NEWLINE# args = '-o {0}' . format ( lopts ) #NEWLINE# if fstype : #NEWLINE# #INDENT# args += ' -t {0}' . format ( fstype ) #NEWLINE# #UNINDENT# if ( ( __grains__ [ 'os' ] not in [ 'OpenBSD' , 'MacOS' , 'Darwin' ] ) or force_mount ) : #NEWLINE# #INDENT# cmd = 'mount {0} {1} {2} ' . format ( args , device , name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cmd = 'mount -u {0} {1} {2} ' . format ( args , device , name ) #NEWLINE# #UNINDENT# out = __salt__ [ 'cmd.run_all' ] ( cmd , runas = user , python_shell = False ) #NEWLINE# if out [ 'retcode' ] : #NEWLINE# #INDENT# return out [ 'stderr' ] #NEWLINE# #UNINDENT# return True #NEWLINE# #UNINDENT# return mount ( name , device , mkmnt , fstype , opts , user = user )