From de450497d39989ca2aaab9c1538908f0aaf97666 Mon Sep 17 00:00:00 2001 From: Farhaan Bukhsh Date: Aug 11 2016 15:49:45 +0000 Subject: [PATCH 1/2] Disable pagure ci for private repo --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index d03ae1f..d726fef 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -877,9 +877,10 @@ def add_pull_request_comment(session, request, commit, tree_id, filename, })) # Send notification to the CI server, if the comment added was a - # notification and the PR is still open + # notification and the PR is still open and project is not private if notification and request.status == 'Open' \ - and request.project.ci_hook and PAGURE_CI: + and request.project.ci_hook and PAGURE_CI \ + and not request.project.private: REDIS.publish('pagure.ci', json.dumps({ 'ci_type': request.project.ci_hook[0].ci_type, 'pr': request.to_json(public=True, with_comments=False) @@ -1254,7 +1255,8 @@ def new_pull_request(session, branch_from, ) # Send notification to the CI server - if REDIS and request.project.ci_hook and PAGURE_CI: + if REDIS and request.project.ci_hook and PAGURE_CI \ + and not request.project.private: REDIS.publish('pagure.ci', json.dumps({ 'ci_type': request.project.ci_hook[0].ci_type, 'pr': request.to_json(public=True, with_comments=False) diff --git a/pagure/ui/plugins.py b/pagure/ui/plugins.py index 9aae98a..d37e248 100644 --- a/pagure/ui/plugins.py +++ b/pagure/ui/plugins.py @@ -84,6 +84,9 @@ def view_plugin(repo, plugin, username=None, full=True): 403, 'You are not allowed to change the settings for this project') + if repo.private: + APP.config.get('DISABLED_PLUGINS', []).append('Pagure CI') + if plugin in APP.config.get('DISABLED_PLUGINS', []): flask.abort(404, 'Plugin disabled') From 84ede3d442f61e3638f4495565c886af55ab5538 Mon Sep 17 00:00:00 2001 From: Farhaan Bukhsh Date: Aug 11 2016 17:20:20 +0000 Subject: [PATCH 2/2] Fix overwriting conf file --- diff --git a/pagure/ui/plugins.py b/pagure/ui/plugins.py index d37e248..c91b51e 100644 --- a/pagure/ui/plugins.py +++ b/pagure/ui/plugins.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- """ - (c) 2014 - Copyright Red Hat Inc + (c) 2014-2016 - Copyright Red Hat Inc Authors: Pierre-Yves Chibon + Farhaan Bukhsh """ @@ -84,8 +85,8 @@ def view_plugin(repo, plugin, username=None, full=True): 403, 'You are not allowed to change the settings for this project') - if repo.private: - APP.config.get('DISABLED_PLUGINS', []).append('Pagure CI') + if repo.private and plugin == 'Pagure CI': + flask.abort(404, 'Plugin disabled') if plugin in APP.config.get('DISABLED_PLUGINS', []): flask.abort(404, 'Plugin disabled')