<s> import pecan <EOL> from pecan import rest <EOL> from wsme import types <EOL> from wsmeext import pecan as wsme_pecan <EOL> from ironic_python_agent . api . controllers . v1 import base <EOL> class AgentStatus ( base . APIBase ) : <EOL> """<STR_LIT>""" <EOL> started_at = base . MultiType ( float ) <EOL> version = types . text <EOL> @ classmethod <EOL> def from_agent_status ( cls , status ) : <EOL> """<STR_LIT>""" <EOL> instance = cls ( ) <EOL> for field in ( '<STR_LIT>' , '<STR_LIT:version>' ) : <EOL> setattr ( instance , field , getattr ( status , field ) ) <EOL> return instance <EOL> class StatusController ( rest . RestController ) : <EOL> """<STR_LIT>""" <EOL> @ wsme_pecan . wsexpose ( AgentStatus ) <EOL> def get_all ( self ) : <EOL> """<STR_LIT>""" <EOL> agent = pecan . request . agent <EOL> status = agent . get_status ( ) <EOL> return AgentStatus . from_agent_status ( status ) </s>
