Exemple #1
0
class Config(object):
    DEBUG = False
    TESTING = False
    SECRET_KEY = 'NOT_A_RANDOM_STRING'
    SQLALCHEMY_DATABASE_URI = dburl
    OPENID_ENABLED = str2bool(config.get("openid.enabled", "false"))
    OPENID_FS_STORE = os.path.join(paths["spool"], "openid_store")
    OPENID_PRIVILEGED_TEAMS = map(lambda s: s.strip(),
                                  config.get("openid.privileged_teams", "").split(","))
    PROXY_SETUP = False
    MAX_CONTENT_LENGTH = int(config["dumpdir.maxdumpdirsize"])
    RSTPAGES_SRC = os.path.join(WEBFAF_DIR, "templates")
    RSTPAGES_RST_SETTINGS = {'initial_header_level': 3}
    ADMINS = config.get("mail.admins", "").split(",")
    MAIL_SERVER = config.get("mail.server", "localhost")
    MAIL_PORT = config.get("mail.port", "25")
    MAIL_USERNAME = config.get("mail.username", None)
    MAIL_PASSWORD = config.get("mail.password", None)
    BRAND_TITLE = config.get("hub.brand_title", "FAF")
    BRAND_SUBTITLE = config.get("hub.brand_subtitle", "Fedora Analysis Framework")
    CACHE_TYPE = config.get("cache.type", "simple")
    MEMCACHED_HOST = config.get("cache.memcached_host", None)
    MEMCACHED_PORT = config.get("cache.memcached_port", None)
    MEMCACHED_KEY_PREFIX = config.get("cache.memcached_key_prefix", None)
    EVERYONE_IS_MAINTAINER = str2bool(config.get("hub.everyone_is_maintainer", "false"))
    EVERYONE_IS_ADMIN = str2bool(config.get("hub.everyone_is_admin", "false"))
    FEDMENU_URL = config.get("hub.fedmenu_url", None)
    FEDMENU_DATA_URL = config.get("hub.fedmenu_data_url", None)
Exemple #2
0
class Config(object):
    DEBUG = False
    TESTING = False
    SECRET_KEY = 'NOT_A_RANDOM_STRING'
    SQLALCHEMY_DATABASE_URI = dburl
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    OPENID_ENABLED = str2bool(config.get("openid.enabled", "false"))
    OPENID_FS_STORE = os.path.join(paths["spool"], "openid_store")
    OPENID_PRIVILEGED_TEAMS = [
        s.strip() for s in config.get("openid.privileged_teams", "").split(",")
    ]
    PROXY_SETUP = False
    MAX_CONTENT_LENGTH = int(config["dumpdir.maxdumpdirsize"])
    TEMPLATES_DIR = os.path.join(WEBFAF_DIR, "templates")
    ADMINS = config.get("mail.admins", "").split(",")
    MAIL_SERVER = config.get("mail.server", "localhost")
    MAIL_PORT = config.get("mail.port", "25")
    MAIL_USERNAME = config.get("mail.username", None)
    MAIL_PASSWORD = config.get("mail.password", None)
    MAIL_FROM = config.get("mail.from", 'no-reply@' + MAIL_SERVER)
    BRAND_TITLE = config.get("hub.brand_title", "ABRT")
    BRAND_SUBTITLE = config.get("hub.brand_subtitle", "Analytics")
    CACHE_TYPE = config.get("cache.type", "simple")
    MEMCACHED_HOST = config.get("cache.memcached_host", None)
    MEMCACHED_PORT = config.get("cache.memcached_port", None)
    MEMCACHED_KEY_PREFIX = config.get("cache.memcached_key_prefix", None)
    EVERYONE_IS_MAINTAINER = str2bool(
        config.get("hub.everyone_is_maintainer", "false"))
    EVERYONE_IS_ADMIN = str2bool(config.get("hub.everyone_is_admin", "false"))
    FEDMENU_URL = config.get("hub.fedmenu_url", None)
    FEDMENU_DATA_URL = config.get("hub.fedmenu_data_url", None)
    THROTTLING_RATE = int(config.get("throttle.rate", 1))
    THROTTLING_TIMEFRAME = int(config.get("throttle.timeframe", 30))
    THROTTLING_BURST = int(config.get("throttle.burst", 1))
    FAF_VERSION = pyfaf.__version__
Exemple #3
0
    def __init__(self):
        super(SaveReports, self).__init__()
        save_unknown_components = str2bool(config.get(
            "save-reports.save_unknown_components", "false"))

        basedir_keys = ["ureport.directory", "report.spooldirectory"]
        self.load_config_to_self("basedir", basedir_keys, "/var/spool/faf/")

        self.load_config_to_self("create_components",
                                 ["ureport.createcomponents"],
                                 save_unknown_components, callback=str2bool)

        # Instance of 'SaveReports' has no 'basedir' member
        # pylint: disable-msg=E1101

        self.dir_report = paths["reports"]
        self.dir_report_incoming = paths["reports_incoming"]
        self.dir_report_saved = paths["reports_saved"]
        self.dir_report_deferred = paths["reports_deferred"]

        self.dir_attach = paths["attachments"]
        self.dir_attach_incoming = paths["attachments_incoming"]
        self.dir_attach_saved = paths["attachments_saved"]
        self.dir_attach_deferred = paths["attachments_deferred"]

        try:
            ensure_dirs([self.dir_report_incoming, self.dir_report_saved,
                         self.dir_report_deferred, self.dir_attach_incoming,
                         self.dir_attach_saved, self.dir_attach_deferred])
        except FafError as ex:
            self.log_error("Required directories can't be created: {0}"
                           .format(str(ex)))
            raise
