|
|
bb45c0 |
commit 7b125d415195713596c798e8ac79e4812873d948
|
|
|
bb45c0 |
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
|
|
bb45c0 |
Date: Tue Dec 9 10:27:40 2014 +0100
|
|
|
bb45c0 |
|
|
|
bb45c0 |
Expect KB as well as MB in disk requirements message from rpm. BZ 1051931
|
|
|
bb45c0 |
|
|
|
bb45c0 |
diff --git a/cli.py b/cli.py
|
|
|
bb45c0 |
index b7f5b5a..f04fe63 100755
|
|
|
bb45c0 |
--- a/cli.py
|
|
|
bb45c0 |
+++ b/cli.py
|
|
|
bb45c0 |
@@ -498,13 +498,14 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
|
|
|
bb45c0 |
"""
|
|
|
bb45c0 |
summary = ''
|
|
|
bb45c0 |
# do disk space report first
|
|
|
bb45c0 |
- p = re.compile('needs (\d+)MB on the (\S+) filesystem')
|
|
|
bb45c0 |
+ p = re.compile('needs (\d+)(K|M)B on the (\S+) filesystem')
|
|
|
bb45c0 |
disk = {}
|
|
|
bb45c0 |
for m in p.finditer(errstring):
|
|
|
bb45c0 |
- if m.group(2) not in disk:
|
|
|
bb45c0 |
- disk[m.group(2)] = int(m.group(1))
|
|
|
bb45c0 |
- if disk[m.group(2)] < int(m.group(1)):
|
|
|
bb45c0 |
- disk[m.group(2)] = int(m.group(1))
|
|
|
bb45c0 |
+ size_in_mb = int(m.group(1)) if m.group(2) == 'M' else round(int(m.group(1))/1024.0, 3)
|
|
|
bb45c0 |
+ if m.group(3) not in disk:
|
|
|
bb45c0 |
+ disk[m.group(3)] = size_in_mb
|
|
|
bb45c0 |
+ if disk[m.group(3)] < size_in_mb:
|
|
|
bb45c0 |
+ disk[m.group(3)] = size_in_mb
|
|
|
bb45c0 |
|
|
|
bb45c0 |
if disk:
|
|
|
bb45c0 |
summary += _('Disk Requirements:\n')
|
|
|
bb45c0 |
commit 6ea8a6cf572efa7d7601dfc8535f5cc3cd80c3bd
|
|
|
bb45c0 |
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
|
|
bb45c0 |
Date: Tue Mar 17 11:19:10 2015 +0100
|
|
|
bb45c0 |
|
|
|
bb45c0 |
Fix rounding issue in required disk space message.
|
|
|
bb45c0 |
|
|
|
bb45c0 |
diff --git a/cli.py b/cli.py
|
|
|
bb45c0 |
index cefc67e..9766f89 100755
|
|
|
bb45c0 |
--- a/cli.py
|
|
|
bb45c0 |
+++ b/cli.py
|
|
|
bb45c0 |
@@ -25,6 +25,7 @@ import sys
|
|
|
bb45c0 |
import time
|
|
|
bb45c0 |
import random
|
|
|
bb45c0 |
import logging
|
|
|
bb45c0 |
+import math
|
|
|
bb45c0 |
from optparse import OptionParser,OptionGroup,SUPPRESS_HELP
|
|
|
bb45c0 |
import rpm
|
|
|
bb45c0 |
|
|
|
bb45c0 |
@@ -501,7 +502,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
|
|
|
bb45c0 |
p = re.compile('needs (\d+)(K|M)B on the (\S+) filesystem')
|
|
|
bb45c0 |
disk = {}
|
|
|
bb45c0 |
for m in p.finditer(errstring):
|
|
|
bb45c0 |
- size_in_mb = int(m.group(1)) if m.group(2) == 'M' else round(int(m.group(1))/1024.0, 3)
|
|
|
bb45c0 |
+ size_in_mb = int(m.group(1)) if m.group(2) == 'M' else math.ceil(int(m.group(1))/1024.0)
|
|
|
bb45c0 |
if m.group(3) not in disk:
|
|
|
bb45c0 |
disk[m.group(3)] = size_in_mb
|
|
|
bb45c0 |
if disk[m.group(3)] < size_in_mb:
|