'Reads the settings from the cloudforms.ini file'

def read_settings(self):

    config = ConfigParser.SafeConfigParser()
    config_paths = [(os.path.dirname(os.path.realpath(__file__)) + '/cloudforms.ini'), '/etc/ansible/cloudforms.ini']
    env_value = os.environ.get('CLOUDFORMS_INI_PATH')
    if (env_value is not None):
        config_paths.append(os.path.expanduser(os.path.expandvars(env_value)))
    if self.args.debug:
        for config_path in config_paths:
            print(('Reading    from    configuration    file    [%s]' % config_path))
    config.read(config_paths)
    if config.has_option('cloudforms', 'url'):
        self.cloudforms_url = config.get('cloudforms', 'url')
    else:
        self.cloudforms_url = None
    if (not self.cloudforms_url):
        warnings.warn("No    url    specified,    expected    something    like    'https://cfme.example.com'")
    if config.has_option('cloudforms', 'username'):
        self.cloudforms_username = config.get('cloudforms', 'username')
    else:
        self.cloudforms_username = None
    if (not self.cloudforms_username):
        warnings.warn('No    username    specified,    you    need    to    specify    a    CloudForms    username.')
    if config.has_option('cloudforms', 'password'):
        self.cloudforms_pw = config.get('cloudforms', 'password')
    else:
        self.cloudforms_pw = None
    if (not self.cloudforms_pw):
        warnings.warn('No    password    specified,    you    need    to    specify    a    password    for    the    CloudForms    user.')
    if config.has_option('cloudforms', 'ssl_verify'):
        self.cloudforms_ssl_verify = config.getboolean('cloudforms', 'ssl_verify')
    else:
        self.cloudforms_ssl_verify = True
    if config.has_option('cloudforms', 'version'):
        self.cloudforms_version = config.get('cloudforms', 'version')
    else:
        self.cloudforms_version = None
    if config.has_option('cloudforms', 'limit'):
        self.cloudforms_limit = config.getint('cloudforms', 'limit')
    else:
        self.cloudforms_limit = 100
    if config.has_option('cloudforms', 'purge_actions'):
        self.cloudforms_purge_actions = config.getboolean('cloudforms', 'purge_actions')
    else:
        self.cloudforms_purge_actions = True
    if config.has_option('cloudforms', 'clean_group_keys'):
        self.cloudforms_clean_group_keys = config.getboolean('cloudforms', 'clean_group_keys')
    else:
        self.cloudforms_clean_group_keys = True
    if config.has_option('cloudforms', 'nest_tags'):
        self.cloudforms_nest_tags = config.getboolean('cloudforms', 'nest_tags')
    else:
        self.cloudforms_nest_tags = False
    try:
        group_patterns = config.get('ansible', 'group_patterns')
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
        group_patterns = '[]'
    self.group_patterns = eval(group_patterns)
    try:
        cache_path = os.path.expanduser(config.get('cache', 'path'))
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
        cache_path = '.'
    (script, ext) = os.path.splitext(os.path.basename(__file__))
    self.cache_path_hosts = (cache_path + ('/%s.hosts' % script))
    self.cache_path_inventory = (cache_path + ('/%s.inventory' % script))
    self.cache_max_age = config.getint('cache', 'max_age')
    if self.args.debug:
        print('CloudForms    settings:')
        print(('cloudforms_url                                                            =    %s' % self.cloudforms_url))
        print(('cloudforms_username                                        =    %s' % self.cloudforms_username))
        print(('cloudforms_pw                                                                =    %s' % self.cloudforms_pw))
        print(('cloudforms_ssl_verify                                =    %s' % self.cloudforms_ssl_verify))
        print(('cloudforms_version                                            =    %s' % self.cloudforms_version))
        print(('cloudforms_limit                                                    =    %s' % self.cloudforms_limit))
        print(('cloudforms_purge_actions                    =    %s' % self.cloudforms_purge_actions))
        print('Cache    settings:')
        print(('cache_max_age                                =    %s' % self.cache_max_age))
        print(('cache_path_hosts                    =    %s' % self.cache_path_hosts))
        print(('cache_path_inventory    =    %s' % self.cache_path_inventory))
