mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-21 20:30:21 -07:00
parted: consider current partition state even in check_mode (#247)
* parted: consider current partition state even in check_mode * Update changelogs/fragments/183-parted_check_mode.yml Co-Authored-By: Andrew Klychkov <aaklychkov@mail.ru> * Test check_mode considers get_device_info * fixed pep8 E302: expected 2 blank lines Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
parent
4e7732586f
commit
eb941c30b4
3 changed files with 56 additions and 3 deletions
|
@ -632,11 +632,13 @@ def main():
|
|||
changed = True
|
||||
script = ""
|
||||
|
||||
current_parts = get_device_info(device, unit)['partitions']
|
||||
if not module.check_mode:
|
||||
current_parts = get_device_info(device, unit)['partitions']
|
||||
|
||||
if part_exists(current_parts, 'num', number) or module.check_mode:
|
||||
partition = {'flags': []} # Empty structure for the check-mode
|
||||
if not module.check_mode:
|
||||
if changed and module.check_mode:
|
||||
partition = {'flags': []} # Empty structure for the check-mode
|
||||
else:
|
||||
partition = [p for p in current_parts if p['num'] == number][0]
|
||||
|
||||
# Assign name to the partition
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue