linux_lvm.lvresize module - change return type

This commit is contained in:
rkissos 2018-04-09 11:14:11 +03:00
parent a6452e0561
commit cd21355787

View File

@ -5,6 +5,7 @@ Support for Linux LVM2
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
# Import python libs # Import python libs
import logging
import os.path import os.path
# Import salt libs # Import salt libs
@ -12,6 +13,9 @@ import salt.utils.path
from salt.ext import six from salt.ext import six
from salt.exceptions import CommandExecutionError from salt.exceptions import CommandExecutionError
# Set up logger
log = logging.getLogger(__name__)
# Define the module's virtual name # Define the module's virtual name
__virtualname__ = 'lvm' __virtualname__ = 'lvm'
@ -490,7 +494,8 @@ def lvresize(size=None, lvpath=None, extents=None):
''' '''
if size and extents: if size and extents:
return 'Error: Please specify only one of size or extents' log.error('Error: Please specify only one of size or extents')
return {}
cmd = ['lvresize'] cmd = ['lvresize']
@ -499,7 +504,8 @@ def lvresize(size=None, lvpath=None, extents=None):
elif extents: elif extents:
cmd.extend(['-l', '{0}'.format(extents)]) cmd.extend(['-l', '{0}'.format(extents)])
else: else:
return 'Error: Either size or extents must be specified' log.error('Error: Either size or extents must be specified')
return {}
cmd.append(lvpath) cmd.append(lvpath)
cmd_ret = __salt__['cmd.run'](cmd, python_shell=False).splitlines() cmd_ret = __salt__['cmd.run'](cmd, python_shell=False).splitlines()