gui/polgengui.py: Fix sepolicy.generate import in polgengui.py

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>
This commit is contained in:
Petr Lautrbach 2017-03-17 15:09:08 +01:00 committed by stephensmalley
parent 4b27d5a365
commit 5333152934

View file

@ -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()