kolla-cli/kolla_cli/common/subservice.py

52 lines
1.5 KiB
Python

# Copyright(c) 2016, Oracle and/or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
from copy import copy
class SubService(object):
class_version = 1
def __init__(self, name):
self.name = name
self._groupnames = []
self._parent_servicename = None
self._vars = {}
self.version = self.__class__.class_version
def upgrade(self):
pass
def add_groupname(self, groupname):
if groupname is not None and groupname not in self._groupnames:
self._groupnames.append(groupname)
def remove_groupname(self, groupname):
if groupname in self._groupnames:
self._groupnames.remove(groupname)
def get_groupnames(self):
return copy(self._groupnames)
def set_parent_servicename(self, parent_svc_name):
self._parent_servicename = parent_svc_name
def get_parent_servicename(self):
return copy(self._parent_servicename)
def get_vars(self):
return self.vars.copy()