Ryan Barry has uploaded a new change for review. Change subject: The installer should run in dry mode as a normal user ......................................................................
The installer should run in dry mode as a normal user Don't call commands which require root permissions in dry mode. If we're not root, fake it. Change-Id: I6fc6bcaad5f6c9e5ba3ba3c027981d7d8bbb0ba6 Signed-off-by: Ryan Barry <[email protected]> --- M src/ovirt/node/installer/core/storage_vol_page.py 1 file changed, 9 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/10/30610/1 diff --git a/src/ovirt/node/installer/core/storage_vol_page.py b/src/ovirt/node/installer/core/storage_vol_page.py index d001e9d..15ab9fe 100644 --- a/src/ovirt/node/installer/core/storage_vol_page.py +++ b/src/ovirt/node/installer/core/storage_vol_page.py @@ -21,7 +21,7 @@ """ Storage Volume page of the installer """ - +import os from ovirt.node import plugins, ui, valid from ovirt.node.utils import process from ovirt.node.exceptions import InvalidData @@ -160,9 +160,14 @@ def __get_default_sizes(self): if self.application.args.dry: - cmd = "blockdev --getsize64 /dev/[sv]da" - stdout = process.check_output(cmd, shell=True) - self._drive_size = int(stdout) / 1024 / 1024 + if os.geteuid() == 0: + cmd = "blockdev --getsize64 /dev/[sv]da" + stdout = process.check_output(cmd, shell=True) + self._drive_size = int(stdout) / 1024 / 1024 + else: + # If we're not root and can't query the drive, + # pretend it's 5G + self._drive_size = 5242880 return {"storage.efi_size": "%s" % presets.BOOT_SIZE, "storage.root_size": "%s" % presets.ROOT_SIZE, "storage.swap_size": "0", -- To view, visit http://gerrit.ovirt.org/30610 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6fc6bcaad5f6c9e5ba3ba3c027981d7d8bbb0ba6 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Ryan Barry <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
