diff --git a/salt/states/mount.py b/salt/states/mount.py index f5b73ee346..75ed1a65e9 100644 --- a/salt/states/mount.py +++ b/salt/states/mount.py @@ -140,7 +140,7 @@ def mounted(name, return ret else: ret['changes']['umount'] = "Forced remount because " \ - + "options changed" + + "options changed" remount_result = __salt__['mount.remount'](real_name, device, mkmnt=mkmnt, fstype=fstype, opts=opts) ret['result'] = remount_result return ret @@ -165,9 +165,20 @@ def mounted(name, # The mount is not present! Mount it if __opts__['test']: ret['result'] = None - ret['comment'] = '{0} would be mounted'.format(name) + if os.path.exists(name): + ret['comment'] = '{0} would be mounted'.format(name) + else: + ret['comment'] = '{0} will be created and mounted'.format(name) return ret + if not os.path.exists(name): + if mkmnt: + __salt__['file.mkdir'](name) + else: + ret['result'] = False + ret['comment'] = 'Mount directory is not present' + return ret + out = __salt__['mount.mount'](name, device, mkmnt, fstype, opts) active = __salt__['mount.active']() if isinstance(out, string_types):