Ejemplo n.º 1
0
 def wrapped(*args, **kwargs):
     """
     Wrapped method
     """
     if config.getboolean('security', 'enabled'):
         app.logger.debug("Security enabled")
         return self.decorator(func)(*args, **kwargs)
     else:
         app.logger.debug("Security disabled")
         return func(*args, **kwargs)
Ejemplo n.º 2
0
 def wrapped(*args, **kwargs):
     """
     Wrapped method
     """
     if config.getboolean('security', 'enabled'):
         app.logger.debug("Security enabled")
         return self.decorator(func)(*args, **kwargs)
     else:
         app.logger.debug("Security disabled")
         return func(*args, **kwargs)
Ejemplo n.º 3
0
app = Flask(__name__)

alembic = Alembic()
alembic.init_app(app)

app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('SQLALCHEMY_DATABASE_URI',
                                                  config.get('db', 'uri'))
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

if not app.config['SQLALCHEMY_DATABASE_URI'].startswith('sqlite'):
    # SQLite doesn't support these
    app.config['SQLALCHEMY_POOL_SIZE'] = config.getint('db', 'pool_size')
    app.config['SQLALCHEMY_POOL_RECYCLE'] = 2
    app.config['SQLALCHEMY_MAX_OVERFLOW'] = 10

if config.getboolean('flask', 'propagate_exceptions'):
    app.config['PROPAGATE_EXCEPTIONS'] = True

if config.getboolean('db', 'echo_queries'):
    app.config['SQLALCHEMY_ECHO'] = True

if not config.getboolean('flask', 'strict_slashes'):
    app.url_map.strict_slashes = False

# Debug mode ignores all custom logging and should only be used in
# local testing...
if config.getboolean('flask', 'debug'):
    app.debug = True

if not app.debug:
    # If you are calling orlo.app directly rather than with the embedded
Ejemplo n.º 4
0
from flask import jsonify, request, Response, json, g
from orlo.app import app
from orlo import queries
from orlo.config import config
from orlo.exceptions import InvalidUsage
from orlo.user_auth import token_auth
from orlo.orm import db, Release, Package, PackageResult, ReleaseNote, \
    ReleaseMetadata, Platform
from orlo.util import validate_request_json, create_release, \
    validate_release_input, validate_package_input, fetch_release, \
    create_package, fetch_package, stream_json_list, str_to_bool, is_uuid
from orlo.user_auth import conditional_auth

security_enabled = config.getboolean('security', 'enabled')


@app.route('/releases', methods=['POST'])
@conditional_auth(conditional_auth(token_auth.token_required))
def post_releases():
    """
    Create a release - the first step in a deployment

    :<json string user: User that is performing the release
    :<json string team: The development team responsible for this release
    :<json array platforms: List of platforms receiving the release
    :<json array references: List of external references, e.g. Jira ticket
    :>json string id: UUID reference to the created release
    :reqheader Content-Type: Must be application/json
    :status 200: Release was created successfully
    :status 400: Invalid request
Ejemplo n.º 5
0
Archivo: releases.py Proyecto: al4/orlo
from flask import jsonify, request, Response, json, g
from orlo.app import app
from orlo import queries
from orlo.config import config
from orlo.exceptions import InvalidUsage
from orlo.user_auth import token_auth
from orlo.orm import db, Release, Package, PackageResult, ReleaseNote, \
    ReleaseMetadata, Platform
from orlo.util import validate_request_json, create_release, \
    validate_release_input, validate_package_input, fetch_release, \
    create_package, fetch_package, stream_json_list, str_to_bool, is_uuid
from orlo.deploy import ShellDeploy
from orlo.user_auth import conditional_auth

security_enabled = config.getboolean('security', 'enabled')


@app.route('/releases', methods=['POST'])
@conditional_auth(conditional_auth(token_auth.token_required))
def post_releases():
    """
    Create a release - the first step in a deployment

    :<json string user: User that is performing the release
    :<json string team: The development team responsible for this release
    :<json array platforms: List of platforms receiving the release
    :<json array references: List of external references, e.g. Jira ticket
    :>json string id: UUID reference to the created release
    :reqheader Content-Type: Must be application/json
    :status 200: Release was created successfully
    :status 400: Invalid request
Ejemplo n.º 6
0
Archivo: app.py Proyecto: al4/orlo
app = Flask(__name__)

alembic = Alembic()
alembic.init_app(app)

app.config['SQLALCHEMY_DATABASE_URI'] = config.get('db', 'uri')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

if 'sqlite' not in app.config['SQLALCHEMY_DATABASE_URI']:
    # SQLite doesn't support these
    app.config['SQLALCHEMY_POOL_SIZE'] = config.getint('db', 'pool_size')
    app.config['SQLALCHEMY_POOL_RECYCLE'] = 2
    app.config['SQLALCHEMY_MAX_OVERFLOW'] = 10

if config.getboolean('flask', 'propagate_exceptions'):
    app.config['PROPAGATE_EXCEPTIONS'] = True

if config.getboolean('db', 'echo_queries'):
    app.config['SQLALCHEMY_ECHO'] = True

if not config.getboolean('main', 'strict_slashes'):
    app.url_map.strict_slashes = False

# Debug mode ignores all custom logging and should only be used in
# local testing...
if config.getboolean('flask', 'debug'):
    app.debug = True

if not app.debug:
    # If you are calling orlo.app directly rather than with the embedded