bug fix: git manager

This commit is contained in:
Usman Nasir
2020-03-30 01:07:46 +05:00
parent f475b6f859
commit 6154500b08
2 changed files with 74 additions and 71 deletions

View File

@@ -126,14 +126,12 @@ class IncScheduler():
data = {}
data['domain'] = website
data['folder'] = finalPath
data['commitMessage'] = 'Auto commit by CyberPanel %s cron on %s.' % (type, time.strftime('%m.%d.%Y_%H-%M-%S'))
data['commitMessage'] = 'Auto commit by CyberPanel %s cron on %s' % (type, time.strftime('%m-%d-%Y_%H-%M-%S'))
if gitConf['autoCommit'] == type:
wm = WebsiteManager()
resp = wm.commitChanges(1, data)
logging.writeToFile(resp.content)
resp = json.loads(resp.content)
message = 'Folder: %s, Status: %s' % (finalPath, resp['commandStatus'])

View File

@@ -2912,6 +2912,8 @@ StrictHostKeyChecking no
def folderCheck(self):
try:
domainPath = '/home/%s/public_html' % (self.domain)
vhRoot = '/home/%s' % (self.domain)
vmailPath = '/home/vmail/%s' % (self.domain)
@@ -2996,6 +2998,8 @@ StrictHostKeyChecking no
if self.folder == dbPath:
return 1
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile('%s. [folderCheck:3002]' % (str(msg)))
return 0
@@ -3355,12 +3359,13 @@ StrictHostKeyChecking no
else:
return ACLManager.loadErrorJson()
# security check
if ACLManager.validateInput(self.commitMessage):
pass
else:
return ACLManager.loadErrorJson('status', 'Invalid characters in your input.')
return ACLManager.loadErrorJson()
## Check if remote exists
@@ -3371,13 +3376,13 @@ StrictHostKeyChecking no
commandStatus = ProcessUtilities.outputExecutioner(command)
if commandStatus.find('nothing to commit') == -1:
try:
gitConfFolder = '/home/cyberpanel/git/%s' % (self.masterDomain)
finalFile = '%s/%s' % (gitConfFolder, self.folder.split('/')[-1])
gitConf = json.loads(open(finalFile, 'r').read())
try:
if gitConf['commands'] != 'NONE':
GitLogs(owner=self.masterWebsite, type='INFO', message='Running commands after successful git commit..').save()