mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[FIX] runbot: cast markup into str before saving
When rendering templates for git configuration and nginx configuration, the templates are rendered as Markup, while a byte-like object was expected for the saving. With this commit, the Markup is casted into str and the files are saved as text files.
This commit is contained in:
parent
a051568213
commit
6902a7e242
@ -479,8 +479,8 @@ class Repo(models.Model):
|
|||||||
git_config_path = os.path.join(repo.path, 'config')
|
git_config_path = os.path.join(repo.path, 'config')
|
||||||
template_params = {'repo': repo}
|
template_params = {'repo': repo}
|
||||||
git_config = self.env['ir.ui.view']._render_template("runbot.git_config", template_params)
|
git_config = self.env['ir.ui.view']._render_template("runbot.git_config", template_params)
|
||||||
with open(git_config_path, 'wb') as config_file:
|
with open(git_config_path, 'w') as config_file:
|
||||||
config_file.write(git_config)
|
config_file.write(str(git_config))
|
||||||
_logger.info('Config updated for repo %s' % repo.name)
|
_logger.info('Config updated for repo %s' % repo.name)
|
||||||
else:
|
else:
|
||||||
_logger.info('Repo not cloned, skiping config update for %s' % repo.name)
|
_logger.info('Repo not cloned, skiping config update for %s' % repo.name)
|
||||||
|
@ -161,8 +161,8 @@ class Runbot(models.AbstractModel):
|
|||||||
content = f.read()
|
content = f.read()
|
||||||
if content != nginx_config:
|
if content != nginx_config:
|
||||||
_logger.info('reload nginx')
|
_logger.info('reload nginx')
|
||||||
with open(nginx_conf_path, 'wb') as f:
|
with open(nginx_conf_path, 'w') as f:
|
||||||
f.write(nginx_config)
|
f.write(str(nginx_config))
|
||||||
try:
|
try:
|
||||||
pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n'))
|
pid = int(open(os.path.join(nginx_dir, 'nginx.pid')).read().strip(' \n'))
|
||||||
os.kill(pid, signal.SIGHUP)
|
os.kill(pid, signal.SIGHUP)
|
||||||
|
Loading…
Reference in New Issue
Block a user