bug fix: auto git commit/push

This commit is contained in:
Usman Nasir
2020-03-30 13:26:17 +05:00
parent bd71548b5b
commit 4f1a8ad515
3 changed files with 21 additions and 4 deletions

View File

@@ -102,6 +102,10 @@ class IncScheduler():
finalPathInside = '%s/%s' % (IncScheduler.gitFolder, website)
for file in os.listdir(finalPathInside):
if file == website:
continue
if file.find('public_html') > -1:
finalPath = '/home/%s/public_html' % (website)
finalPathConf = '%s/%s' % (finalPathInside, file)
@@ -134,12 +138,14 @@ class IncScheduler():
resp = wm.commitChanges(1, data)
resp = json.loads(resp.content)
message = 'Folder: %s, Status: %s' % (finalPath, resp['commandStatus'])
finalText = '%s\n%s' % (finalText, message)
if resp['status'] == 1:
message = 'Folder: %s, Status: %s' % (finalPath, resp['commandStatus'])
finalText = '%s\n%s' % (finalText, message)
GitLogs(owner=web, type='INFO', message=message).save()
else:
message = 'Folder: %s, Status: %s' % (finalPath, resp['commandStatus'])
finalText = '%s\n%s' % (finalText, message)
GitLogs(owner=web, type='ERROR', message=message).save()
if gitConf['autoPush'] == type:

View File

@@ -410,7 +410,12 @@ class vhost:
command = 'groupdel %s' % (externalApp)
ProcessUtilities.executioner(command)
##
## Remove git conf folder if present
gitPath = '/home/cyberpanel/git/%s' % (virtualHostName)
if os.path.exists(gitPath):
shutil.rmtree(gitPath)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")

View File

@@ -2998,6 +2998,10 @@ StrictHostKeyChecking no
if self.folder == dbPath:
return 1
return 0
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile('%s. [folderCheck:3002]' % (str(msg)))
@@ -3357,16 +3361,18 @@ StrictHostKeyChecking no
if self.folderCheck():
pass
else:
return ACLManager.loadErrorJson()
return ACLManager.loadErrorJson('status', 0)
# security check
if ACLManager.validateInput(self.commitMessage):
pass
else:
return ACLManager.loadErrorJson()
## Check if remote exists
command = 'git -C %s add -A' % (self.folder)