Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Public Attributes
troubleshoot.CheckSELinux.CheckSELinux Class Reference
Inheritance diagram for troubleshoot.CheckSELinux.CheckSELinux:
Inheritance graph
[legend]
Collaboration diagram for troubleshoot.CheckSELinux.CheckSELinux:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def display
def collect_answer
def cancel_operation
def connect_signals
def disconnect_signals
def can_click_forward
def initial_vbox
 Helper functions.

Public Attributes

 answers
 op
 troubleshooter

Detailed Description

Definition at line 28 of file CheckSELinux.py.


Constructor & Destructor Documentation

def troubleshoot.CheckSELinux.CheckSELinux.__init__ (   self,
  troubleshooter 
)

Definition at line 29 of file CheckSELinux.py.

00029 
00030     def __init__ (self, troubleshooter):
00031         Question.__init__ (self, troubleshooter, "Check SELinux contexts")
00032         troubleshooter.new_page (gtk.Label (), self)


Member Function Documentation

Reimplemented from troubleshoot.base.Question.

Definition at line 79 of file CheckSELinux.py.

00079 
00080     def cancel_operation (self):
00081         self.op.cancel ()

Reimplemented from troubleshoot.base.Question.

Definition at line 76 of file CheckSELinux.py.

00076 
00077     def collect_answer (self):
00078         return self.answers

def troubleshoot.base.Question.connect_signals (   self,
  handler 
) [inherited]
Returns True if this page should be displayed, or False
if it should be skipped.

Reimplemented from troubleshoot.base.Question.

Definition at line 33 of file CheckSELinux.py.

00033 
00034     def display (self):
00035         self.answers = {}
00036         #answers = self.troubleshooter.answers
00037 
00038         RESTORECON = "/sbin/restorecon"
00039         if not os.access (RESTORECON, os.X_OK):
00040             return False
00041 
00042         try:
00043             import selinux
00044         except ImportError:
00045             return False
00046         if not selinux.is_selinux_enabled():
00047             return False
00048 
00049         paths = ["/etc/cups/", "/usr/lib/cups/", "/usr/share/cups/"]
00050         null = file ("/dev/null", "r+")
00051         parent = self.troubleshooter.get_window ()
00052         contexts = {}
00053         new_environ = os.environ.copy()
00054         new_environ['LC_ALL'] = "C"
00055         restorecon_args = [RESTORECON, "-nvR"].extend(paths)
00056         try:
00057             # Run restorecon -nvR
00058             self.op = TimedSubprocess (parent=parent,
00059                                        args=restorecon_args,
00060                                        close_fds=True,
00061                                        env=new_environ,
00062                                        stdin=null,
00063                                        stdout=subprocess.PIPE,
00064                                        stderr=null)
00065             (restorecon_stdout, restorecon_stderr, result) = self.op.run ()
00066         except:
00067             # Problem executing command.
00068             return False
00069         for line in restorecon_stdout:
00070             l = shlex.split (line)
00071             if (len (l) < 1):
00072                 continue
00073             contexts[l[2]] = l[4]
00074         self.answers['selinux_contexts'] = contexts
00075         return False

def troubleshoot.base.Question.initial_vbox (   self,
  title = '',
  text = '' 
) [inherited]

Helper functions.

Definition at line 66 of file base.py.

00066 
00067     def initial_vbox (self, title='', text=''):
00068         vbox = gtk.VBox ()
00069         vbox.set_border_width (12)
00070         vbox.set_spacing (12)
00071         if title:
00072             s = '<span weight="bold" size="larger">' + title + '</span>\n\n'
00073         else:
00074             s = ''
00075         s += text
00076         label = gtk.Label (s)
00077         label.set_alignment (0, 0)
00078         label.set_line_wrap (True)
00079         label.set_use_markup (True)
00080         vbox.pack_start (label, False, False, 0)
00081         return vbox

Here is the caller graph for this function:


Member Data Documentation

Definition at line 34 of file CheckSELinux.py.

Definition at line 57 of file CheckSELinux.py.

Reimplemented in troubleshoot.CheckPrinterSanity.CheckPrinterSanity.

Definition at line 41 of file base.py.


The documentation for this class was generated from the following file: