Sindbad~EG File Manager
3
x?agb � @ sr d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z G d d
� d
ee
�ZG dd� de �Zd
S )zz
Service - Abstract superclass for services
$Id: //eng/vdo-releases/aluminum/src/python/vdo/vdomgmnt/Service.py#2 $
� )�absolute_import)�division)�print_function)�unicode_literals� )�
ExitStatus)�
YAMLObjectc s* e Zd ZdZd� fdd� Zdd� Z� ZS )�ServiceErrorz!Base class for service errors.
� c s t t| �j||� || _d S )N)�superr �__init__�_msg)�self�msg�args�kwargs)� __class__� �/usr/lib/python3.6/Service.pyr , s zServiceError.__init__c C s | j S )N)r
)r r r r �__str__1 s zServiceError.__str__)r
)�__name__�
__module__�__qualname__�__doc__r r �
__classcell__r r )r r r ! s r c s� e Zd ZdZdZedd� �Zdd� Zedd� �Z e� fd d
��Z
� fdd�Ze� fd
d��Z� fdd�Z
dd� Zdd� Z� ZS )�ServiceaE Superclass 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
z!Servicec C s g S )z>Returns a list of keys to be stored in the configuration file.r r r r r �getKeysV s zService.getKeysc C s | j S )z+Returns the name of a Service, as a string.)�_name)r r r r �getName\ s zService.getNamec C s dg}|j | j� � |S )N�name)�extendr )r �keysr r r �_yamlAttributeKeysc s zService._yamlAttributeKeysc s t t| �j}| j� |d<