Blob Blame History Raw
From 312203fe234595cedafa1505b89d88a554de1bb7 Mon Sep 17 00:00:00 2001
In-Reply-To: <6ee28a662c511063cd5edc32b6a613aa84cff3b9.1493385541.git.phrdina@redhat.com>
References: <6ee28a662c511063cd5edc32b6a613aa84cff3b9.1493385541.git.phrdina@redhat.com>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Thu, 27 Apr 2017 12:19:53 -0400
Subject: cli: Don't double warn when skipping disk size warning (bz 1433239)

From: Cole Robinson <crobinso@redhat.com>

(cherry picked from commit 7aee124d9aed7646e6e95644909c1d1005a92d07)

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1433239

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 virtinst/cli.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/virtinst/cli.py b/virtinst/cli.py
index 5841ba33..e5097f8d 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -359,7 +359,7 @@ def set_prompt(prompt):
 
 
 def validate_disk(dev, warn_overwrite=False):
-    def _optional_fail(msg, checkname):
+    def _optional_fail(msg, checkname, warn_on_skip=True):
         do_check = get_global_state().get_validation_check(checkname)
         if do_check:
             fail(msg + (_(" (Use --check %s=off or "
@@ -367,7 +367,8 @@ def validate_disk(dev, warn_overwrite=False):
 
         logging.debug("Skipping --check %s error condition '%s'",
             checkname, msg)
-        logging.warn(msg)
+        if warn_on_skip:
+            logging.warn(msg)
 
     def check_path_exists(dev):
         """
@@ -400,7 +401,7 @@ def validate_disk(dev, warn_overwrite=False):
         isfatal, errmsg = dev.is_size_conflict()
         # The isfatal case should have already caused us to fail
         if not isfatal and errmsg:
-            _optional_fail(errmsg, "disk_size")
+            _optional_fail(errmsg, "disk_size", warn_on_skip=False)
 
     def check_path_search(dev):
         user, broken_paths = dev.check_path_search(dev.conn, dev.path)
-- 
2.12.2