Skip to content
Snippets Groups Projects
Commit a37ef6f7 authored by Théo - Le Filament's avatar Théo - Le Filament
Browse files

fix(fetch_repos): raise an error if the git command fails

parent c6c270b5
Branches
Tags v1.4.2
No related merge requests found
......@@ -4,11 +4,12 @@
#!/usr/bin/env python3
{% endif %}
# -*- coding: utf-8 -*-
import grp
import os
import pwd
import shutil
from subprocess import call
import subprocess
import yaml
DEFAULT_PRIVATE_REPO = "/opt/odoo/private_addons"
......@@ -20,8 +21,17 @@ if os.path.isfile(REPO_FILE):
repos = yaml.safe_load(open(REPO_FILE))
if repos:
for repo in repos:
call(["git", "clone", "-b", repos[repo]["branch"], "--depth", "1", repos[repo]["url"],
DEFAULT_PRIVATE_REPO+"/"+repo])
subprocess.run(
[
"git",
"clone",
"--single-branch",
"--branch", repos[repo]["branch"],
"--depth", "1",
repos[repo]["url"],
DEFAULT_PRIVATE_REPO + "/" + repo
],
check=True)
{% if instance_odoo_setup.odoo_version == '10.0' %}
if os.path.isdir("/opt/odoo/private_addons/lf_theme"):
......
......@@ -4,11 +4,12 @@
#!/usr/bin/env python3
{% endif %}
# -*- coding: utf-8 -*-
import grp
import os
import pwd
import shutil
from subprocess import call
import subprocess
{% if instance_odoo_setup.odoo_version == '10.0' %}
from urlparse import urlsplit
{% else %}
......@@ -26,8 +27,16 @@ if os.path.isfile(REPO_ADDON_FILE):
if repos:
for url in repos:
repo = urlsplit(url).path
call(["git", "clone", "-b", repos[url]["branch"], "--depth", "1",
url, "/tmp/addon"+repo])
subprocess.run(
[
"git",
"clone",
"--single-branch",
"--branch", repos[url]["branch"],
"--depth", "1",
url, "/tmp/addon" + repo
],
check=True)
for module in repos[url]["modules"]:
shutil.move("/tmp/addon"+repo+"/"+module,
DEFAULT_PRIVATE_REPO+"/"+module)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment