1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[parted] Fixes incorrect arg spec and check (#27839)

* [parted] Fixes incorrect arg spec and check

* [parted] Fixes spaces around parameter
This commit is contained in:
Sophie Herold 2017-08-29 22:18:22 +02:00 committed by René Moser
parent 06fadefbdc
commit ad9e39636e

View file

@ -549,6 +549,7 @@ def main():
# mklabel <label-type> command # mklabel <label-type> command
'label': { 'label': {
'default': 'msdos',
'choices': [ 'choices': [
'aix', 'amiga', 'bsd', 'dvh', 'gpt', 'loop', 'mac', 'msdos', 'aix', 'amiga', 'bsd', 'dvh', 'gpt', 'loop', 'mac', 'msdos',
'pc98', 'sun' 'pc98', 'sun'
@ -578,6 +579,10 @@ def main():
'type': 'str' 'type': 'str'
} }
}, },
required_if=[
['state', 'present', ['number']],
['state', 'absent', ['number']],
],
supports_check_mode=True, supports_check_mode=True,
) )
module.run_command_environ_update = {'LANG': 'C', 'LC_ALL': 'C', 'LC_MESSAGES': 'C', 'LC_CTYPE': 'C'} module.run_command_environ_update = {'LANG': 'C', 'LC_ALL': 'C', 'LC_MESSAGES': 'C', 'LC_CTYPE': 'C'}
@ -599,8 +604,8 @@ def main():
parted_exec = module.get_bin_path('parted', True) parted_exec = module.get_bin_path('parted', True)
# Conditioning # Conditioning
if number and number < 0: if number is not None and number < 1:
module.fail_json(msg="The partition number must be non negative.") module.fail_json(msg="The partition number must be greater then 0.")
if not check_size_format(part_start): if not check_size_format(part_start):
module.fail_json( module.fail_json(
msg="The argument 'part_start' doesn't respect required format." msg="The argument 'part_start' doesn't respect required format."
@ -619,9 +624,6 @@ def main():
current_parts = current_device['partitions'] current_parts = current_device['partitions']
if state == 'present': if state == 'present':
# Default value for the label
if not label:
label = 'msdos'
# Assign label if required # Assign label if required
if current_device['generic'].get('table', None) != label: if current_device['generic'].get('table', None) != label: