[virt-tools-list] [virt-manager PATCH] seclabel: add a validation for security type static

Pavel Hrdina phrdina at redhat.com
Fri May 13 17:19:34 UTC 2016


Commit 510d28e3 refactored the seclabel code and one check was lost.
Add the check back into the code.

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

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 virtinst/seclabel.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/virtinst/seclabel.py b/virtinst/seclabel.py
index 10bf4e8..02221f0 100644
--- a/virtinst/seclabel.py
+++ b/virtinst/seclabel.py
@@ -87,6 +87,11 @@ class Seclabel(XMLBuilder):
                        default_cb=_get_default_type,
                        default_name=TYPE_DEFAULT)
 
+    def validate(self):
+        if self.type == self.TYPE_STATIC and not self.label:
+            raise RuntimeError(_("A label must be specified for 'static' "
+                                 "security type."))
+
     label = XMLProperty("./label")
     imagelabel = XMLProperty("./imagelabel")
     baselabel = XMLProperty("./baselabel")
-- 
2.8.2




More information about the virt-tools-list mailing list