mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-06-27 18:48:23 +02:00
bug fix: auto git commit/push
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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.]")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user