mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
Add ability to resize existing partition (#773)
* Add ability to resize existing partition * Add 'resize' flag to support backwards compatability, and allow partition reduction * Add changelog fragment for #773 * Update changelogs/fragments/773-resize-partition.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/system/parted.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update resize flag with PR review comments Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * Update plugins/modules/system/parted.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update default on resize flag in parted.py * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
This commit is contained in:
parent
0a28a0c8b0
commit
8f99f9cb1c
3 changed files with 65 additions and 0 deletions
|
@ -206,6 +206,17 @@ class TestParted(ModuleTestCase):
|
|||
with patch('ansible_collections.community.general.plugins.modules.system.parted.get_device_info', return_value=parted_dict1):
|
||||
self.execute_module(changed=True, script='rm 1')
|
||||
|
||||
def test_resize_partition(self):
|
||||
set_module_args({
|
||||
'device': '/dev/sdb',
|
||||
'number': 3,
|
||||
'state': 'present',
|
||||
'part_end': '100%',
|
||||
'resize': True
|
||||
})
|
||||
with patch('ansible_collections.community.general.plugins.modules.system.parted.get_device_info', return_value=parted_dict1):
|
||||
self.execute_module(changed=True, script='resizepart 3 100%')
|
||||
|
||||
def test_change_flag(self):
|
||||
# Flags are set in a second run of parted().
|
||||
# Between the two runs, the partition dict is updated.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue