<s> """<STR_LIT>""" <EOL> from lmi . scripts import selinux as sel <EOL> from lmi . scripts . common import command <EOL> class Show ( command . LmiShowInstance ) : <EOL> DYNAMIC_PROPERTIES = True <EOL> def execute ( self , ns ) : <EOL> columns = [ <EOL> ( '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , lambda i : sel . state2str ( sel . get_service ( ns ) . SELinuxState ) ) , <EOL> ( '<STR_LIT>' , lambda i : sel . state2str ( sel . get_service ( ns ) . SELinuxDefaultState ) ) , <EOL> ] <EOL> return columns , sel . get_service ( ns ) <EOL> class ListElements ( command . LmiInstanceLister ) : <EOL> DYNAMIC_PROPERTIES = True <EOL> def execute ( self , ns , booleans , ports ) : <EOL> if booleans : <EOL> columns = [ <EOL> ( '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' ) , <EOL> ] <EOL> kind = "<STR_LIT>" <EOL> if ports : <EOL> columns = [ <EOL> ( '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' ) , <EOL> ] <EOL> kind = "<STR_LIT>" <EOL> def generator ( ) : <EOL> for sel_ele_inst in sel . list_elements ( ns , kind ) : <EOL> yield sel_ele_inst <EOL> return columns , generator ( ) <EOL> class SetState ( command . LmiCheckResult ) : <EOL> CALLABLE = sel . set_state <EOL> OPT_NO_UNDERSCORES = True <EOL> EXPECT = None <EOL> class SetBoolean ( command . LmiCheckResult ) : <EOL> CALLABLE = sel . set_boolean <EOL> OPT_NO_UNDERSCORES = True <EOL> EXPECT = None <EOL> class SetPort ( command . LmiCheckResult ) : <EOL> CALLABLE = sel . set_port <EOL> OPT_NO_UNDERSCORES = True <EOL> EXPECT = None <EOL> class GetLabel ( command . LmiCheckResult ) : <EOL> CALLABLE = sel . get_file_label <EOL> OPT_NO_UNDERSCORES = True <EOL> EXPECT = None <EOL> class SetLabel ( command . LmiCheckResult ) : <EOL> CALLABLE = sel . set_file_label <EOL> OPT_NO_UNDERSCORES = True <EOL> EXPECT = None <EOL> class Restore ( command . LmiCheckResult ) : <EOL> CALLABLE = sel . restore <EOL> OPT_NO_UNDERSCORES = True <EOL> EXPECT = None <EOL> Selinux = command . register_subcommands ( <EOL> '<STR_LIT>' , __doc__ , <EOL> { '<STR_LIT>' : Show , <EOL> '<STR_LIT:list>' : ListElements , <EOL> '<STR_LIT>' : SetState , <EOL> '<STR_LIT>' : SetBoolean , <EOL> '<STR_LIT>' : SetPort , <EOL> '<STR_LIT>' : GetLabel , <EOL> '<STR_LIT>' : SetLabel , <EOL> '<STR_LIT>' : Restore , <EOL> } , <EOL> ) </s>
