mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
bug fix: git manager
This commit is contained in:
@@ -3072,21 +3072,20 @@ StrictHostKeyChecking no
|
|||||||
|
|
||||||
externalApp = Websites.objects.get(domain=self.domain).externalApp
|
externalApp = Websites.objects.get(domain=self.domain).externalApp
|
||||||
|
|
||||||
command = 'git -C %s config --local core.sshCommand "ssh -i /home/%s/.ssh/%s"' % (self.folder, self.domain, externalApp)
|
command = 'git -C %s config --local core.sshCommand "ssh -i /home/%s/.ssh/%s -o "StrictHostKeyChecking=no""' % (self.folder, self.domain, externalApp)
|
||||||
ProcessUtilities.executioner(command, self.externalApp)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
## Check if remote exists
|
## Check if remote exists
|
||||||
|
|
||||||
command = 'git -C %s remote -v' % (self.folder)
|
command = 'git -C %s remote -v' % (self.folder)
|
||||||
remoteResult = ProcessUtilities.outputExecutioner(command, self.externalApp)
|
remoteResult = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
## Set new remote
|
## Set new remote
|
||||||
|
|
||||||
if remoteResult.find('origin') == -1:
|
if remoteResult.find('origin') == -1:
|
||||||
command = 'git -C %s remote add origin git@%s:%s/%s.git' % (self.folder, self.gitHost, self.gitUsername, self.gitReponame)
|
command = 'git -C %s remote add origin git@%s:%s/%s.git' % (self.folder, self.gitHost, self.gitUsername, self.gitReponame)
|
||||||
else:
|
else:
|
||||||
command = 'git -C %s remote set-url origin git@%s:%s/%s.git' % (
|
command = 'git -C %s remote set-url origin git@%s:%s/%s.git' % (self.folder, self.gitHost, self.gitUsername, self.gitReponame)
|
||||||
self.folder, self.gitHost, self.gitUsername, self.gitReponame)
|
|
||||||
|
|
||||||
possibleError = ProcessUtilities.outputExecutioner(command, self.externalApp)
|
possibleError = ProcessUtilities.outputExecutioner(command, self.externalApp)
|
||||||
|
|
||||||
@@ -3343,6 +3342,7 @@ StrictHostKeyChecking no
|
|||||||
self.gitHost = data['gitHost']
|
self.gitHost = data['gitHost']
|
||||||
self.gitUsername = data['gitUsername']
|
self.gitUsername = data['gitUsername']
|
||||||
self.gitReponame = data['gitReponame']
|
self.gitReponame = data['gitReponame']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.overrideData = data['overrideData']
|
self.overrideData = data['overrideData']
|
||||||
except:
|
except:
|
||||||
@@ -3362,25 +3362,22 @@ StrictHostKeyChecking no
|
|||||||
|
|
||||||
if self.overrideData:
|
if self.overrideData:
|
||||||
command = 'rm -rf %s' % (self.folder)
|
command = 'rm -rf %s' % (self.folder)
|
||||||
ProcessUtilities.executioner(command, self.externalApp)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
## Set defauly key
|
## Set defauly key
|
||||||
|
|
||||||
externalApp = Websites.objects.get(domain=self.domain).externalApp
|
externalApp = Websites.objects.get(domain=self.domain).externalApp
|
||||||
|
|
||||||
command = 'git config --global core.sshCommand "ssh -i /home/%s/.ssh/%s"' % (self.domain, externalApp)
|
command = 'git config --global core.sshCommand "ssh -i /home/%s/.ssh/%s -o "StrictHostKeyChecking=no""' % (self.domain, externalApp)
|
||||||
ProcessUtilities.executioner(command, self.externalApp)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = 'git clone git@%s:%s/%s.git %s' % (self.gitHost, self.gitUsername, self.gitReponame, self.folder)
|
command = 'git clone git@%s:%s/%s.git %s' % (self.gitHost, self.gitUsername, self.gitReponame, self.folder)
|
||||||
commandStatus = ProcessUtilities.outputExecutioner(command, self.externalApp)
|
commandStatus = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
if commandStatus.find('already exists') == -1 and commandStatus.find('Permission denied') == -1:
|
if commandStatus.find('already exists') == -1 and commandStatus.find('Permission denied') == -1:
|
||||||
|
|
||||||
command = 'git config --global --unset core.sshCommand'
|
|
||||||
ProcessUtilities.executioner(command, self.externalApp)
|
|
||||||
|
|
||||||
from filemanager.filemanager import FileManager
|
from filemanager.filemanager import FileManager
|
||||||
|
|
||||||
fm = FileManager(None, None)
|
fm = FileManager(None, None)
|
||||||
@@ -3397,9 +3394,6 @@ StrictHostKeyChecking no
|
|||||||
fm = FileManager(None, None)
|
fm = FileManager(None, None)
|
||||||
fm.fixPermissions(self.domain)
|
fm.fixPermissions(self.domain)
|
||||||
|
|
||||||
command = 'git config --global --unset core.sshCommand'
|
|
||||||
ProcessUtilities.executioner(command, self.externalApp)
|
|
||||||
|
|
||||||
data_ret = {'status': 0, 'error_message': 'Failed to clone.', 'commandStatus': commandStatus}
|
data_ret = {'status': 0, 'error_message': 'Failed to clone.', 'commandStatus': commandStatus}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user