Merge ~jnavila/curtin:lvm_int_bytes into curtin:master

Proposed by Jean-Noël AVILA
Status: Needs review
Proposed branch: ~jnavila/curtin:lvm_int_bytes
Merge into: curtin:master
Diff against target: 22 lines (+2/-2)
1 file modified
curtin/util.py (+2/-2)
Reviewer Review Type Date Requested Status
curtin developers Pending
Review via email: mp+396875@code.launchpad.net

Description of the change

When using automatic install script in subiquity with automated size
computation, the output is a double with no decimal, but lvcreate
fails with values of bytes presenting a decimal point.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I think it would be better to fix subiquity to never put floats into the config file TBH.

~jnavila/curtin:lvm_int_bytes updated
26852cf... by Jean-Noël AVILA

Force human2bytes to always return an int

All sizes in bytes can only be integer. Moreover, for all users of
this function, the output can be printed without a decimal point
appearing.

Unmerged commits

26852cf... by Jean-Noël AVILA

Force human2bytes to always return an int

All sizes in bytes can only be integer. Moreover, for all users of
this function, the output can be printed without a decimal point
appearing.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/curtin/util.py b/curtin/util.py
index be063d7..6f3f2d0 100644
--- a/curtin/util.py
+++ b/curtin/util.py
@@ -990,7 +990,7 @@ def human2bytes(size):
990 if int(size) != size:990 if int(size) != size:
991 raise ValueError("'%s': resulted in non-integer (%s)" %991 raise ValueError("'%s': resulted in non-integer (%s)" %
992 (size_in, int(size)))992 (size_in, int(size)))
993 return size993 return int(size)
994 elif not isinstance(size, str):994 elif not isinstance(size, str):
995 raise TypeError("cannot convert type %s ('%s')." % (type(size), size))995 raise TypeError("cannot convert type %s ('%s')." % (type(size), size))
996996
@@ -1018,7 +1018,7 @@ def human2bytes(size):
1018 if int(val) != val:1018 if int(val) != val:
1019 raise ValueError("'%s': resulted in non-integer (%s)" % (size_in, val))1019 raise ValueError("'%s': resulted in non-integer (%s)" % (size_in, val))
10201020
1021 return val1021 return int(val)
10221022
10231023
1024def bytes2human(size):1024def bytes2human(size):

Subscribers

People subscribed via source and target branches