'Reads the settings from the libcloud.ini file'

def read_settings(self):

    config = ConfigParser.SafeConfigParser()
    libcloud_default_ini_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'libcloud.ini')
    libcloud_ini_path = os.environ.get('LIBCLOUD_INI_PATH', libcloud_default_ini_path)
    config.read(libcloud_ini_path)
    if (not config.has_section('driver')):
        raise ValueError('libcloud.ini    file    must    contain    a    [driver]    section')
    if config.has_option('driver', 'provider'):
        self.provider = config.get('driver', 'provider')
    else:
        raise ValueError('libcloud.ini    does    not    have    a    provider    defined')
    if config.has_option('driver', 'key'):
        self.key = config.get('driver', 'key')
    else:
        raise ValueError('libcloud.ini    does    not    have    a    key    defined')
    if config.has_option('driver', 'secret'):
        self.secret = config.get('driver', 'secret')
    else:
        raise ValueError('libcloud.ini    does    not    have    a    secret    defined')
    if config.has_option('driver', 'host'):
        self.host = config.get('driver', 'host')
    if config.has_option('driver', 'secure'):
        self.secure = config.get('driver', 'secure')
    if config.has_option('driver', 'verify_ssl_cert'):
        self.verify_ssl_cert = config.get('driver', 'verify_ssl_cert')
    if config.has_option('driver', 'port'):
        self.port = config.get('driver', 'port')
    if config.has_option('driver', 'path'):
        self.path = config.get('driver', 'path')
    if config.has_option('driver', 'api_version'):
        self.api_version = config.get('driver', 'api_version')
    Driver = get_driver(getattr(Provider, self.provider))
    self.conn = Driver(key=self.key, secret=self.secret, secure=self.secure, host=self.host, path=self.path)
    cache_path = config.get('cache', 'cache_path')
    self.cache_path_cache = (cache_path + '/ansible-libcloud.cache')
    self.cache_path_index = (cache_path + '/ansible-libcloud.index')
    self.cache_max_age = config.getint('cache', 'cache_max_age')
