import binascii import os import time import unittest # pylint: disable=import-error from six.moves import urllib from argus.tests import base from argus.tests.cloud import util as test_util from argus import util DNSMASQ_NEUTRON = '/etc/neutron/dnsmasq-neutron.conf' LOG = util.get_logger() def _get_dhcp_value(key): """Get the value of an override from the dnsmasq-config file. An override will be have the format 'dhcp-option-force=key,value'. """ lookup = "dhcp-option-force={}".format(key) with open(DNSMASQ_NEUTRON) as stream: for line in stream: if not line.startswith(lookup): continue _, _, option_value = line.strip().partition("=") _, _, value = option_value.partition(",") return value.strip()
# 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. import abc import os import six from argus import config as argus_config from argus import util CONFIG = argus_config.CONFIG LOG = util.get_logger() @six.add_metaclass(abc.ABCMeta) class BaseBackend(object): """Class for managing instances The *backend* is used for building and managing an underlying instance, being it an OpenStack instance, OpenNebula instance or a containerized OS. :param name: The name of the instance that will be created. :param userdata: If any, the user-data which will be available in the instance to the corresponding cloud initialization
def __init__(self, logger_name): self._logger_name = logger_name self._snatch_handler = SnatchHandler() self._logger = util.get_logger() self._previous_level = self._logger.getEffectiveLevel()