Skip to content

Commit 7682373

Browse files
committed
Don't unmount anything if only getting package list.
1 parent b47401d commit 7682373

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

library/blivet.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
use_partitions = None # create partitions on pool backing device disks?
122122
disklabel_type = None # user-specified disklabel type
123123
safe_mode = None # do not remove any existing devices or formatting
124+
packages_only = None # only set things up enough to get a list of required packages
124125

125126

126127
class BlivetAnsibleError(Exception):
@@ -211,14 +212,16 @@ def _resize(self):
211212

212213
def _reformat(self):
213214
""" Schedule actions as needed to ensure the volume is formatted as specified. """
215+
global packages_only
216+
214217
fmt = self._get_format()
215218
if self._device.format.type == fmt.type:
216219
return
217220

218221
if safe_mode and (self._device.format.type is not None or self._device.format.name != get_format(None).name):
219222
raise BlivetAnsibleError("cannot remove existing formatting on volume '%s' in safe mode" % self._volume['name'])
220223

221-
if self._device.format.status:
224+
if self._device.format.status and not packages_only:
222225
self._device.format.teardown()
223226
self._blivet.format_device(self._device, fmt)
224227

@@ -706,6 +709,9 @@ def run_module():
706709
global safe_mode
707710
safe_mode = module.params['safe_mode']
708711

712+
global packages_only
713+
packages_only = module.params['packages_only']
714+
709715
b = Blivet()
710716
b.reset()
711717
fstab = FSTab(b)

0 commit comments

Comments
 (0)