def test_fetch_git_sha(): result = fetch_git_sha(settings.PROJECT_ROOT) assert result is not None assert len(result) == 40 assert isinstance(result, six.string_types) assert result == check_output( 'git rev-parse --verify HEAD', shell=True, cwd=settings.PROJECT_ROOT).decode('latin1').strip()
def test_fetch_git_sha(): result = fetch_git_sha(settings.PROJECT_ROOT) assert result is not None assert len(result) == 40 assert isinstance(result, six.string_types) assert result == check_output( 'git rev-parse --verify HEAD', shell=True, cwd=settings.PROJECT_ROOT ).decode('latin1').strip()
def test_fetch_git_sha(project_root): result = fetch_git_sha(project_root) assert result is not None assert len(result) == 40 assert isinstance(result, string_types) assert result == check_output('git rev-parse --verify HEAD', shell=True, cwd=project_root).decode('latin1').strip()
def test_fetch_git_sha(project_root): result = fetch_git_sha(project_root) assert result is not None assert len(result) == 40 assert isinstance(result, string_types) assert result == check_output( 'git rev-parse --verify HEAD', shell=True, cwd=project_root ).decode('latin1').strip()
async def test_current_hash(bot_repo): branch = await bot_repo.current_branch() bot_repo.branch = branch commit = await bot_repo.current_commit() sentry_sha = fetch_git_sha(str(bot_repo.folder_path)) assert sentry_sha == commit
def get_status(): try: sha = fetch_git_sha(os.path.join(current_app.root_path, "../../")) except: sha = "no-git" json = { "data": { "sha": sha } } resp = make_response(jsonify(json), 200) resp.mimetype = "application/json" return resp
def init_app(app): # Start logging errors try: sha = fetch_git_sha(os.path.join(app.root_path, "../../")) except: sha = "no-git" release = "raremetal-server@{}".format(sha) sentry_dsn = app.config.get("SENTRY_DSN") if sentry_dsn is not None: app.config["SENTRY_CONFIG"] = {"dsn": sentry_dsn, "release": release} if app.config["SENTRY_ENV"] is not None: app.config["SENTRY_CONFIG"]["environment"] = app.config[ "SENTRY_ENV"] # This attaches sentry to current_app.extensions['sentry'] Sentry(app, register_signal=False, wrap_wsgi=False)
def get_sentry(): global sentry # Start logging errors sha = fetch_git_sha(os.path.join(current_app.root_path, "../../")) release = f"locuszoom-api@{sha}" if sentry is None: if "SENTRY_DSN" in current_app.config: print("Sentry DSN found, attaching to app") current_app.config["SENTRY_CONFIG"] = { "dsn": current_app.config["SENTRY_DSN"], "release": release, "environment": current_app.config["LZAPI_MODE"] } sentry = Sentry(current_app, register_signal=False, wrap_wsgi=False) else: print("Warning: Sentry DSN not found, skipping") else: print("Sentry already attached to app") return sentry
def test_fetch_git_sha(): result = fetch_git_sha(settings.PROJECT_ROOT) assert result is not None assert len(result) == 40 assert isinstance(result, six.string_types)