[script][backup]reindent
This commit is contained in:
parent
e602f21981
commit
231c89f56c
@ -14,14 +14,14 @@ EMAIL_SERVER = "localhost"
|
||||
EMAIL_ORI = "backup@mathux.dyndns.org"
|
||||
|
||||
|
||||
def sendMail(stdOut,stdErr,repo):
|
||||
email_text = "Error when sync "+repo+"\n"
|
||||
email_text += "stdOut :"+stdOut+"\n\n"
|
||||
email_text += "stdErr :"+stdErr+"\n\n"
|
||||
def sendMail(stdOut, stdErr, repo):
|
||||
email_text = "Error when sync " + repo + "\n"
|
||||
email_text += "stdOut :" + stdOut + "\n\n"
|
||||
email_text += "stdErr :" + stdErr + "\n\n"
|
||||
|
||||
msg = MIMEText(email_text)
|
||||
msg['Subject'] = "Erreur Synchro" +repo
|
||||
msg['From'] = EMAIL_ORI
|
||||
msg = MIMEText(email_text)
|
||||
msg['Subject'] = "Erreur Synchro" + repo
|
||||
msg['From'] = EMAIL_ORI
|
||||
|
||||
for dest in EMAIL_TO.split(","):
|
||||
msg['To'] = dest
|
||||
@ -30,11 +30,13 @@ def sendMail(stdOut,stdErr,repo):
|
||||
s.sendmail(EMAIL_ORI, dest, msg.as_string())
|
||||
s.quit()
|
||||
|
||||
|
||||
def getRepoList():
|
||||
gitolite_conf = open(os.path.join(GITOLITE_DEPOT_PATH, "conf/gitolite.conf"), 'r')
|
||||
gitolite_conf = open(os.path.join(
|
||||
GITOLITE_DEPOT_PATH, "conf/gitolite.conf"), 'r')
|
||||
content = gitolite_conf.read()
|
||||
repo = []
|
||||
for line in content.split("\n") :
|
||||
for line in content.split("\n"):
|
||||
if line.startswith("repo"):
|
||||
repo.append(line.split(" ")[1])
|
||||
return repo
|
||||
@ -43,7 +45,7 @@ def getRepoList():
|
||||
repoToBackup = getRepoList()
|
||||
|
||||
for repo in repoToBackup:
|
||||
repo_path = os.path.join(BACKUP_DIR, repo+".git")
|
||||
repo_path = os.path.join(BACKUP_DIR, repo + ".git")
|
||||
stdOut = ""
|
||||
stdErr = ""
|
||||
ret = 0
|
||||
@ -58,7 +60,7 @@ for repo in repoToBackup:
|
||||
ret = proc.returncode
|
||||
else:
|
||||
os.chdir(BACKUP_DIR)
|
||||
proc = subprocess.Popen(MIRROR_CMD+repo,
|
||||
proc = subprocess.Popen(MIRROR_CMD + repo,
|
||||
shell=True,
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
|
Loading…
Reference in New Issue
Block a user