| |
@@ -22,8 +22,7 @@
|
| |
import pagure.lib.link # noqa: E402
|
| |
import pagure.lib.plugins # noqa: E402
|
| |
|
| |
-
|
| |
- _config = pagure.config.config.reload_config()
|
| |
+ _config = pagure.config.config
|
| |
abspath = os.path.abspath(os.environ['GIT_DIR'])
|
| |
|
| |
|
| |
@@ -31,18 +30,22 @@
|
| |
reponame = pagure.lib.git.get_repo_name(abspath)
|
| |
username = pagure.lib.git.get_username(abspath)
|
| |
namespace = pagure.lib.git.get_repo_namespace(abspath)
|
| |
+ session = pagure.lib.create_session(_config['DB_URL'])
|
| |
if _config.get('HOOK_DEBUG', False):
|
| |
print('repo: ', reponame)
|
| |
print('user: ', username)
|
| |
print('namespace:', namespace)
|
| |
|
| |
repo = pagure.lib.get_authorized_project(
|
| |
- pagure.SESSION, reponame, user=username, namespace=namespace)
|
| |
+ session, reponame, user=username, namespace=namespace)
|
| |
if not repo:
|
| |
print('Unknown repo %s of username: %s' % (reponame, username))
|
| |
+ session.close()
|
| |
sys.exit(1)
|
| |
|
| |
- pagure.lib.plugins.get_plugin('Read the Doc')
|
| |
+ hook = pagure.lib.plugins.get_plugin('Read the Doc')
|
| |
+ hook.db_object()
|
| |
+
|
| |
# Get the list of branches
|
| |
branches = [
|
| |
branch.strip()
|
| |
@@ -75,6 +78,8 @@
|
| |
repo.rtd_hook.project_name.strip()))
|
| |
requests.post(url)
|
| |
|
| |
+ session.close()
|
| |
+
|
| |
|
| |
def main(args):
|
| |
run_as_post_receive_hook()
|
| |
Fixes #2308
We need to make sure to call db_object() on the hook so that we can access the rtd_hook attribute.
This PR also fixes some issues coming from the re architecture.