mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 23:21:32 +00:00
Implement checking whether directories passed exsist
This commit is contained in:
parent
49e0efa4c9
commit
e80782aa6c
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
from getpass import getuser
|
from getpass import getuser
|
||||||
|
from os.path import isdir
|
||||||
|
|
||||||
|
|
||||||
class SnapshotProvider:
|
class SnapshotProvider:
|
||||||
@ -17,12 +18,18 @@ class SnapshotProvider:
|
|||||||
'GIT_COMMITTER_EMAIL': ''
|
'GIT_COMMITTER_EMAIL': ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self._check_environment()
|
||||||
|
|
||||||
self._head_detached = False
|
self._head_detached = False
|
||||||
self._branch = 'master'
|
self._branch = 'master'
|
||||||
self._branches = [self._branch]
|
self._branches = [self._branch]
|
||||||
|
|
||||||
self._init_repo_if_needed()
|
self._init_repo_if_needed()
|
||||||
|
|
||||||
|
def _check_environment(self):
|
||||||
|
if not isdir(self.gitenv['GIT_DIR']) or not isdir(self.gitenv['GIT_WORK_TREE']):
|
||||||
|
raise EnvironmentError('Directories "directory" and "git_dir" must exist!')
|
||||||
|
|
||||||
def _init_repo_if_needed(self):
|
def _init_repo_if_needed(self):
|
||||||
if not self._repo_is_initialized():
|
if not self._repo_is_initialized():
|
||||||
self._run(('git', 'init'))
|
self._run(('git', 'init'))
|
||||||
|
Loading…
Reference in New Issue
Block a user