|
|
|
@ -14,12 +14,15 @@
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
from os import path
|
|
|
|
|
from itertools import ifilter
|
|
|
|
|
from calculate.core.datavars import DataVarsCore
|
|
|
|
|
from calculate.core.server.gen_pid import search_worked_process
|
|
|
|
|
from calculate.lib.cl_template import SystemIni
|
|
|
|
|
from calculate.lib.utils.content import getCfgFiles
|
|
|
|
|
from calculate.lib.utils.files import getRunCommands
|
|
|
|
|
from calculate.lib.utils.files import getRunCommands, readFile
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateInfo(object):
|
|
|
|
@ -72,3 +75,27 @@ class UpdateInfo(object):
|
|
|
|
|
В системе уже есть работающий процесс обновления
|
|
|
|
|
"""
|
|
|
|
|
return search_worked_process("update", self.dv)
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def outdated_kernel(self):
|
|
|
|
|
flag_path = self.dv.Get('cl_update_outdated_kernel_path')
|
|
|
|
|
if path.exists(flag_path):
|
|
|
|
|
try:
|
|
|
|
|
flag_kernel = readFile(flag_path).strip()
|
|
|
|
|
current_kernel = self.dv.Get('update.cl_update_kernel_version')
|
|
|
|
|
if flag_kernel != current_kernel:
|
|
|
|
|
return True
|
|
|
|
|
except ValueError:
|
|
|
|
|
pass
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
@outdated_kernel.setter
|
|
|
|
|
def outdated_kernel(self, value):
|
|
|
|
|
flag_path = self.dv.Get('cl_update_outdated_kernel_path')
|
|
|
|
|
|
|
|
|
|
if value:
|
|
|
|
|
with open(flag_path, 'w') as f:
|
|
|
|
|
f.write(self.dv.Get('update.cl_update_kernel_version'))
|
|
|
|
|
else:
|
|
|
|
|
if path.exists(flag_path):
|
|
|
|
|
os.unlink(flag_path)
|
|
|
|
|