[script][backup]reindent

This commit is contained in:
Mathieu Maret 2016-03-02 18:02:49 +01:00
parent e602f21981
commit 231c89f56c

View File

@ -14,14 +14,14 @@ EMAIL_SERVER = "localhost"
EMAIL_ORI = "backup@mathux.dyndns.org" EMAIL_ORI = "backup@mathux.dyndns.org"
def sendMail(stdOut,stdErr,repo): def sendMail(stdOut, stdErr, repo):
email_text = "Error when sync "+repo+"\n" email_text = "Error when sync " + repo + "\n"
email_text += "stdOut :"+stdOut+"\n\n" email_text += "stdOut :" + stdOut + "\n\n"
email_text += "stdErr :"+stdErr+"\n\n" email_text += "stdErr :" + stdErr + "\n\n"
msg = MIMEText(email_text) msg = MIMEText(email_text)
msg['Subject'] = "Erreur Synchro" +repo msg['Subject'] = "Erreur Synchro" + repo
msg['From'] = EMAIL_ORI msg['From'] = EMAIL_ORI
for dest in EMAIL_TO.split(","): for dest in EMAIL_TO.split(","):
msg['To'] = dest msg['To'] = dest
@ -30,11 +30,13 @@ def sendMail(stdOut,stdErr,repo):
s.sendmail(EMAIL_ORI, dest, msg.as_string()) s.sendmail(EMAIL_ORI, dest, msg.as_string())
s.quit() s.quit()
def getRepoList(): 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() content = gitolite_conf.read()
repo = [] repo = []
for line in content.split("\n") : for line in content.split("\n"):
if line.startswith("repo"): if line.startswith("repo"):
repo.append(line.split(" ")[1]) repo.append(line.split(" ")[1])
return repo return repo
@ -43,7 +45,7 @@ def getRepoList():
repoToBackup = getRepoList() repoToBackup = getRepoList()
for repo in repoToBackup: for repo in repoToBackup:
repo_path = os.path.join(BACKUP_DIR, repo+".git") repo_path = os.path.join(BACKUP_DIR, repo + ".git")
stdOut = "" stdOut = ""
stdErr = "" stdErr = ""
ret = 0 ret = 0
@ -58,7 +60,7 @@ for repo in repoToBackup:
ret = proc.returncode ret = proc.returncode
else: else:
os.chdir(BACKUP_DIR) os.chdir(BACKUP_DIR)
proc = subprocess.Popen(MIRROR_CMD+repo, proc = subprocess.Popen(MIRROR_CMD + repo,
shell=True, shell=True,
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,