mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 22:36:12 +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'):
|
elif os.path.exists('/etc/yum/yum.conf'):
|
||||||
yumConf = '/etc/yum/yum.conf'
|
yumConf = '/etc/yum/yum.conf'
|
||||||
|
|
||||||
yumConfData = open(yumConf, 'r').read()
|
yumConfData = ProcessUtilities.outputExecutioner('cat %s' % (yumConf))
|
||||||
data = open(yumConf, 'r').readlines()
|
data = yumConfData.splitlines()
|
||||||
|
|
||||||
|
yumConfTmp = '/home/cyberpanel/yumTemp'
|
||||||
|
|
||||||
if type == 0:
|
if type == 0:
|
||||||
writeToFile = open(yumConf, 'w')
|
writeToFile = open(yumConfTmp, 'w')
|
||||||
|
|
||||||
for items in data:
|
for items in data:
|
||||||
if items.find('exclude') > -1:
|
if items.find('exclude') > -1:
|
||||||
@@ -1076,12 +1077,12 @@ def lockStatus(request):
|
|||||||
|
|
||||||
if yumConfData.find('exclude') == -1:
|
if yumConfData.find('exclude') == -1:
|
||||||
|
|
||||||
writeToFile = open(yumConf, 'a')
|
writeToFile = open(yumConfTmp, 'a')
|
||||||
writeToFile.writelines('exclude=%s\n' % (package))
|
writeToFile.writelines('exclude=%s\n' % (package))
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
writeToFile = open(yumConf, 'w')
|
writeToFile = open(yumConfTmp, 'w')
|
||||||
|
|
||||||
for items in data:
|
for items in data:
|
||||||
if items.find('exclude') > -1:
|
if items.find('exclude') > -1:
|
||||||
@@ -1092,6 +1093,9 @@ def lockStatus(request):
|
|||||||
|
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
|
|
||||||
|
command = 'mv %s %s' % (yumConfTmp, yumConf)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
data_ret = {'status': 1}
|
data_ret = {'status': 1}
|
||||||
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