Skip to content

[UPD]runbot:Connect Database with master runbot setting, not currenct linux user account #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions runbot/runbot.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,13 @@ def fqdn():
def local_pgadmin_cursor():
cnx = None
try:
cnx = psycopg2.connect("dbname=postgres")
cnx.autocommit = True # required for admin commands
cnx = psycopg2.connect(database='postgres',
user=config.get('db_user'),
password=config.get('db_password'),
host=config.get('db_host'),
port=config.get('db_port')
)
cnx.autocommit = True # required for admin commands
yield cnx.cursor()
finally:
if cnx: cnx.close()
Expand Down Expand Up @@ -595,9 +600,9 @@ def create(self, cr, uid, values, context=None):

# detect duplicate
domain = [
('repo_id','=',build.repo_id.duplicate_id.id),
('name', '=', build.name),
('duplicate_id', '=', False),
('repo_id','=',build.repo_id.duplicate_id.id),
('name', '=', build.name),
('duplicate_id', '=', False),
'|', ('result', '=', False), ('result', '!=', 'skipped')
]
duplicate_ids = self.search(cr, uid, domain, context=context)
Expand Down Expand Up @@ -868,6 +873,11 @@ def cmd(self, cr, uid, ids, context=None):
server_path,
"--xmlrpc-port=%d" % build.port,
]
# add db connection info
cmd.append('--db_host=%s' % config.get('db_host'))
cmd.append('--db_port=%s' % config.get('db_port'))
cmd.append('--db_user=%s' % config.get('db_user'))
cmd.append('--db_password=%s' % config.get('db_password'))
# options
if grep(build.server("tools/config.py"), "no-xmlrpcs"):
cmd.append("--no-xmlrpcs")
Expand Down Expand Up @@ -1225,7 +1235,7 @@ def repo(self, repo=None, search='', limit='100', refresh='', **post):
repo_ids = repo_obj.search(cr, uid, [])
repos = repo_obj.browse(cr, uid, repo_ids)
if not repo and repos:
repo = repos[0]
repo = repos[0]

context = {
'repos': repos,
Expand Down