diff mbox

[1/4] gui/polgengui.py: Fix sepolicy.generate import in polgengui.py

Message ID 20180214095337.1945-2-plautrba@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Petr Lautrbach Feb. 14, 2018, 9:53 a.m. UTC
b43991f9 added direct import of sepolicy but it forgot to import
sepolicy.generate and didn't change use of generate to sepolicy.generate

Fixes:

Traceback (most recent call last):
  File "/usr/bin/selinux-polgengui", line 778, in <module>
    app = childWindow()
  File "/usr/bin/selinux-polgengui", line 205, in __init__
    self.all_types = sepolicy.generate.get_all_types()
AttributeError: 'module' object has no attribute 'generate'

Traceback (most recent call last):
  File "/usr/share/system-config-selinux/polgengui.py", line 365, in forward
    if self.on_in_net_page_next():
  File "/usr/share/system-config-selinux/polgengui.py", line 701, in on_in_net_page_next
    generate.verify_ports(self.in_tcp_entry.get_text())
NameError: global name 'generate' is not defined

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
 gui/polgengui.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/gui/polgengui.py b/gui/polgengui.py
index af6b822b..09723278 100644
--- a/gui/polgengui.py
+++ b/gui/polgengui.py
@@ -34,7 +34,9 @@  except ValueError as e:
     sys.stderr.write("%s: %s\n" % (e.__class__.__name__, str(e)))
     sys.exit(1)
 
+import sepolicy.generate
 import sepolicy.interface
+
 try:
     from subprocess import getstatusoutput
 except ImportError:
@@ -696,16 +698,16 @@  class childWindow:
 
     def on_in_net_page_next(self, *args):
         try:
-            generate.verify_ports(self.in_tcp_entry.get_text())
-            generate.verify_ports(self.in_udp_entry.get_text())
+            sepolicy.generate.verify_ports(self.in_tcp_entry.get_text())
+            sepolicy.generate.verify_ports(self.in_udp_entry.get_text())
         except ValueError as e:
             self.error(e.message)
             return True
 
     def on_out_net_page_next(self, *args):
         try:
-            generate.verify_ports(self.out_tcp_entry.get_text())
-            generate.verify_ports(self.out_udp_entry.get_text())
+            sepolicy.generate.verify_ports(self.out_tcp_entry.get_text())
+            sepolicy.generate.verify_ports(self.out_udp_entry.get_text())
         except ValueError as e:
             self.error(e.message)
             return True
@@ -741,7 +743,7 @@  class childWindow:
             if exe == "":
                 self.error(_("You must enter a executable"))
                 return True
-            policy = generate.policy(name, self.get_type())
+            policy = sepolicy.generate.policy(name, self.get_type())
             policy.set_program(exe)
             policy.gen_writeable()
             policy.gen_symbols()