'Reads the settings from the foreman.ini file'

def read_settings(self):

    config = ConfigParser.SafeConfigParser()
    config.read(self.config_paths)
    try:
        self.foreman_url = config.get('foreman', 'url')
        self.foreman_user = config.get('foreman', 'user')
        self.foreman_pw = config.get('foreman', 'password')
        self.foreman_ssl_verify = config.getboolean('foreman', 'ssl_verify')
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError) as e:
        print(('Error    parsing    configuration:    %s' % e), file=sys.stderr)
        return False
    try:
        group_patterns = config.get('ansible', 'group_patterns')
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
        group_patterns = '[]'
    self.group_patterns = json.loads(group_patterns)
    try:
        self.group_prefix = config.get('ansible', 'group_prefix')
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
        self.group_prefix = 'foreman_'
    try:
        self.want_facts = config.getboolean('ansible', 'want_facts')
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
        self.want_facts = True
    try:
        self.want_hostcollections = config.getboolean('ansible', 'want_hostcollections')
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
        self.want_hostcollections = False
    try:
        self.rich_params = config.getboolean('ansible', 'rich_params')
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
        self.rich_params = False
    try:
        self.host_filters = config.get('foreman', 'host_filters')
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
        self.host_filters = None
    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_cache = (cache_path + ('/%s.cache' % script))
    self.cache_path_inventory = (cache_path + ('/%s.index' % script))
    self.cache_path_params = (cache_path + ('/%s.params' % script))
    self.cache_path_facts = (cache_path + ('/%s.facts' % script))
    self.cache_path_hostcollections = (cache_path + ('/%s.hostcollections' % script))
    try:
        self.cache_max_age = config.getint('cache', 'max_age')
    except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
        self.cache_max_age = 60
    return True
