1
0
mirror of https://github.com/IEEE-SB-Passau/pelican-deployment-system.git synced 2017-09-06 16:35:38 +02:00

fix repo creation

This commit is contained in:
2016-06-13 01:51:39 +02:00
parent b893e05255
commit 62e13d7edb
2 changed files with 10 additions and 2 deletions

View File

@@ -57,6 +57,9 @@ class DeploymentRunner:
self._update_build_repository() self._update_build_repository()
def _update_build_repository(self): def _update_build_repository(self):
if not self.build_repo_path.exists():
self.build_repo_path.mkdir(parents=True)
repo = Repo(str(self.build_repo_path)) repo = Repo(str(self.build_repo_path))
if not repo.is_repo(): if not repo.is_repo():
if self.build_repo_path.is_dir() and \ if self.build_repo_path.is_dir() and \
@@ -67,8 +70,9 @@ class DeploymentRunner:
raise RuntimeException(("non-empty {} exists but not a" raise RuntimeException(("non-empty {} exists but not a"
"valid git repository!").format(self.build_repo_path)) "valid git repository!").format(self.build_repo_path))
else: else:
log.info("Build repository %s not there, cloneing", e) log.info("Build repository %s not there, cloning",
result = repo.clone("--branch", "self.git_branch", self.build_repo_path)
result = repo.clone("--branch", self.git_branch,
"--depth", "1", self.clone_url, ".") "--depth", "1", self.clone_url, ".")
log_git(result) log_git(result)

View File

@@ -1,4 +1,5 @@
import os import os
import errno
import shlex import shlex
from collections import namedtuple from collections import namedtuple
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
@@ -13,6 +14,9 @@ class GitCommandError(Exception):
class Repo: class Repo:
def __init__(self, repo_dir, git_cmd="git", default_timeout=None): def __init__(self, repo_dir, git_cmd="git", default_timeout=None):
if not os.path.exists(repo_dir):
raise FileNotFoundError(errno.ENOENT, "Path, does not exist",
repo_dir)
self.repo_dir = repo_dir self.repo_dir = repo_dir
self.git_cmd = git_cmd self.git_cmd = git_cmd
self.default_timeout = default_timeout self.default_timeout = default_timeout