/usr/lib/python2.7/dist-packages/backup2swift/config.py is in python-backup2swift 0.8-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | # -*- coding: utf-8 -*-
"""
Copyright (C) 2013 Kouhei Maeda <mkouhei@palmtb.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import sys
if sys.version_info > (2, 6) and sys.version_info < (2, 8):
import ConfigParser as configparser
elif sys.version_info > (3, 0):
import configparser
from backup2swift import utils
def check_config(filename):
"""Check configuration file of backup2swift
Argument:
filename: config file path (default is ~/.bu2sw.conf)
"""
try:
conf = configparser.SafeConfigParser(allow_no_value=False)
except TypeError as error:
msg = "__init__() got an unexpected keyword argument 'allow_no_value'"
if str(error) == msg:
# for argparse using python 2.6
conf = configparser.SafeConfigParser()
else:
utils.logging(3, error)
conf.read(filename)
try:
auth_url = conf.get('swift', 'auth_url')
username = conf.get('swift', 'username')
password = conf.get('swift', 'password')
rotate_limit = conf.get('backup', 'rotate_limit')
except (configparser.NoSectionError, configparser.NoOptionError) as error:
# syslog.ERR is 3
utils.logging(3, error)
try:
if conf.get('swift', 'ignore_verify_ssl_certification') == 'True':
verify = False
else:
verify = True
except (configparser.NoSectionError, configparser.NoOptionError):
verify = True
try:
if conf.get('keystone', 'tenant_id'):
tenant_id = conf.get('keystone', 'tenant_id')
else:
tenant_id = None
except (configparser.NoSectionError, configparser.NoOptionError):
tenant_id = None
return auth_url, username, password, rotate_limit, verify, tenant_id
|