# Path: teuthology/config.py
# def init_logging():
#     def __init__(self, yaml_path=None):
#     def load(self, conf=None):
#     def update(self, in_dict):
#     def from_dict(cls, in_dict):
#     def to_dict(self):
#     def from_str(cls, in_str):
#     def to_str(self):
#     def get(self, key, default=None):
#     def __str__(self):
#     def __repr__(self):
#     def __getitem__(self, name):
#     def __getattr__(self, name):
#     def __contains__(self, name):
#     def __setattr__(self, name, value):
#     def __delattr__(self, name):
#     def __len__(self):
#     def __iter__(self):
#     def __setitem__(self, name, value):
#     def __delitem__(self, name):
#     def __init__(self, yaml_path=None):
#     def get_ceph_cm_ansible_git_url(self):
#     def get_ceph_qa_suite_git_url(self):
#     def get_ceph_git_url(self):
#     def __init__(self, config_dict=None):
#     def _clean_config(self, config_dict):
#     def __getattr__(self, name):
#     def __setattr__(self, name, value):
#     def __repr__(self):
#     def __str__(self):
# def set_config_attr(obj):
# def _get_config_path():
# class YamlConfig(collections.MutableMapping):
# class TeuthologyConfig(YamlConfig):
# class JobConfig(YamlConfig):
# class FakeNamespace(YamlConfig):
# 
# Path: teuthology/misc.py
# def canonicalize_hostname(hostname, user='ubuntu'):
#     hostname_expr = hostname_expr_templ.format(
#         lab_domain=config.lab_domain.replace('.', '\.'))
#     match = re.match(hostname_expr, hostname)
#     if _is_ipv4(hostname) or _is_ipv6(hostname):
#         return "%s@%s" % (user, hostname)
#     if match:
#         match_d = match.groupdict()
#         shortname = match_d['shortname']
#         if user is None:
#             user_ = user
#         else:
#             user_ = match_d.get('user') or user
#     else:
#         shortname = host_shortname(hostname)
#         user_ = user
# 
#     user_at = user_.strip('@') + '@' if user_ else ''
#     domain = config.lab_domain
#     if domain and not shortname.endswith('.'):
#         domain = '.' + domain
#     ret = '{user_at}{short}{domain}'.format(
#         user_at=user_at,
#         short=shortname,
#         domain=domain,
#     )
#     return ret


import logging
import requests
import re
import time
from teuthology.config import config
from teuthology.contextutil import safe_while
from teuthology.misc import canonicalize_hostname
from teuthology.util.compat import  HTTPError
# Provisioner configuration section description see in
# docs/siteconfig.rst

def enabled(warn=False):
    """
    Check for required Pelagos settings

    :param warn: Whether or not to log a message containing unset parameters
    :returns: True if they are present; False if they are not
    """
    conf = config.get(config_section, dict())
    params = ['endpoint', 'machine_types']
    unset = [_ for _ in params if not conf.get(_)]
    if unset and warn:
        log.warning(
            "Pelagos is disabled; set the following config options to enable: %s",
            ' '.join(unset),
        )
    return (unset == [])


def get_types():
    """
    Fetch and parse config.pelagos['machine_types']

    :returns: The list of Pelagos-configured machine types. An empty list if Pelagos is
              not configured.
    """
    if not enabled():
        return []

# Path: teuthology/config.py
# def init_logging():
#     def __init__(self, yaml_path=None):
#     def load(self, conf=None):
#     def update(self, in_dict):
#     def from_dict(cls, in_dict):
#     def to_dict(self):
#     def from_str(cls, in_str):
#     def to_str(self):
#     def get(self, key, default=None):
#     def __str__(self):
#     def __repr__(self):
#     def __getitem__(self, name):
#     def __getattr__(self, name):
#     def __contains__(self, name):
#     def __setattr__(self, name, value):
#     def __delattr__(self, name):
#     def __len__(self):
#     def __iter__(self):
#     def __setitem__(self, name, value):
#     def __delitem__(self, name):
#     def __init__(self, yaml_path=None):
#     def get_ceph_cm_ansible_git_url(self):
#     def get_ceph_qa_suite_git_url(self):
#     def get_ceph_git_url(self):
#     def __init__(self, config_dict=None):
#     def _clean_config(self, config_dict):
#     def __getattr__(self, name):
#     def __setattr__(self, name, value):
#     def __repr__(self):
#     def __str__(self):
# def set_config_attr(obj):
# def _get_config_path():
# class YamlConfig(collections.MutableMapping):
# class TeuthologyConfig(YamlConfig):
# class JobConfig(YamlConfig):
# class FakeNamespace(YamlConfig):
# 
# Path: teuthology/misc.py
# def canonicalize_hostname(hostname, user='ubuntu'):
#     hostname_expr = hostname_expr_templ.format(
#         lab_domain=config.lab_domain.replace('.', '\.'))
#     match = re.match(hostname_expr, hostname)
#     if _is_ipv4(hostname) or _is_ipv6(hostname):
#         return "%s@%s" % (user, hostname)
#     if match:
#         match_d = match.groupdict()
#         shortname = match_d['shortname']
#         if user is None:
#             user_ = user
#         else:
#             user_ = match_d.get('user') or user
#     else:
#         shortname = host_shortname(hostname)
#         user_ = user
# 
#     user_at = user_.strip('@') + '@' if user_ else ''
#     domain = config.lab_domain
#     if domain and not shortname.endswith('.'):
#         domain = '.' + domain
#     ret = '{user_at}{short}{domain}'.format(
#         user_at=user_at,
#         short=shortname,
#         domain=domain,
#     )
#     return ret


# Path: teuthology/provision/pelagos.py
import logging
import requests
import re
import time
from teuthology.config import config
from teuthology.contextutil import safe_while
from teuthology.misc import canonicalize_hostname
from teuthology.util.compat import  HTTPError

# Provisioner configuration section description see in
# docs/siteconfig.rst

def enabled(warn=False):
    """
    Check for required Pelagos settings

    :param warn: Whether or not to log a message containing unset parameters
    :returns: True if they are present; False if they are not
    """
    conf = config.get(config_section, dict())
    params = ['endpoint', 'machine_types']
    unset = [_ for _ in params if not conf.get(_)]
    if unset and warn:
        log.warning(
            "Pelagos is disabled; set the following config options to enable: %s",
            ' '.join(unset),
        )
    return (unset == [])


def get_types():
    """
    Fetch and parse config.pelagos['machine_types']

    :returns: The list of Pelagos-configured machine types. An empty list if Pelagos is
              not configured.
    """
    if not enabled():
        return []

    conf = config.get(config_section, dict())