Previously when deploying to custom networks salt-cloud would fail with the error described in #31071
Now it is possible to specify a subnetwork in the profile, to deploy to a custom network and a specific subnet in that network.
If all the devices submitted to pvcreate() are already initialized as
LVM physical volumes and override is True (which is default), pvcreate()
should return True and no futher actions should be made. The
'not cmd[1:]' check which is suited for this scenario is incorrect, as
we previously filled the 'cmd' list with two elements and thus the
condition would be always False. This would cause pvcreate() to call the
pvcreate executable with no arguments if all the submitted devices are
already initialized as LVM PVs.
Fixes#39070
If all the devices submitted to pvcreate() are already initialized as
LVM physical volumes, pvcreate() should return True and no futher
actions should be made.
pvdisplay() would be called by pvcreate() twice: firstly to check
whether a device is already initialized for use by LVM and then to
ensure that the pvcreate executable did its job correctly. The test
replaces pvdisplay() with a mock that always returns True and thus
pvcreate() would think that a specified device is already initialized
and exit. In the other words, instead of testing physical volume
initialization the test simulates a case with all the submitted
devices already initialized.
Fix it by replacing pvdisplay with a mock that returns False on the
first call (thus pvcreate thinks that a device is not a PV yet) and True
on the second call (after the pvcreate executable is called).
The comment seems to stay there by mistake as it has no relation to
what's really going on (i.e. checking whether the device is already an
LVM PV). Remove it.
'lvm version' produces multiline output whereas test_version and
test_fullversion use mocks with single-line output. Use real-life
'lvm version' output in those mocks instead.
By explicitly checking the length of 'exc_str_prefix', omit the
try-except block, handling of the leading whitespace, and the comment on
what's going on.