mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 05:15:49 +01:00
set up cluster
This commit is contained in:
@@ -2484,11 +2484,14 @@ class CloudManager:
|
||||
fm = FirewallManager()
|
||||
fm.addSSHKey(self.admin.pk, self.data)
|
||||
|
||||
## Create backup path so that file can be sent here later.
|
||||
## Create backup path so that file can be sent here later. If just submitting the key, no need to create backup folder domain.
|
||||
|
||||
BackupPath = '/home/cyberpanel/backups/%s' % (self.data['domain'])
|
||||
command = 'mkdir -p %s' % (BackupPath)
|
||||
ProcessUtilities.executioner(command, 'cyberpanel')
|
||||
try:
|
||||
BackupPath = '/home/cyberpanel/backups/%s' % (self.data['domain'])
|
||||
command = 'mkdir -p %s' % (BackupPath)
|
||||
ProcessUtilities.executioner(command, 'cyberpanel')
|
||||
except:
|
||||
pass
|
||||
|
||||
###
|
||||
|
||||
@@ -2689,3 +2692,23 @@ class CloudManager:
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def SetupCluster(self):
|
||||
try:
|
||||
|
||||
ClusterConfigPath = '/home/cyberpanel/cluster'
|
||||
writeToFile = open(ClusterConfigPath, 'w')
|
||||
writeToFile.write(json.dumps(self.data))
|
||||
writeToFile.close()
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/ClusterManager.py --function %s --type %s" % (
|
||||
'SetupCluster', type)
|
||||
ProcessUtilities.popenExecutioner(execPath)
|
||||
|
||||
final_json = json.dumps({'status': 1})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
Reference in New Issue
Block a user