<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> import os . path <EOL> import re <EOL> from salt . ext . six import string_types <EOL> import logging <EOL> import salt . ext . six as six <EOL> log = logging . getLogger ( __name__ ) <EOL> def mounted ( name , <EOL> device , <EOL> fstype , <EOL> mkmnt = False , <EOL> opts = '<STR_LIT>' , <EOL> dump = <NUM_LIT:0> , <EOL> pass_num = <NUM_LIT:0> , <EOL> config = '<STR_LIT>' , <EOL> persist = True , <EOL> mount = True , <EOL> user = None , <EOL> match_on = '<STR_LIT>' , <EOL> extra_mount_invisible_options = None , <EOL> extra_mount_invisible_keys = None , <EOL> extra_mount_ignore_fs_keys = None , <EOL> extra_mount_translate_options = None , <EOL> hidden_opts = None ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT:result>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> if __grains__ [ '<STR_LIT>' ] in [ '<STR_LIT>' , '<STR_LIT>' ] and opts == '<STR_LIT>' : <EOL> opts = '<STR_LIT>' <EOL> if isinstance ( opts , string_types ) : <EOL> opts = opts . split ( '<STR_LIT:U+002C>' ) <EOL> if isinstance ( hidden_opts , string_types ) : <EOL> hidden_opts = hidden_opts . split ( '<STR_LIT:U+002C>' ) <EOL> if not name == '<STR_LIT:/>' : <EOL> name = name . rstrip ( '<STR_LIT:/>' ) <EOL> device_list = [ ] <EOL> active = __salt__ [ '<STR_LIT>' ] ( extended = True ) <EOL> real_name = os . path . realpath ( name ) <EOL> if device . startswith ( '<STR_LIT:/>' ) : <EOL> if '<STR_LIT>' in opts and real_name in active : <EOL> _device = device <EOL> if active [ real_name ] [ '<STR_LIT>' ] . startswith ( '<STR_LIT:/>' ) : <EOL> while True : <EOL> if _device in active : <EOL> _real_device = active [ _device ] [ '<STR_LIT>' ] <EOL> opts = list ( set ( opts + active [ _device ] [ '<STR_LIT>' ] + active [ _device ] [ '<STR_LIT>' ] ) ) <EOL> active [ real_name ] [ '<STR_LIT>' ] . append ( '<STR_LIT>' ) <EOL> break <EOL> _device = os . path . dirname ( _device ) <EOL> real_device = _real_device <EOL> else : <EOL> if _device in active : <EOL> opts = list ( set ( opts + active [ _device ] [ '<STR_LIT>' ] + active [ _device ] [ '<STR_LIT>' ] ) ) <EOL> active [ real_name ] [ '<STR_LIT>' ] . append ( '<STR_LIT>' ) <EOL> real_device = active [ real_name ] [ '<STR_LIT>' ] <EOL> else : <EOL> real_device = os . path . realpath ( device ) <EOL> elif device . upper ( ) . startswith ( '<STR_LIT>' ) : <EOL> real_device = device . split ( '<STR_LIT:=>' ) [ <NUM_LIT:1> ] . strip ( '<STR_LIT:">' ) . lower ( ) <EOL> elif device . upper ( ) . startswith ( '<STR_LIT>' ) : <EOL> _label = device . split ( '<STR_LIT:=>' ) [ <NUM_LIT:1> ] <EOL> cmd = '<STR_LIT>' . format ( _label ) <EOL> res = __salt__ [ '<STR_LIT>' ] ( '<STR_LIT>' . format ( cmd ) ) <EOL> if res [ '<STR_LIT>' ] > <NUM_LIT:0> : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( _label ) <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> return ret <EOL> else : <EOL> for line in res [ '<STR_LIT>' ] : <EOL> dev_with_label = line . split ( '<STR_LIT::>' ) [ <NUM_LIT:0> ] <EOL> device_list . append ( dev_with_label ) <EOL> real_device = device_list [ <NUM_LIT:0> ] <EOL> else : <EOL> real_device = device <EOL> lvs_match = re . match ( r'<STR_LIT>' , device ) <EOL> if lvs_match : <EOL> double_dash_escaped = dict ( ( k , re . sub ( r'<STR_LIT:->' , '<STR_LIT>' , v ) ) for k , v in six . iteritems ( lvs_match . groupdict ( ) ) ) <EOL> mapper_device = '<STR_LIT>' . format ( ** double_dash_escaped ) <EOL> if os . path . exists ( mapper_device ) : <EOL> real_device = mapper_device <EOL> fuse_match = re . match ( r'<STR_LIT>' , device ) <EOL> if fuse_match : <EOL> if '<STR_LIT>' in fuse_match . groupdict ( ) : <EOL> real_device = fuse_match . group ( '<STR_LIT>' ) <EOL> if real_name in active : <EOL> if '<STR_LIT>' not in active [ real_name ] : <EOL> active [ real_name ] [ '<STR_LIT>' ] = [ ] <EOL> if mount : <EOL> device_list . append ( active [ real_name ] [ '<STR_LIT>' ] ) <EOL> device_list . append ( os . path . realpath ( device_list [ <NUM_LIT:0> ] ) ) <EOL> alt_device = active [ real_name ] [ '<STR_LIT>' ] if '<STR_LIT>' in active [ real_name ] else None <EOL> uuid_device = active [ real_name ] [ '<STR_LIT>' ] if '<STR_LIT>' in active [ real_name ] else None <EOL> label_device = active [ real_name ] [ '<STR_LIT>' ] if '<STR_LIT>' in active [ real_name ] else None <EOL> if alt_device and alt_device not in device_list : <EOL> device_list . append ( alt_device ) <EOL> if uuid_device and uuid_device not in device_list : <EOL> device_list . append ( uuid_device ) <EOL> if label_device and label_device not in device_list : <EOL> device_list . append ( label_device ) <EOL> if opts : <EOL> mount_invisible_options = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:password>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:port>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> if extra_mount_invisible_options : <EOL> mount_invisible_options . extend ( extra_mount_invisible_options ) <EOL> if hidden_opts : <EOL> mount_invisible_options = list ( set ( mount_invisible_options ) | set ( hidden_opts ) ) <EOL> mount_invisible_keys = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:password>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:port>' , <EOL> ] <EOL> if extra_mount_invisible_keys : <EOL> mount_invisible_keys . extend ( extra_mount_invisible_keys ) <EOL> mount_ignore_fs_keys = { <EOL> '<STR_LIT>' : [ '<STR_LIT:size>' ] <EOL> } <EOL> if extra_mount_ignore_fs_keys : <EOL> mount_ignore_fs_keys . update ( extra_mount_ignore_fs_keys ) <EOL> mount_translate_options = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> if extra_mount_translate_options : <EOL> mount_translate_options . update ( extra_mount_translate_options ) <EOL> for opt in opts : <EOL> if opt in mount_translate_options : <EOL> opt = mount_translate_options [ opt ] <EOL> keyval_option = opt . split ( '<STR_LIT:=>' ) [ <NUM_LIT:0> ] <EOL> if keyval_option in mount_invisible_keys : <EOL> opt = keyval_option <EOL> size_match = re . match ( r'<STR_LIT>' , opt ) <EOL> if size_match : <EOL> converted_size = int ( size_match . group ( '<STR_LIT>' ) ) <EOL> if size_match . group ( '<STR_LIT>' ) == '<STR_LIT:m>' : <EOL> converted_size = int ( size_match . group ( '<STR_LIT>' ) ) * <NUM_LIT> <EOL> if size_match . group ( '<STR_LIT>' ) == '<STR_LIT:g>' : <EOL> converted_size = int ( size_match . group ( '<STR_LIT>' ) ) * <NUM_LIT> * <NUM_LIT> <EOL> opt = "<STR_LIT>" . format ( converted_size ) <EOL> if fstype in [ '<STR_LIT>' ] and opt . split ( '<STR_LIT:=>' ) [ <NUM_LIT:0> ] == '<STR_LIT:user>' : <EOL> opt = "<STR_LIT>" . format ( opt . split ( '<STR_LIT:=>' ) [ <NUM_LIT:1> ] ) <EOL> name_id_opts = { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> if opt . split ( '<STR_LIT:=>' ) [ <NUM_LIT:0> ] in name_id_opts and len ( opt . split ( '<STR_LIT:=>' ) ) > <NUM_LIT:1> : <EOL> _givenid = opt . split ( '<STR_LIT:=>' ) [ <NUM_LIT:1> ] <EOL> _param = opt . split ( '<STR_LIT:=>' ) [ <NUM_LIT:0> ] <EOL> _id = _givenid <EOL> if not re . match ( '<STR_LIT>' , _givenid ) : <EOL> _info = __salt__ [ name_id_opts [ _param ] ] ( _givenid ) <EOL> if _info and _param in _info : <EOL> _id = _info [ _param ] <EOL> opt = _param + '<STR_LIT:=>' + str ( _id ) <EOL> if opt not in active [ real_name ] [ '<STR_LIT>' ] and opt not in active [ real_name ] . get ( '<STR_LIT>' , [ ] ) and opt not in mount_invisible_options and opt not in mount_ignore_fs_keys . get ( fstype , [ ] ) and opt not in mount_invisible_keys : <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> ret [ '<STR_LIT>' ] = "<STR_LIT>" . format ( opt ) <EOL> return ret <EOL> else : <EOL> if fstype in [ '<STR_LIT>' , '<STR_LIT>' ] or fstype . startswith ( '<STR_LIT>' ) : <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = "<STR_LIT>" + "<STR_LIT>" . format ( opt ) <EOL> unmount_result = __salt__ [ '<STR_LIT>' ] ( real_name ) <EOL> if unmount_result is True : <EOL> mount_result = __salt__ [ '<STR_LIT>' ] ( real_name , device , mkmnt = mkmnt , fstype = fstype , opts = opts ) <EOL> ret [ '<STR_LIT:result>' ] = mount_result <EOL> else : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( real_name , unmount_result ) <EOL> return ret <EOL> else : <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = "<STR_LIT>" + "<STR_LIT>" . format ( opt ) <EOL> remount_result = __salt__ [ '<STR_LIT>' ] ( real_name , device , mkmnt = mkmnt , fstype = fstype , opts = opts ) <EOL> ret [ '<STR_LIT:result>' ] = remount_result <EOL> if '<STR_LIT>' in opts : <EOL> opts . remove ( '<STR_LIT>' ) <EOL> if real_device not in device_list : <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> ret [ '<STR_LIT>' ] = "<STR_LIT>" + "<STR_LIT>" + device <EOL> else : <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = "<STR_LIT>" + "<STR_LIT>" + device <EOL> if real_device != device : <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] += "<STR_LIT>" + real_device + "<STR_LIT:)>" <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] += "<STR_LIT>" + '<STR_LIT:U+002CU+0020>' . join ( device_list ) <EOL> out = __salt__ [ '<STR_LIT>' ] ( real_name , user = user ) <EOL> active = __salt__ [ '<STR_LIT>' ] ( extended = True ) <EOL> if real_name in active : <EOL> ret [ '<STR_LIT>' ] = "<STR_LIT>" <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> return ret <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if real_name not in active : <EOL> if mount : <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> if os . path . exists ( name ) : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> elif mkmnt : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> return ret <EOL> if not os . path . exists ( name ) and not mkmnt : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return ret <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , device , mkmnt , fstype , opts , user = user ) <EOL> active = __salt__ [ '<STR_LIT>' ] ( extended = True ) <EOL> if isinstance ( out , string_types ) : <EOL> ret [ '<STR_LIT>' ] = out <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> return ret <EOL> elif real_name in active : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = True <EOL> elif not os . path . exists ( name ) : <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> if mkmnt : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> elif mkmnt : <EOL> __salt__ [ '<STR_LIT>' ] ( name , user = user ) <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> else : <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> if persist : <EOL> if __grains__ [ '<STR_LIT>' ] in [ '<STR_LIT>' , '<STR_LIT>' ] and config == '<STR_LIT>' : <EOL> config = "<STR_LIT>" <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> if __grains__ [ '<STR_LIT>' ] in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , <EOL> device , <EOL> fstype , <EOL> opts , <EOL> config , <EOL> test = True ) <EOL> else : <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , <EOL> device , <EOL> fstype , <EOL> opts , <EOL> dump , <EOL> pass_num , <EOL> config , <EOL> test = True , <EOL> match_on = match_on ) <EOL> if out != '<STR_LIT>' : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> if out == '<STR_LIT>' : <EOL> if mount : <EOL> comment = ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( name ) <EOL> else : <EOL> comment = ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( name ) <EOL> elif out == '<STR_LIT>' : <EOL> if mount : <EOL> comment = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( name ) <EOL> else : <EOL> comment = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( name ) <EOL> else : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> comment = ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( name , out ) <EOL> if '<STR_LIT>' in ret : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( ret [ '<STR_LIT>' ] , comment ) <EOL> else : <EOL> ret [ '<STR_LIT>' ] = comment <EOL> return ret <EOL> else : <EOL> if __grains__ [ '<STR_LIT>' ] in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , <EOL> device , <EOL> fstype , <EOL> opts , <EOL> config ) <EOL> else : <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , <EOL> device , <EOL> fstype , <EOL> opts , <EOL> dump , <EOL> pass_num , <EOL> config , <EOL> match_on = match_on ) <EOL> if out == '<STR_LIT>' : <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> return ret <EOL> if out == '<STR_LIT>' : <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> return ret <EOL> if out == '<STR_LIT>' : <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> return ret <EOL> if out == '<STR_LIT>' : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> return ret <EOL> return ret <EOL> def swap ( name , persist = True , config = '<STR_LIT>' ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT:result>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> on_ = __salt__ [ '<STR_LIT>' ] ( ) <EOL> if __salt__ [ '<STR_LIT>' ] ( name ) : <EOL> real_swap_device = __salt__ [ '<STR_LIT>' ] ( name ) <EOL> if not real_swap_device . startswith ( '<STR_LIT:/>' ) : <EOL> real_swap_device = '<STR_LIT>' . format ( os . path . basename ( real_swap_device ) ) <EOL> else : <EOL> real_swap_device = real_swap_device <EOL> else : <EOL> real_swap_device = name <EOL> if real_swap_device in on_ : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> elif __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> else : <EOL> __salt__ [ '<STR_LIT>' ] ( real_swap_device ) <EOL> on_ = __salt__ [ '<STR_LIT>' ] ( ) <EOL> if real_swap_device in on_ : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> ret [ '<STR_LIT>' ] = on_ [ real_swap_device ] <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> if persist : <EOL> fstab_data = __salt__ [ '<STR_LIT>' ] ( config ) <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> if name not in fstab_data : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> if name in on_ : <EOL> ret [ '<STR_LIT>' ] = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( name ) <EOL> return ret <EOL> if '<STR_LIT:none>' in fstab_data : <EOL> if fstab_data [ '<STR_LIT:none>' ] [ '<STR_LIT>' ] == name and fstab_data [ '<STR_LIT:none>' ] [ '<STR_LIT>' ] != '<STR_LIT>' : <EOL> return ret <EOL> out = __salt__ [ '<STR_LIT>' ] ( '<STR_LIT:none>' , <EOL> name , <EOL> '<STR_LIT>' , <EOL> [ '<STR_LIT>' ] , <EOL> <NUM_LIT:0> , <EOL> <NUM_LIT:0> , <EOL> config ) <EOL> if out == '<STR_LIT>' : <EOL> return ret <EOL> if out == '<STR_LIT>' : <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> return ret <EOL> if out == '<STR_LIT>' : <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> return ret <EOL> if out == '<STR_LIT>' : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> return ret <EOL> return ret <EOL> def unmounted ( name , <EOL> device = None , <EOL> config = '<STR_LIT>' , <EOL> persist = False , <EOL> user = None ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT:result>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> active = __salt__ [ '<STR_LIT>' ] ( extended = True ) <EOL> if name not in active : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if name in active : <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> ret [ '<STR_LIT>' ] = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( name ) <EOL> return ret <EOL> if device : <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , device , user = user ) <EOL> else : <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , user = user ) <EOL> if isinstance ( out , string_types ) : <EOL> ret [ '<STR_LIT>' ] = out <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> elif out is True : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = True <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT:result>' ] = True <EOL> if persist : <EOL> if __grains__ [ '<STR_LIT>' ] in [ '<STR_LIT>' , '<STR_LIT>' ] and config == '<STR_LIT>' : <EOL> config = "<STR_LIT>" <EOL> fstab_data = __salt__ [ '<STR_LIT>' ] ( config ) <EOL> else : <EOL> fstab_data = __salt__ [ '<STR_LIT>' ] ( config ) <EOL> if name not in fstab_data : <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> else : <EOL> if device : <EOL> if fstab_data [ name ] [ '<STR_LIT>' ] != device : <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' . format ( device ) <EOL> return ret <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> ret [ '<STR_LIT>' ] = ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) . format ( name , config ) <EOL> return ret <EOL> else : <EOL> if __grains__ [ '<STR_LIT>' ] in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , device , config ) <EOL> else : <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , device , config ) <EOL> if out is not True : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> else : <EOL> ret [ '<STR_LIT>' ] += '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return ret <EOL> def mod_watch ( name , user = None , ** kwargs ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT:result>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> if kwargs [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> out = __salt__ [ '<STR_LIT>' ] ( name , kwargs [ '<STR_LIT>' ] , False , kwargs [ '<STR_LIT>' ] , kwargs [ '<STR_LIT>' ] , user = user ) <EOL> if out : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name ) <EOL> else : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( name , out ) <EOL> else : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' . format ( kwargs [ '<STR_LIT>' ] ) <EOL> return ret </s>
