Exemple #1
0
#    License for the specific language governing permissions and limitations
#    under the License.

import abc
import base64

import six

from argus.backends import base as base_backend
from argus.backends.tempest import manager as api_manager
from argus.backends import windows
from argus import config as argus_config
from argus import log as argus_log
from argus import util

with util.restore_excepthook():
    from tempest.common import waiters

CONFIG = argus_config.CONFIG
LOG = argus_log.LOG

# Starting size as number of lines and tolerance.
OUTPUT_SIZE = 128


# pylint: disable=abstract-method
@six.add_metaclass(abc.ABCMeta)
class BaseTempestBackend(base_backend.CloudBackend):
    """Base class for back-ends built on top of Tempest.

    :param name:
#
#    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 contextlib
import os
import tempfile

from argus import exceptions
from argus import log as argus_log
from argus import util

with util.restore_excepthook():
    from tempest import clients
    from tempest.common import credentials_factory as credentials
    from tempest.common import waiters


OUTPUT_STATUS_OK = 200
OUTPUT_SIZE = 128
OUTPUT_EPSILON = int(OUTPUT_SIZE / 10)
LOG = argus_log.LOG


@contextlib.contextmanager
def _create_tempfile(content):
    fd, path = tempfile.mkstemp()
    os.write(fd, content.encode())