mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
bug fix: cent8: package manager
This commit is contained in:
@@ -1058,12 +1058,13 @@ def lockStatus(request):
|
||||
elif os.path.exists('/etc/yum/yum.conf'):
|
||||
yumConf = '/etc/yum/yum.conf'
|
||||
|
||||
yumConfData = open(yumConf, 'r').read()
|
||||
data = open(yumConf, 'r').readlines()
|
||||
yumConfData = ProcessUtilities.outputExecutioner('cat %s' % (yumConf))
|
||||
data = yumConfData.splitlines()
|
||||
|
||||
yumConfTmp = '/home/cyberpanel/yumTemp'
|
||||
|
||||
if type == 0:
|
||||
writeToFile = open(yumConf, 'w')
|
||||
writeToFile = open(yumConfTmp, 'w')
|
||||
|
||||
for items in data:
|
||||
if items.find('exclude') > -1:
|
||||
@@ -1076,12 +1077,12 @@ def lockStatus(request):
|
||||
|
||||
if yumConfData.find('exclude') == -1:
|
||||
|
||||
writeToFile = open(yumConf, 'a')
|
||||
writeToFile = open(yumConfTmp, 'a')
|
||||
writeToFile.writelines('exclude=%s\n' % (package))
|
||||
writeToFile.close()
|
||||
|
||||
else:
|
||||
writeToFile = open(yumConf, 'w')
|
||||
writeToFile = open(yumConfTmp, 'w')
|
||||
|
||||
for items in data:
|
||||
if items.find('exclude') > -1:
|
||||
@@ -1092,6 +1093,9 @@ def lockStatus(request):
|
||||
|
||||
writeToFile.close()
|
||||
|
||||
command = 'mv %s %s' % (yumConfTmp, yumConf)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
data_ret = {'status': 1}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
Reference in New Issue
Block a user