21267571 solver traceback because Set requires its items to be hashable s12b89
authorErik Trauschke <Erik.Trauschke@oracle.com>
Mon, 07 Dec 2015 14:08:55 -0800
changeset 3291 37027f7ff904
parent 3280 99b5adc29aca
child 3292 19c646650f78
21267571 solver traceback because Set requires its items to be hashable
src/modules/client/pkg_solver.py
src/tests/cli/t_change_variant.py
--- a/src/modules/client/pkg_solver.py	Wed Nov 11 18:06:15 2015 -0800
+++ b/src/modules/client/pkg_solver.py	Mon Dec 07 14:08:55 2015 -0800
@@ -2938,9 +2938,10 @@
                                             "image architecture")
                                 else:
                                         reason = (N_("Package supports image "
-                                            "variant {0}=[{1}] but doesn't "
-                                            "support this image's {0} ({2})"),
-                                            (v, vd[v], self.__variants[v]))
+                                            "variant {0}={1} but doesn't "
+                                            "support this image's {0}={2}"),
+                                            (v, str(vd[v]),
+                                            str(self.__variants[v])))
 
                                 self.__trim(fmri, _TRIM_VARIANT, reason)
                 return reason == ""
--- a/src/tests/cli/t_change_variant.py	Wed Nov 11 18:06:15 2015 -0800
+++ b/src/tests/cli/t_change_variant.py	Mon Dec 07 14:08:55 2015 -0800
@@ -515,6 +515,16 @@
                 self.assertEqualParsable(self.output, change_variants=[
                     ["variant.arch", "i386"]])
 
+        def test_invalid_variant(self):
+                """Test that invalid input is handled appropriately"""
+
+                self.image_create(self.rurl, variants={
+                    "variant.arch": "i386",
+                    "variant.opensolaris.zone": "nonglobal"
+                })
+                self.pkg("install pkg_shared")
+                self.pkg("change-variant variant.opensolaris.zone=bogus")
+
 
 class TestPkgChangeVariantPerTestRepo(pkg5unittest.SingleDepotTestCase):
         """A separate test class is needed because these tests modify packages