�
.�t_c@s_dZddlmZddlmZmZdeefd��YZdefd��YZd S(
s{
Service - Abstract superclass for services
$Id: //eng/vdo-releases/magnesium/src/python/vdo/vdomgmnt/Service.py#2 $
i(t
ExitStatusi����(tLoggert
YAMLObjecttServiceErrorcBs#eZdZdd�Zd�ZRS(s!Base class for service errors.
tcOs&tt|�j||�||_dS(N(tsuperRt__init__t_msg(tselftmsgtargstkwargs((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyR(scCs|jS(N(R(R((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyt__str__-s(t__name__t
__module__t__doc__RR(((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyRs tServicecBs�eZdZejejd�ZdZed��Z d�Z
ed��Zed��Z
d�Zed��Zd �Zd
�Zd�ZRS(sESuperclass for services.
Every subclass of Service controls a service (such as an Albireo
index or a VDO target) managed by this command. The create/remove/
have methods are one-time operations that do things like 'albcreate'
that are persistent, while start/stop/running are used to control
the availability of the service, either manually or automatically at
system boot and shutdown. The control commands are idempotent, and
return values specified as exit codes for /etc/init.d scripts
specified in the LSB.
Methods:
getName (method on Service) returns a name for the object
create creates the service; done once, paired with 'remove'
remove removes the service
have returns True if the service has been created
start starts the service; idempotent; run at system boot
stop stops the service; idempotent; run at shutdown
running returns True if the service is running
getKeys returns a list of the keys to be stored in the
configuration file
status returns the status of the service in YAML format
s.Serviceu!ServicecCsgS(s>Returns a list of keys to be stored in the configuration file.((((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pytgetKeysSscCs|jS(s+Returns the name of a Service, as a string.(t_name(R((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pytgetNameYscCs dg}|j|j��|S(Ntname(textendR(Rtkeys((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyt_yamlAttributeKeys`s cCs&tt|�j}|j�|d<|S(NR(RRt _yamlDataR(Rtdata((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyRgscCs'tt|�j|�|d|_dS(NR(RRt_yamlSetAttributesR(Rt
attributes((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyRnscCs&tt|�j}|jdg�|S(NR(RRt_yamlSpeciallyHandledAttributesR(Rtspecials((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyRsscCs tt|�j�||_dS(N(RRRR(RR((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyRzscCsdjt|�j|j��S(Ns{0}({1})(tformatttypeR
R(R((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyRscCs|jd�S(svReturns a boolean indicating if the entry represented by 'key' from the
instance's __dict__ should be included in the __repr__ result.
Arguments:
key (str): key from instance's __dict__
Returns:
bool: True, if the __dict__ entry with the specified key should be
included in the __repr__ result
False, otherwise
t_(t
startswith(Rtkey((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyt_reprAttribute�s(R
RRRt getLoggertmynametlogtyaml_tagtstaticmethodRRtpropertyRRRRRRR#(((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyR5s N( RRRtutilsRRt ExceptionRR(((s8/usr/lib/python2.7/site-packages/vdo/vdomgmnt/Service.pyt<module>s |