Exemple #4
0
Fichier : web.py Projet : abrt/faf
def require_https():
    """
    Return if web server requires https (default true)
    """

    if webfaf_installed():
        from pyfaf.utils.parse import str2bool
        return str2bool(config.get("hub.require_https", "true"))

    logging.warning("Unable to get require https option, webfaf not available")
    return True
Exemple #5
0
def require_https() -> bool:
    """
    Return if web server requires https (default true)
    """

    if webfaf_installed():
        from pyfaf.utils.parse import str2bool
        return str2bool(config.get("hub.require_https", "true"))

    logging.warning("Unable to get require https option, webfaf not available")
    return True
Exemple #6
0
class ProductionConfig(Config):
    DEBUG = str2bool(config["hub.debug"])
    PROXY_SETUP = str2bool(config.get("hub.proxy_setup", "false"))
    SECRET_KEY = config["hub.secret_key"]
Exemple #7
0
# (at your option) any later version.
#
# faf 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 faf.  If not, see <http://www.gnu.org/licenses/>.

from pyfaf.config import config
from pyfaf.utils.parse import str2bool

fedmsg_name = config.get("fedmsg.name", "fedora-infrastructure")
fedmsg_environment = config.get("fedmsg.environment", "dev")
notify_reports = str2bool(config.get("fedmsg.realtime_reports", "false"))
notify_problems = str2bool(config.get("fedmsg.realtime_problems", "false"))

if notify_reports or notify_problems:
    from sqlalchemy import event
    from . import Report
    import fedmsg
    from pyfaf.utils import web
    from pyfaf.common import log
    logger = log.getChildLogger(__name__)

    levels = tuple(10**n for n in range(7))
    fedmsg.init(name=fedmsg_name, environment=fedmsg_environment)

    @event.listens_for(Report.count, "set")
    def fedmsg_report(target, value, oldvalue, initiator):
Exemple #8
0
# 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.
#
# faf 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 faf.  If not, see <http://www.gnu.org/licenses/>.

from pyfaf.config import config
from pyfaf.utils.parse import str2bool

notify_reports = str2bool(config.get("fedmsg.realtime_reports", "false"))
notify_problems = str2bool(config.get("fedmsg.realtime_problems", "false"))

# pylint: disable=ungrouped-imports
if notify_reports or notify_problems:
    from sqlalchemy import event
    from fedora_messaging.api import publish
    from fedora_messaging.exceptions import ConnectionException, PublishReturned
    from . import Report
    from faf_schema.schema import FafReportMessage, FafProblemMessage
    from pyfaf.utils import web
    from pyfaf.common import log
    logger = log.getChildLogger(__name__)

    levels = tuple(10**n for n in range(7))
Exemple #9
0
# -*- coding: utf-8 -*-
import os
from pyfaf.config import config
from pyfaf.utils.parse import str2bool
from sqlalchemy.engine.url import _parse_rfc1738_args

# Definition of PROJECT_DIR, just for convenience:
# you can use it instead of specifying the full path
PROJECT_DIR = os.path.dirname(__file__)

DEBUG = str2bool(config["hub.debug"])
TEMPLATE_DEBUG = DEBUG

ADMINS = map(lambda x: ('', x.strip()), config["hub.admins"].split(','))

MANAGERS = ADMINS

ALLOWED_HOSTS = ["*"]

dburl = _parse_rfc1738_args(config["storage.connectstring"])
# try hard to use psycopg2
if dburl.drivername.lower() in ["postgres", "postgresql"]:
    dburl.drivername = "postgresql_psycopg2"

if dburl.drivername.lower() == 'sqlite':
    dburl.drivername += '3'

DATABASES = {
    'default': {
        # 'django.db.backends.' + {'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'}
        'ENGINE': "django.db.backends.{0}".format(dburl.drivername),
Exemple #10
0
# -*- coding: utf-8 -*-
import os
from pyfaf.config import config
from pyfaf.utils.parse import str2bool
from sqlalchemy.engine.url import _parse_rfc1738_args

# Definition of PROJECT_DIR, just for convenience:
# you can use it instead of specifying the full path
PROJECT_DIR = os.path.dirname(__file__)

DEBUG = str2bool(config["hub.debug"])
TEMPLATE_DEBUG = DEBUG

ADMINS = map(lambda x: ('', x.strip()), config["hub.admins"].split(','))

MANAGERS = ADMINS

ALLOWED_HOSTS = ["*"]

dburl = _parse_rfc1738_args(config["storage.connectstring"])
# try hard to use psycopg2
if dburl.drivername.lower() in ["postgres", "postgresql"]:
    dburl.drivername = "postgresql_psycopg2"

if dburl.drivername.lower() == 'sqlite':
    dburl.drivername += '3'

DATABASES = {
    'default': {
        # 'django.db.backends.' + {'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'}
        'ENGINE': "django.db.backends.{0}".format(dburl.drivername),