# 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):


import socket
import yaml
import os
from teuthology.util.compat import parse_qs
from copy import deepcopy
from libcloud.compute.providers import get_driver
from mock import patch, Mock, DEFAULT
from pytest import raises, mark
from teuthology.config import config
from teuthology.exceptions import MaxWhileTries
from teuthology.provision import cloud
        obj = cloud.get_provider('my_provider')
        assert not hasattr(obj, '_networks')
        assert obj.networks == list()
        assert hasattr(obj, '_networks')

    def test_security_groups(self):
        obj = cloud.get_provider('my_provider')
        self.mocks['m_ex_list_security_groups'].return_value = ['sg0', 'sg1']
        assert not hasattr(obj, '_security_groups')
        assert obj.security_groups == ['sg0', 'sg1']
        assert hasattr(obj, '_security_groups')
        self.mocks['m_ex_list_security_groups'].side_effect = AttributeError
        obj = cloud.get_provider('my_provider')
        assert not hasattr(obj, '_security_groups')
        assert obj.security_groups == list()
        assert hasattr(obj, '_security_groups')


class TestOpenStackCustomProvisioner(TestOpenStackBase):
    klass = cloud.openstack.OpenStackProvisioner
    def get_obj(
            self, name='node_name', os_type='ubuntu',
            os_version='16.04', conf=None, test_conf=None):

        if test_conf:
            yaml_file = os.path.dirname(__file__) + '/' + test_conf
            print("Reading conf: %s" % yaml_file)
            with open(yaml_file) as f:
                teuth_conf=yaml.safe_load(f)
            print(teuth_conf)

# 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/provision/cloud/test/test_openstack.py
import socket
import yaml
import os
from teuthology.util.compat import parse_qs
from copy import deepcopy
from libcloud.compute.providers import get_driver
from mock import patch, Mock, DEFAULT
from pytest import raises, mark
from teuthology.config import config
from teuthology.exceptions import MaxWhileTries
from teuthology.provision import cloud

        obj = cloud.get_provider('my_provider')
        assert not hasattr(obj, '_networks')
        assert obj.networks == list()
        assert hasattr(obj, '_networks')

    def test_security_groups(self):
        obj = cloud.get_provider('my_provider')
        self.mocks['m_ex_list_security_groups'].return_value = ['sg0', 'sg1']
        assert not hasattr(obj, '_security_groups')
        assert obj.security_groups == ['sg0', 'sg1']
        assert hasattr(obj, '_security_groups')
        self.mocks['m_ex_list_security_groups'].side_effect = AttributeError
        obj = cloud.get_provider('my_provider')
        assert not hasattr(obj, '_security_groups')
        assert obj.security_groups == list()
        assert hasattr(obj, '_security_groups')


class TestOpenStackCustomProvisioner(TestOpenStackBase):
    klass = cloud.openstack.OpenStackProvisioner
    def get_obj(
            self, name='node_name', os_type='ubuntu',
            os_version='16.04', conf=None, test_conf=None):

        if test_conf:
            yaml_file = os.path.dirname(__file__) + '/' + test_conf
            print("Reading conf: %s" % yaml_file)
            with open(yaml_file) as f:
                teuth_conf=yaml.safe_load(f)
            print(teuth_conf)

            config.libcloud = deepcopy(teuth_conf['libcloud'] or test_config)