<s> import web <EOL> from karesansui . lib . rest import Rest , auth <EOL> from karesansui . lib . const import SERVICE_XML_FILE <EOL> from karesansui . lib . service . config import ServiceConfigParam , ServiceXMLGenerator <EOL> from karesansui . lib . service . sysvinit_rh import SysVInit_RH <EOL> class HostBy1Service ( Rest ) : <EOL> @ auth <EOL> def _GET ( self , * param , ** params ) : <EOL> host_id = self . chk_hostby1 ( param ) <EOL> if host_id is None : return web . notfound ( ) <EOL> config = ServiceConfigParam ( SERVICE_XML_FILE ) <EOL> config . load_xml_config ( ) <EOL> displays = [ ] <EOL> for service in config . get_services ( ) : <EOL> sysv = SysVInit_RH ( service [ '<STR_LIT>' ] , service [ '<STR_LIT>' ] ) <EOL> display = { <EOL> '<STR_LIT:name>' : service [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : service [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : service [ '<STR_LIT>' ] , <EOL> '<STR_LIT:description>' : service [ '<STR_LIT>' ] , <EOL> '<STR_LIT:status>' : sysv . status ( ) , <EOL> '<STR_LIT>' : sysv . onboot ( ) , <EOL> } <EOL> displays . append ( display ) <EOL> self . view . services = displays <EOL> return True <EOL> urls = ( <EOL> '<STR_LIT>' , HostBy1Service , <EOL> ) </s>
