|
|
|
@ -25,7 +25,7 @@ from calculate.lib.datavars import (Variable, VariableError,
|
|
|
|
|
TableVariable, FieldValue,
|
|
|
|
|
HumanReadable, CriticalError,
|
|
|
|
|
SimpleDataVars, DataVarsError)
|
|
|
|
|
from calculate.lib.utils.binhosts import Binhosts
|
|
|
|
|
from calculate.lib.utils.binhosts import Binhosts, PackagesIndex, HOURS
|
|
|
|
|
from calculate.lib.utils.files import readFile, listDirectory, process, pathJoin
|
|
|
|
|
|
|
|
|
|
from calculate.lib.configparser import ConfigParser
|
|
|
|
@ -1706,9 +1706,22 @@ class VariableClUpdatePackageCache(ReadonlyVariable):
|
|
|
|
|
host, parsed_url.path.lstrip("/"),
|
|
|
|
|
"Packages")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableClUpdatePackageCacheSet(Variable):
|
|
|
|
|
"""
|
|
|
|
|
Необходимость обновить Packages
|
|
|
|
|
"""
|
|
|
|
|
type = "bool"
|
|
|
|
|
value = "off"
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
packages_fn = self.Get('cl_update_package_cache')
|
|
|
|
|
if not path.exists(packages_fn):
|
|
|
|
|
return "on"
|
|
|
|
|
pi = PackagesIndex(readFile(packages_fn))
|
|
|
|
|
try:
|
|
|
|
|
ttl = int(pi.get("TTL", "0"))
|
|
|
|
|
if ttl > HOURS:
|
|
|
|
|
return "off"
|
|
|
|
|
except ValueError:
|
|
|
|
|
return "on"
|
|
|
|
|
return "on"
|
|
|
|
|