parent
fe04a136c9
commit
7f6eb54c6e
@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2012-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
# from server.cl_server import main
|
||||||
|
# print(main)
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import absolute_import
|
||||||
|
def core_main():
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if hasattr(sys, "setdefaultencoding"):
|
||||||
|
sys.setdefaultencoding("utf-8")
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core', sys.modules[__name__])
|
||||||
|
from traceback import print_exc
|
||||||
|
from os import path
|
||||||
|
|
||||||
|
if not path.exists('/dev/urandom'):
|
||||||
|
sys.stderr.write("/dev/urandom not found\n")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from .server.cl_server import main
|
||||||
|
|
||||||
|
reload(sys)
|
||||||
|
from calculate.lib.datavars import CriticalError, DataVarsError
|
||||||
|
|
||||||
|
try:
|
||||||
|
sys.exit(main())
|
||||||
|
except (CriticalError, DataVarsError) as e:
|
||||||
|
sys.stderr.write("%s\n" % str(e))
|
||||||
|
sys.exit(1)
|
||||||
|
except ImportError as e:
|
||||||
|
print_exc()
|
||||||
|
cannot_import = 'cannot import name '
|
||||||
|
no_module = 'No module named '
|
||||||
|
if e.message.startswith(cannot_import):
|
||||||
|
print (_('Failed to import %s')
|
||||||
|
% e.message.rpartition(cannot_import)[2])
|
||||||
|
elif e.message.startswith(no_module):
|
||||||
|
print (_('No module named %s') %
|
||||||
|
e.message.rpartition(no_module)[2])
|
||||||
|
else:
|
||||||
|
print(e.message)
|
||||||
|
sys.exit(1)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print()
|
||||||
|
print(_("Task interrupted"))
|
||||||
|
|
||||||
|
|
||||||
|
if (__name__ == "__main__"):
|
||||||
|
core_main()
|
@ -0,0 +1,113 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
from calculate.core.server.core_interfaces import MethodsInterface
|
||||||
|
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
VARIABLE, MODE, LOCATION, VALUE = 0, 1, 2, 3
|
||||||
|
|
||||||
|
|
||||||
|
class Variables(MethodsInterface):
|
||||||
|
def writeVariables(self, vardata):
|
||||||
|
"""
|
||||||
|
Write variable to env files, or delete from env files
|
||||||
|
"""
|
||||||
|
dv = self.clVars
|
||||||
|
data = filter(lambda x: x[LOCATION] or
|
||||||
|
not x[LOCATION] and
|
||||||
|
dv.isFromIni(x[VARIABLE]),
|
||||||
|
vardata)
|
||||||
|
if data:
|
||||||
|
head = [_("Variable"), _("Mode"), _("Location"), _("Value")]
|
||||||
|
self.printTable(_("List of variables"), head, data)
|
||||||
|
for varname, mode, location, value in data:
|
||||||
|
if location:
|
||||||
|
value = dv.unserialize(dv.getInfo(varname).type, str(value))
|
||||||
|
section, op, varname = varname.rpartition('.')
|
||||||
|
if not location:
|
||||||
|
for env_location in dv.Get('main.cl_env_location'):
|
||||||
|
if not dv.Delete(varname, env_location, header=section):
|
||||||
|
self.printWARNING(
|
||||||
|
_("Failed to delete variable {var} from "
|
||||||
|
"{location}").format(
|
||||||
|
var=varname, location=env_location))
|
||||||
|
else:
|
||||||
|
if varname in dv.iniCache:
|
||||||
|
oldValue = dv.unserialize(
|
||||||
|
dv.getInfo(varname).type,
|
||||||
|
str(dv.iniCache[varname]['value']))
|
||||||
|
else:
|
||||||
|
oldValue = None
|
||||||
|
if value != oldValue:
|
||||||
|
dv.Write(varname, value, location=location,
|
||||||
|
header=section)
|
||||||
|
else:
|
||||||
|
self.printSUCCESS("Nothing to set")
|
||||||
|
return True
|
||||||
|
|
||||||
|
def showVariables(self, showVal, filterVal, vardata):
|
||||||
|
"""
|
||||||
|
Show variables by cl_variable_filter
|
||||||
|
"""
|
||||||
|
dv = self.clVars
|
||||||
|
removeQuotes = lambda x: x if x != "''" else ""
|
||||||
|
reIndex = re.compile("((?:\w+\.)?(\w+))(?:\[(\d+)\])")
|
||||||
|
if showVal:
|
||||||
|
index = reIndex.search(showVal)
|
||||||
|
if index:
|
||||||
|
varname = index.group(1)
|
||||||
|
index = int(index.group(3))
|
||||||
|
else:
|
||||||
|
varname = showVal
|
||||||
|
prevVal = str(dv.Select('cl_variable_value',
|
||||||
|
where='cl_variable_fullname',
|
||||||
|
eq=varname, limit=1))
|
||||||
|
if index is not None:
|
||||||
|
typeVar = dv.getInfo(varname).type
|
||||||
|
val = dv.unserialize(typeVar, prevVal)
|
||||||
|
if index < len(val):
|
||||||
|
self.printDefault(removeQuotes(val[index]))
|
||||||
|
else:
|
||||||
|
self.printDefault("")
|
||||||
|
else:
|
||||||
|
self.printDefault(removeQuotes(prevVal))
|
||||||
|
return True
|
||||||
|
filter_names = {'all': None,
|
||||||
|
'userset': lambda x: x[LOCATION],
|
||||||
|
'writable': lambda x: x[MODE].startswith("w"),
|
||||||
|
'system': lambda x: x[LOCATION] == "system",
|
||||||
|
'local': lambda x: x[LOCATION] == "local",
|
||||||
|
'remote': lambda x: x[LOCATION] == "remote"}
|
||||||
|
filterFunc = filter_names.get(filterVal,
|
||||||
|
lambda x: filterVal in x[VARIABLE])
|
||||||
|
body = filter(filterFunc, vardata)
|
||||||
|
dv.close()
|
||||||
|
if body:
|
||||||
|
head = [_("Variable"), _("Mode"),
|
||||||
|
_("Location"), _("Value")]
|
||||||
|
self.printTable(_("List of variables"), head, body)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
self.printWARNING(_("No such variables"))
|
||||||
|
return True
|
@ -0,0 +1,90 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError, DataVarsError
|
||||||
|
from calculate.core.backup import BackupError
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClBackupAction(Action):
|
||||||
|
"""
|
||||||
|
Создание резервной копии настроек
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (BackupError, FilesError, DataVarsError, VariableError,
|
||||||
|
TemplatesError)
|
||||||
|
successMessage = __("Backup successfully completed!")
|
||||||
|
failedMessage = __("Failed to perform backup!")
|
||||||
|
interruptMessage = __("Backup manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'prepare_dir',
|
||||||
|
'method': 'Backup.prepare_backup(core.cl_backup_path,'
|
||||||
|
'core.cl_backup_root_name)'
|
||||||
|
},
|
||||||
|
{'name': 'backup_marked',
|
||||||
|
'message': __("Backing up files configured by templates"),
|
||||||
|
'method': 'Backup.backup_marked("/",core.cl_backup_path,'
|
||||||
|
'"etc",core.cl_backup_root_name)'
|
||||||
|
},
|
||||||
|
{'name': 'templates',
|
||||||
|
'message': __("Templates preparing for backup"),
|
||||||
|
'method': 'Backup.applyTemplates(install.cl_source,'
|
||||||
|
'False,True,None,True,True)',
|
||||||
|
},
|
||||||
|
{'name': 'special_backup',
|
||||||
|
'method': 'Backup.special_backup(core.cl_backup_path)'
|
||||||
|
},
|
||||||
|
{'name': 'accounts_backup',
|
||||||
|
'message': __("Backing up accounts info"),
|
||||||
|
'method': 'Backup.save_accounts(core.cl_backup_path)'
|
||||||
|
},
|
||||||
|
{'name': 'prepare_content',
|
||||||
|
'message': __("Calculating checksums"),
|
||||||
|
'method': 'Backup.prepare_contents(core.cl_backup_path,'
|
||||||
|
'core.cl_backup_file_contents,core.cl_backup_root_name)',
|
||||||
|
},
|
||||||
|
{'name': 'save_initd',
|
||||||
|
'method': 'Backup.save_initd(core.cl_backup_path,'
|
||||||
|
'core.cl_backup_root_name)',
|
||||||
|
},
|
||||||
|
{'name': 'pack_backup',
|
||||||
|
'message': __("Packing backup"),
|
||||||
|
'method': 'Backup.create_archive(core.cl_backup_path,'
|
||||||
|
'core.cl_backup_file)'
|
||||||
|
},
|
||||||
|
{'name': 'remove_dir',
|
||||||
|
'message': __("Clearing temporary files"),
|
||||||
|
'method': 'Backup.remove_directory(core.cl_backup_path)',
|
||||||
|
'depend': Tasks.success_one_of("prepare_dir")
|
||||||
|
},
|
||||||
|
{'name': 'display_verbose',
|
||||||
|
'method': 'Backup.display_backup_configs(core.cl_backup_file)',
|
||||||
|
'condition': lambda Get: Get('core.cl_backup_verbose_set') == 'on'
|
||||||
|
},
|
||||||
|
{'name': 'display_arch',
|
||||||
|
'message': __("Archive created: {core.cl_backup_file}")
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,104 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError, DataVarsError
|
||||||
|
from calculate.core.backup import BackupError
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from tarfile import ReadError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClBackupRestoreAction(Action):
|
||||||
|
"""
|
||||||
|
Восстановление настроек из резервной копии
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (BackupError, FilesError, DataVarsError, VariableError,
|
||||||
|
TemplatesError, ReadError)
|
||||||
|
successMessage = __("Files successfully restored from backup!")
|
||||||
|
failedMessage = __("Failed to restore from backup!")
|
||||||
|
interruptMessage = __("Restoration from backup manually interrupted")
|
||||||
|
|
||||||
|
restore_tasks = []
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'unpack_backup',
|
||||||
|
'message': __("Unpacking backup"),
|
||||||
|
'method': 'Backup.open_archive(core.cl_backup_path,'
|
||||||
|
'core.cl_backup_file)'
|
||||||
|
},
|
||||||
|
{'name': 'restore_accounts',
|
||||||
|
'message': __("Restoring user accounts"),
|
||||||
|
'method': 'Backup.restore_accounts(core.cl_backup_path)'
|
||||||
|
},
|
||||||
|
{'name': 'restore_network',
|
||||||
|
'message': __("Restoring network"),
|
||||||
|
'method': 'Backup.restore_network(core.cl_backup_path)'
|
||||||
|
},
|
||||||
|
{'name': 'special_restore',
|
||||||
|
'method': 'Backup.special_restore(core.cl_backup_path)'
|
||||||
|
},
|
||||||
|
{'name': 'templates',
|
||||||
|
'message': __("Restoring services"),
|
||||||
|
'method': 'Backup.applyTemplates(install.cl_source,'
|
||||||
|
'False,True,None,True,True)',
|
||||||
|
},
|
||||||
|
{'name': 'clear_autorun',
|
||||||
|
'method': 'Backup.clear_autorun()',
|
||||||
|
},
|
||||||
|
{'name': 'restore_configs',
|
||||||
|
'message': __("Unpacking configuration files"),
|
||||||
|
'method': 'Backup.restore_configs(core.cl_backup_file,"/",'
|
||||||
|
'core.cl_backup_contents_name,core.cl_backup_root_name)'
|
||||||
|
},
|
||||||
|
{'name': 'restore_content',
|
||||||
|
'message': __("Restoring file owners"),
|
||||||
|
'method': 'Backup.restore_contents(core.cl_backup_file_contents,'
|
||||||
|
'"/")',
|
||||||
|
},
|
||||||
|
{'name': 'display_verbose',
|
||||||
|
'method': 'Backup.display_changed_configs()',
|
||||||
|
'condition': lambda Get: Get('core.cl_backup_verbose_set') == 'on'
|
||||||
|
},
|
||||||
|
{'name': 'set_service_mode',
|
||||||
|
'method': 'Backup.set_service_action()',
|
||||||
|
},
|
||||||
|
{'name': 'templates_service',
|
||||||
|
'message': __("Configuration after restoring from backup"),
|
||||||
|
'method': 'Backup.applyTemplates(install.cl_source,'
|
||||||
|
'False,True,None,True,True)',
|
||||||
|
},
|
||||||
|
{'name': 'remove_dir',
|
||||||
|
'method': 'Backup.remove_directory(core.cl_backup_path)',
|
||||||
|
'depend': Tasks.success_one_of("unpack_backup")
|
||||||
|
},
|
||||||
|
{'name': 'dispatch_conf',
|
||||||
|
'message': __("Updating configuration files"),
|
||||||
|
'method': 'Backup.dispatchConf()',
|
||||||
|
'condition': lambda Get: Get('cl_dispatch_conf') != 'skip'
|
||||||
|
},
|
||||||
|
{'name': 'openrc_default',
|
||||||
|
'message': __("Running stopped services"),
|
||||||
|
'method': 'Backup.run_openrc("default")',
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,49 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError, DataVarsError
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClConfigAction(Action):
|
||||||
|
"""
|
||||||
|
Действие настройка пакета для пользователя и системы
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError, TemplatesError, VariableError, DataVarsError)
|
||||||
|
templateTaskMessage = __("The system is being configured")
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = __("Failed to configure the system!")
|
||||||
|
interruptMessage = __("Configuration manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'process_config',
|
||||||
|
# наложить шаблоны настройки пакета
|
||||||
|
'method': 'UpdateConfigs.processConfig(cl_core_pkg_name,'
|
||||||
|
'cl_core_pkg_version,cl_core_pkg_slot,'
|
||||||
|
'cl_core_pkg_category,cl_verbose_set,cl_dispatch_conf,'
|
||||||
|
'cl_template_path_use,cl_ebuild_phase,'
|
||||||
|
'cl_template_clt_set,cl_core_arch_machine)',
|
||||||
|
},
|
||||||
|
]
|
@ -0,0 +1,63 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2013-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreCustomAction(Action):
|
||||||
|
"""
|
||||||
|
Действие для настройки параметров видео
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError, TemplatesError, VariableError)
|
||||||
|
|
||||||
|
successMessage = __("Action successfully completed!")
|
||||||
|
failedMessage = __("Failed to perform action!")
|
||||||
|
interruptMessage = __("Action manually interrupted")
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
# список задач для действия
|
||||||
|
self.tasks = [
|
||||||
|
{'name': 'set_vars',
|
||||||
|
'method': (
|
||||||
|
'UpdateConfigs.setVariable("install.os_install_arch_machine",'
|
||||||
|
'cl_core_arch_machine, True)')
|
||||||
|
},
|
||||||
|
{'name': 'apply_templates',
|
||||||
|
# наложить шаблоны на текущий дистрибутив, включая clt шаблоны
|
||||||
|
# без использования фильтров по clt шаблонам
|
||||||
|
'method': 'UpdateConfigs.applyTemplates(None,False,'
|
||||||
|
'None,None)',
|
||||||
|
},
|
||||||
|
{'name': 'failed_action',
|
||||||
|
'error': __("Action {ac_custom_name} not found"),
|
||||||
|
'condition': lambda Get: not filter(
|
||||||
|
lambda x: (x and x[0] == 'ac_custom_name' and
|
||||||
|
x[1] == Get('ac_custom_name')),
|
||||||
|
Get('cl_used_action'))
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
Action.__init__(self)
|
@ -0,0 +1,42 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreDispatchAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,)
|
||||||
|
|
||||||
|
successMessage = __("Dispatch complete!")
|
||||||
|
failedMessage = __("Failed to dispatch configuration files!")
|
||||||
|
interruptMessage = __("Dispatching manually interrupted")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'dispatch',
|
||||||
|
'method': 'UpdateConfigs.dispatchConf()',
|
||||||
|
}]
|
@ -0,0 +1,92 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreGroupShow(Action):
|
||||||
|
"""
|
||||||
|
Отображение групп
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,)
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = None
|
||||||
|
interruptMessage = __("Viewing manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'view_group',
|
||||||
|
'method': 'Groups.show_groups_meth(cl_page_count,cl_page_offset)'
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreGroupMod(Action):
|
||||||
|
"""
|
||||||
|
Изменение группы
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,)
|
||||||
|
successMessage = __("Group {cl_core_group} changed")
|
||||||
|
failedMessage = __("Failed to change {cl_core_group} group")
|
||||||
|
interruptMessage = __("Modifying manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'mod_group',
|
||||||
|
'method': (
|
||||||
|
'Groups.change_group_meth(cl_core_group,cl_core_group_rights,'
|
||||||
|
'cl_core_group_rights_path)')
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreGroupAdd(Action):
|
||||||
|
"""
|
||||||
|
Добавление группы
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,)
|
||||||
|
successMessage = __("Group {cl_core_group} added")
|
||||||
|
failedMessage = __("Failed to add {cl_core_group} group")
|
||||||
|
interruptMessage = __("Adding manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'add_group',
|
||||||
|
'method': 'Groups.add_group_meth(cl_core_group,cl_core_group_rights,'
|
||||||
|
'cl_core_group_rights_path)'
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreGroupDel(Action):
|
||||||
|
"""
|
||||||
|
Удаление группы
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,)
|
||||||
|
successMessage = __("Group {cl_core_group} deleted")
|
||||||
|
failedMessage = __("Failed to delete {cl_core_group} group")
|
||||||
|
interruptMessage = __("Deleting manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'del_group',
|
||||||
|
'method': 'Groups.del_group_meth(cl_core_group,'
|
||||||
|
'cl_core_group_rights_path)'
|
||||||
|
}]
|
@ -0,0 +1,46 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError, DataVarsError
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClCorePatchAction(Action):
|
||||||
|
"""
|
||||||
|
Действие наложния патчей
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError, TemplatesError, VariableError, DataVarsError)
|
||||||
|
templateTaskMessage = __("Appling patches to package sources")
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = __("Failed to patch package sources!")
|
||||||
|
interruptMessage = __("Patching manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'patch_package',
|
||||||
|
# наложить патчи для пакета
|
||||||
|
'method': 'UpdateConfigs.patchPackage(cl_core_pkg_path,'
|
||||||
|
'cl_core_pkg_name,cl_core_arch_machine)'
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,75 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreRequestShow(Action):
|
||||||
|
"""
|
||||||
|
Отображение запросов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,)
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = None
|
||||||
|
interruptMessage = __("Viewing manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'view_req',
|
||||||
|
'method': 'Request.show_request_meth(cl_page_count,cl_page_offset)'
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreRequestConfirm(Action):
|
||||||
|
"""
|
||||||
|
Подтверждение запроса
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,)
|
||||||
|
successMessage = __("Certificate {cl_req_crt_path} is signed")
|
||||||
|
failedMessage = __("Failed to sign {cl_req_csr_path} request")
|
||||||
|
interruptMessage = __("Signing manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'mod_req',
|
||||||
|
'method': 'Request.confirm_request_meth(cl_core_client_certs_path,'
|
||||||
|
'cl_core_cert_path,cl_req_csr_path,cl_req_crt_path,'
|
||||||
|
'cl_req_group)'
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreRequestDel(Action):
|
||||||
|
"""
|
||||||
|
Удаление запроса
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,)
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = __("Failed to delete the request with ID={cl_req_id}")
|
||||||
|
interruptMessage = __("Deleting manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'del_req',
|
||||||
|
'method': 'Request.del_request_meth(cl_core_database,cl_req_csr_path,'
|
||||||
|
'cl_req_crt_path,cl_req_id)'
|
||||||
|
}]
|
@ -0,0 +1,53 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2013-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.datavars import VariableError
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreRestartAction(Action):
|
||||||
|
"""
|
||||||
|
Действие для настройки параметров видео
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError, TemplatesError, VariableError)
|
||||||
|
|
||||||
|
successMessage = __("Action successfully completed!")
|
||||||
|
failedMessage = __("Failed to perform action!")
|
||||||
|
interruptMessage = __("Action manually interrupted")
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
# список задач для действия
|
||||||
|
self.tasks = [
|
||||||
|
{'name': 'check_running',
|
||||||
|
# проверить запущенные процессы
|
||||||
|
'method': 'UpdateConfigs.checkRunning()',
|
||||||
|
},
|
||||||
|
{'name': 'restart',
|
||||||
|
# перезапустить calculate-core
|
||||||
|
'message': _("Restarting calculate-core"),
|
||||||
|
'method': 'UpdateConfigs.restartService("calculate-core")',
|
||||||
|
}]
|
||||||
|
|
||||||
|
Action.__init__(self)
|
@ -0,0 +1,77 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError, DataVarsError
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreSetupAction(Action):
|
||||||
|
"""
|
||||||
|
Действие настройка пакета для пользователя и системы
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError, TemplatesError, VariableError, DataVarsError)
|
||||||
|
templateTaskMessage = __("The system is being configured")
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = __("Failed to configure the system!")
|
||||||
|
interruptMessage = __("Configuration manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'system_rm_package',
|
||||||
|
# наложить шаблоны удаления пакета
|
||||||
|
'method': 'UpdateConfigs.updateSystemConfig(cl_core_pkg_name,'
|
||||||
|
'"",cl_core_pkg_slot,cl_core_pkg_category,cl_core_pkg_path,'
|
||||||
|
'cl_core_pkg_root_set,cl_verbose_set,cl_dispatch_conf,'
|
||||||
|
'cl_template_path_use,cl_ebuild_phase,'
|
||||||
|
'cl_template_clt_set,cl_core_arch_machine)',
|
||||||
|
'condition': lambda dv: (
|
||||||
|
dv.Get('cl_core_pkg_system_set') == 'on' and
|
||||||
|
dv.Get('cl_ebuild_phase') in ('prerm', 'postrm'))
|
||||||
|
},
|
||||||
|
{'name': 'system_setup_package',
|
||||||
|
# наложить шаблоны настройки пакета
|
||||||
|
'method': 'UpdateConfigs.updateSystemConfig(cl_core_pkg_name,'
|
||||||
|
'cl_core_pkg_version,cl_core_pkg_slot,'
|
||||||
|
'cl_core_pkg_category,cl_core_pkg_path,'
|
||||||
|
'cl_core_pkg_root_set,cl_verbose_set,cl_dispatch_conf,'
|
||||||
|
'cl_template_path_use,cl_ebuild_phase,'
|
||||||
|
'cl_template_clt_set,cl_core_arch_machine)',
|
||||||
|
'condition': lambda dv: (
|
||||||
|
dv.Get('cl_core_pkg_system_set') == 'on' and
|
||||||
|
dv.Get('cl_ebuild_phase') not in ('prerm', 'postrm'))
|
||||||
|
},
|
||||||
|
{'name': 'user_setup_package',
|
||||||
|
# наложить шаблоны настройки пакета
|
||||||
|
'method': 'UpdateConfigs.updateDesktopConfig(cl_core_pkg_name,'
|
||||||
|
'cl_core_pkg_version,cl_core_pkg_slot,'
|
||||||
|
'cl_core_pkg_category,cl_core_pkg_path,'
|
||||||
|
'cl_core_pkg_root_set,cl_verbose_set,cl_dispatch_conf,'
|
||||||
|
'cl_template_path_use,cl_ebuild_phase,'
|
||||||
|
'cl_template_clt_set,cl_core_arch_machine)',
|
||||||
|
'condition': lambda dv: (
|
||||||
|
dv.Get('cl_core_pkg_desktop_set') == 'on' and
|
||||||
|
dv.isModuleInstalled('desktop') and
|
||||||
|
dv.Get('cl_ebuild_phase') not in ("preinst", "prerm"))
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,62 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.lib.datavars import VariableError, DataVarsError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreVariables(Action):
|
||||||
|
"""
|
||||||
|
Отображение сертификатов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError, DataVarsError, VariableError)
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = None
|
||||||
|
interruptMessage = __("Modification of variables manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'write_vars',
|
||||||
|
# записать переменные
|
||||||
|
'method': 'Variables.writeVariables(cl_variable_data)'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreVariablesShow(Action):
|
||||||
|
"""
|
||||||
|
Отображение сертификатов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError, DataVarsError, VariableError)
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = None
|
||||||
|
interruptMessage = __("Viewing manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'view_vars',
|
||||||
|
# отобразить переменные
|
||||||
|
'method': 'Variables.showVariables(cl_variable_show,'
|
||||||
|
'cl_variable_filter,cl_variable_data)'
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,42 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClCoreViewCert(Action):
|
||||||
|
"""
|
||||||
|
Отображение сертификатов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,)
|
||||||
|
successMessage = None
|
||||||
|
failedMessage = None
|
||||||
|
interruptMessage = __("Viewing manually interrupted")
|
||||||
|
|
||||||
|
tasks = [
|
||||||
|
{'name': 'view_cert',
|
||||||
|
# наложить патчи для пакета
|
||||||
|
'method': 'Certificate.show_certs_meth(cl_page_count,cl_page_offset)'
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,795 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2011-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from calculate.lib.datavars import VariableError, DataVarsError
|
||||||
|
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_core3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
from . import setup_package
|
||||||
|
from . import server.certificate as certificate
|
||||||
|
from . import server.groups as groups
|
||||||
|
from . import server.request as request
|
||||||
|
from . import set_vars
|
||||||
|
from .backup import Backup, BackupError
|
||||||
|
from calculate.core.utils.cl_backup import ClBackupAction
|
||||||
|
from calculate.core.utils.cl_backup_restore import ClBackupRestoreAction
|
||||||
|
from calculate.core.server.func import WsdlBase
|
||||||
|
from calculate.core.utils.cl_core_setup import ClCoreSetupAction
|
||||||
|
from calculate.core.utils.cl_core_patch import ClCorePatchAction
|
||||||
|
from calculate.core.utils.cl_config import ClConfigAction
|
||||||
|
from calculate.core.utils.cl_core_dispatch import ClCoreDispatchAction
|
||||||
|
from calculate.core.utils.cl_core_view_cert import ClCoreViewCert
|
||||||
|
from calculate.core.utils.cl_core_group import (
|
||||||
|
ClCoreGroupShow, ClCoreGroupMod, ClCoreGroupAdd, ClCoreGroupDel)
|
||||||
|
from calculate.core.utils.cl_core_request import (
|
||||||
|
ClCoreRequestShow, ClCoreRequestConfirm, ClCoreRequestDel)
|
||||||
|
from calculate.core.utils.cl_core_variables import (ClCoreVariables,
|
||||||
|
ClCoreVariablesShow)
|
||||||
|
from calculate.core.utils.cl_core_custom import ClCoreCustomAction
|
||||||
|
from calculate.core.utils.cl_core_restart import ClCoreRestartAction
|
||||||
|
from calculate.core.variables.action import Actions
|
||||||
|
|
||||||
|
|
||||||
|
class Wsdl(WsdlBase):
|
||||||
|
methods = [
|
||||||
|
#
|
||||||
|
# Настройка пакета во время установки (cl-core-setup)
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_setup",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Configuration'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Configure a Package"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-core-setup,'
|
||||||
|
'preferences-desktop-default-applications',
|
||||||
|
# метод присутствует в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-setup',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['setup_package'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'UpdateConfigs': setup_package.UpdateConfigs},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreSetupAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError,
|
||||||
|
setup_package.SetupPackageError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'merge', 'cl_verbose_set': "on"},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Configure a package"),
|
||||||
|
normal=('cl_core_pkg_name',),
|
||||||
|
expert=('cl_core_pkg_category',
|
||||||
|
'cl_core_pkg_version_opt',
|
||||||
|
'cl_core_pkg_slot_opt',
|
||||||
|
'cl_core_pkg_path',
|
||||||
|
'cl_core_arch_machine',
|
||||||
|
'cl_templates_locate',
|
||||||
|
'cl_core_pkg_system_set',
|
||||||
|
'cl_core_pkg_desktop_set',
|
||||||
|
'cl_core_pkg_root_set',
|
||||||
|
'cl_verbose_set',
|
||||||
|
'cl_dispatch_conf'),
|
||||||
|
next_label=_("Run"))]},
|
||||||
|
#
|
||||||
|
# Патч исходников пакета (cl-core-patch)
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_patch",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Configuration'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Patch"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метода нет в графической консоли
|
||||||
|
'gui': False,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-patch',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['configure'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'UpdateConfigs': setup_package.UpdateConfigs},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCorePatchAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError,
|
||||||
|
setup_package.SetupPackageError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'patch',
|
||||||
|
'cl_protect_use_set!': 'off'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Configure a package"),
|
||||||
|
normal=('cl_core_pkg_name',),
|
||||||
|
expert=('cl_core_pkg_category',
|
||||||
|
'cl_core_pkg_version',
|
||||||
|
'cl_core_pkg_slot',
|
||||||
|
'cl_core_pkg_path',
|
||||||
|
'cl_core_arch_machine',
|
||||||
|
'cl_templates_locate',
|
||||||
|
'cl_verbose_set'),
|
||||||
|
next_label=_("Run"))]},
|
||||||
|
#
|
||||||
|
# Обновление конфигурационных файлов (cl-dispatch-conf)
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_dispatch",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Update '),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Update Settings"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-core-dispatch,edit-find-replace,computer',
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-dispatch-conf',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['configure'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'UpdateConfigs': setup_package.UpdateConfigs},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreDispatchAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError,
|
||||||
|
setup_package.SetupPackageError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'dispatch'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': []},
|
||||||
|
#
|
||||||
|
# Отобразить сертификаты
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_view_cert",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Show Certificates"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-core-view-cert,certificate-server,'
|
||||||
|
'application-certificate',
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-view-cert',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['certificates'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Certificate': certificate.Certificate},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreViewCert,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {
|
||||||
|
'cl_page_max!': lambda dv: len(dv.Get('cl_list_cert_id'))},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Certificates"),
|
||||||
|
normal=('cl_page_count', 'cl_page_offset'),
|
||||||
|
next_label=_("Next"))]},
|
||||||
|
#
|
||||||
|
# Отобразить детали сертификата
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_detail_view_cert",
|
||||||
|
# категория метода
|
||||||
|
# 'category':__('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Certificate Details"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['certificates'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {},
|
||||||
|
# описание действия
|
||||||
|
'action': None,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Certificate details"),
|
||||||
|
normal=('cl_cert_id', 'cl_cert_groups',
|
||||||
|
'cl_cert_perms'),
|
||||||
|
custom_buttons=[('but0', _("Back"),
|
||||||
|
"core_view_cert",
|
||||||
|
"button")])]},
|
||||||
|
#
|
||||||
|
# Группы
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_group_show",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Show Groups"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-core-group-show,user-group-properties,'
|
||||||
|
'view-certificate-import,application-certificate',
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-group-show',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['core_group'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Groups': groups.Groups},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreGroupShow,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {
|
||||||
|
'cl_page_max!': lambda dv: len(dv.Choice('cl_core_group'))},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Groups"),
|
||||||
|
normal=('cl_page_count', 'cl_page_offset'),
|
||||||
|
next_label=_("Next"))]},
|
||||||
|
#
|
||||||
|
# Отобразить детали группы
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_detail_group",
|
||||||
|
# категория метода
|
||||||
|
# 'category':__('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Group Details"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['core_group'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {},
|
||||||
|
# описание действия
|
||||||
|
'action': None,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Group details"),
|
||||||
|
normal=(
|
||||||
|
'cl_core_group',
|
||||||
|
'cl_core_group_rights'),
|
||||||
|
custom_buttons=[('but0', _("Back"),
|
||||||
|
"core_group_show",
|
||||||
|
"button"),
|
||||||
|
('but1', _("Change"),
|
||||||
|
"core_group_mod",
|
||||||
|
"button"),
|
||||||
|
('but2', _("Delete"),
|
||||||
|
"core_group_del",
|
||||||
|
"button")])]},
|
||||||
|
#
|
||||||
|
# Изменить группу
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_group_mod",
|
||||||
|
# категория метода
|
||||||
|
# 'category':__('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Modify Group"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-groupmod',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['core_group'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Groups': groups.Groups},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreGroupMod,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'modify'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Modify group"),
|
||||||
|
normal=(
|
||||||
|
'cl_core_group',
|
||||||
|
'cl_core_group_rights'),
|
||||||
|
next_label=_("Done"),
|
||||||
|
custom_buttons=[('but2', _("Confirm"),
|
||||||
|
'core_change_group',
|
||||||
|
"button")])]},
|
||||||
|
#
|
||||||
|
# Добавить группу
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_group_add",
|
||||||
|
# категория метода
|
||||||
|
# 'category':__('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Add a Group"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-groupadd',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['core_group'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Groups': groups.Groups},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreGroupAdd,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'add'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Add a group"),
|
||||||
|
normal=(
|
||||||
|
'cl_core_group',
|
||||||
|
'cl_core_group_rights'),
|
||||||
|
next_label=_("Add"))]},
|
||||||
|
#
|
||||||
|
# Удалить группу
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_group_del",
|
||||||
|
# категория метода
|
||||||
|
# 'category':__('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Delete the Group"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-groupdel',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['core_group'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Groups': groups.Groups},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreGroupDel,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'delete'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Delete the group"),
|
||||||
|
normal=('cl_core_group',),
|
||||||
|
next_label=_("Delete"))]},
|
||||||
|
#
|
||||||
|
# Запрос на сертификат
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_request_show",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Show Requests"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-core-request-show,view-certificate-import,'
|
||||||
|
'application-certificate',
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-request-show',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['request'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Request': request.Request},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreRequestShow,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {
|
||||||
|
'cl_page_max!': lambda dv: len(dv.Get('cl_list_req_id'))},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Show requests"),
|
||||||
|
normal=('cl_page_count', 'cl_page_offset'),
|
||||||
|
next_label=_("Next"))]},
|
||||||
|
#
|
||||||
|
# Отобразить детали запроса
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_detail_request",
|
||||||
|
# категория метода
|
||||||
|
# 'category':__('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Request Details"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['request'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {},
|
||||||
|
# описание действия
|
||||||
|
'action': None,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Group details"),
|
||||||
|
normal=('cl_req_id', 'cl_req_user_name',
|
||||||
|
'cl_req_ip',
|
||||||
|
'cl_req_mac', 'cl_req_date',
|
||||||
|
'cl_req_location',
|
||||||
|
'cl_req_group'),
|
||||||
|
custom_buttons=[('but0', _("Back"),
|
||||||
|
"core_request_show",
|
||||||
|
"button"),
|
||||||
|
('but1', _("Confirm"),
|
||||||
|
"core_request_confirm",
|
||||||
|
"button"),
|
||||||
|
('but2', _("Delete"),
|
||||||
|
"core_request_del",
|
||||||
|
"button")])]},
|
||||||
|
#
|
||||||
|
# Удалить запрос
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_request_del",
|
||||||
|
# категория метода
|
||||||
|
# 'category':__('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Delete the Request"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-request-del',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['request'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Request': request.Request},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreRequestDel,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'delete'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Delete the request"),
|
||||||
|
normal=('cl_req_id',),
|
||||||
|
next_label=_("Delete"))]},
|
||||||
|
#
|
||||||
|
# Подтвердить запрос
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_request_confirm",
|
||||||
|
# категория метода
|
||||||
|
# 'category':__('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Confirm the Request"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-request-confirm',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['request'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Request': request.Request},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreRequestConfirm,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'confirm'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Delete the request"),
|
||||||
|
normal=('cl_req_id', 'cl_req_group'),
|
||||||
|
next_label=_("Delete"))]},
|
||||||
|
#
|
||||||
|
# установить переменные
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_variables",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Setup Variables"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-core-variables,applications-versioncontrol,'
|
||||||
|
'text-x-preview,text-x-makefile',
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-variables',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['setup_variables'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Variables': set_vars.Variables},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreVariables,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Setup variables"),
|
||||||
|
normal=('cl_variable_data',),
|
||||||
|
next_label=_("Save"))]},
|
||||||
|
#
|
||||||
|
# отобразить переменные
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_variables_show",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("View Variables"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': False,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-variables-show',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['configure'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Variables': set_vars.Variables},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreVariablesShow,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Setup variables"),
|
||||||
|
normal=(
|
||||||
|
'cl_variable_filter',
|
||||||
|
'cl_variable_show'),
|
||||||
|
next_label=_("Show"))]},
|
||||||
|
#
|
||||||
|
# Выполнить настройку пакета (cl-config)
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_config",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Configuration'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Config"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': None,
|
||||||
|
# метода нет в графической консоли
|
||||||
|
'gui': False,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-config',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['configure'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'UpdateConfigs': setup_package.UpdateConfigs},
|
||||||
|
# описание действия
|
||||||
|
'action': ClConfigAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError,
|
||||||
|
setup_package.SetupPackageError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'config', 'cl_verbose_set': "on"},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Configure a package"),
|
||||||
|
normal=('cl_core_pkg_name',),
|
||||||
|
expert=('cl_core_pkg_category',
|
||||||
|
'cl_core_pkg_version_opt',
|
||||||
|
'cl_core_pkg_slot_opt',
|
||||||
|
'cl_templates_locate',
|
||||||
|
'cl_verbose_set'),
|
||||||
|
next_label=_("Run"))]},
|
||||||
|
#
|
||||||
|
# отобразить переменные
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_custom",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Custom Action"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-core-custom,gnome-desktop-config,desktop-config',
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-custom',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['custom_configure'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'UpdateConfigs': setup_package.UpdateConfigs},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreCustomAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_verbose_set': "on", 'cl_human_edit_set': "on"},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Custom action"),
|
||||||
|
normal=(
|
||||||
|
'ac_custom_name', 'cl_human_edit_set',
|
||||||
|
'cl_verbose_set'),
|
||||||
|
expert=(
|
||||||
|
'ur_core_login', 'cl_core_arch_machine',
|
||||||
|
'cl_templates_locate',
|
||||||
|
'cl_dispatch_conf'),
|
||||||
|
next_label=_("Run"))]},
|
||||||
|
#
|
||||||
|
# перезапустить сервис calculate core
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "core_restart",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Utilities'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Restart calculate-core"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-core-restart,view-refresh',
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-core-restart',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['core_restart'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'UpdateConfigs': setup_package.UpdateConfigs},
|
||||||
|
# описание действия
|
||||||
|
'action': ClCoreRestartAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'restart'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': []},
|
||||||
|
#
|
||||||
|
# создание резервной копии настроек
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "backup",
|
||||||
|
# категория метода
|
||||||
|
'category':__('Backup'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Backup"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-backup',
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-backup',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['backup'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Backup': Backup},
|
||||||
|
# описание действия
|
||||||
|
'action': ClBackupAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (BackupError, VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': Actions.Backup},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("System backup"),
|
||||||
|
normal=('cl_backup_verbose_set',),
|
||||||
|
next_label=_("Run"))]},
|
||||||
|
#
|
||||||
|
# восстановление настроек из резервной копии
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "backup_restore",
|
||||||
|
# категория метода
|
||||||
|
'category':__('Backup'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Restore"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-backup-restore',
|
||||||
|
# метод в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-backup-restore',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['backup'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Backup': Backup},
|
||||||
|
# описание действия
|
||||||
|
'action': ClBackupRestoreAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "core",
|
||||||
|
'native_error': (BackupError, VariableError, DataVarsError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': Actions.BackupRestore,
|
||||||
|
'core.cl_backup_action': Actions.Restore},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("System restore"),
|
||||||
|
normal=('cl_backup_verbose_set',),
|
||||||
|
brief=('cl_backup_file', 'cl_backup_time'),
|
||||||
|
next_label=_("Run"))],
|
||||||
|
'brief': {'next': __("Run"),
|
||||||
|
'name': __("System restore")}},
|
||||||
|
]
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2015-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
class EmergeMark:
|
||||||
|
Schedule = "schedule"
|
||||||
|
Premerge = "check updates"
|
||||||
|
PythonUpdater = "update python modules"
|
||||||
|
PerlCleaner = "update perl modules"
|
||||||
|
KernelModules = "update kernel modules"
|
||||||
|
Depclean = "depclean"
|
||||||
|
XorgModules = "update xorg modules"
|
||||||
|
PreservedLibs = "update preserved libs"
|
||||||
|
RevdepRebuild = "revdep rebuild"
|
||||||
|
Prelink = "prelink"
|
||||||
|
Automagic = "check for auto depends"
|
@ -0,0 +1,47 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2010-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.update.update import UpdateError
|
||||||
|
from calculate.lib.utils.git import GitError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_update3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClSetupUpdateAction(Action):
|
||||||
|
"""
|
||||||
|
Действие для настройки параметров автопроверки обновлений
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError, UpdateError, GitError)
|
||||||
|
|
||||||
|
successMessage = __("Updates autocheck configured!")
|
||||||
|
failedMessage = __("Failed to configure the updates autocheck procedure!")
|
||||||
|
interruptMessage = __("Configuration manually interrupted")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'set_variables',
|
||||||
|
'method': 'Update.setAutocheckParams(cl_update_autocheck_set,'
|
||||||
|
'cl_update_autocheck_interval,'
|
||||||
|
'cl_update_other_set,'
|
||||||
|
'cl_update_cleanpkg_set)'}
|
||||||
|
]
|
@ -0,0 +1,147 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2010-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from calculate.core.server.func import Action, Tasks
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
|
||||||
|
from calculate.lib.cl_template import TemplatesError
|
||||||
|
from calculate.lib.utils.binhosts import BinhostError
|
||||||
|
from calculate.lib.utils.files import FilesError
|
||||||
|
from calculate.update.update import UpdateError
|
||||||
|
from calculate.lib.utils.git import GitError
|
||||||
|
|
||||||
|
_ = lambda x: x
|
||||||
|
setLocalTranslate('cl_update3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class ClUpdateProfileAction(Action):
|
||||||
|
"""
|
||||||
|
Действие обновление конфигурационных файлов
|
||||||
|
"""
|
||||||
|
# ошибки, которые отображаются без подробностей
|
||||||
|
native_error = (FilesError,
|
||||||
|
TemplatesError, BinhostError,
|
||||||
|
UpdateError, GitError)
|
||||||
|
|
||||||
|
successMessage = __("The profile was successfully updated")
|
||||||
|
failedMessage = __("Failed to update the profile")
|
||||||
|
interruptMessage = __("Profile update manually interrupted")
|
||||||
|
|
||||||
|
# список задач для действия
|
||||||
|
tasks = [
|
||||||
|
{'name': 'migrate_repository',
|
||||||
|
'method': 'Update.migrateCacheRepository('
|
||||||
|
'cl_update_profile_url,cl_update_profile_branch,'
|
||||||
|
'cl_update_profile_storage)',
|
||||||
|
'message': __("Repository transfer"),
|
||||||
|
'condition': lambda Get: not (
|
||||||
|
Get('cl_update_profile_storage').is_local(
|
||||||
|
Get('cl_update_profile_url'),
|
||||||
|
Get('cl_update_profile_branch')))
|
||||||
|
},
|
||||||
|
{'name': 'reconfigure_vars1',
|
||||||
|
'method': 'Update.invalidateVariables("cl_update_profile_storage")',
|
||||||
|
'depend': Tasks.has('migrate_repository')
|
||||||
|
},
|
||||||
|
{'name': 'check_datavars',
|
||||||
|
'error': _("Profile not found in master"),
|
||||||
|
'condition': lambda Get: not Get('update.cl_update_profile_datavars')
|
||||||
|
},
|
||||||
|
{'name': 'drop_binhosts',
|
||||||
|
'method': 'Update.drop_binhosts(update.cl_update_profile_datavars)'
|
||||||
|
},
|
||||||
|
{'name': 'reconfigure_vars',
|
||||||
|
'method': 'Update.reconfigureProfileVars(cl_update_profile_datavars,'
|
||||||
|
'cl_chroot_path)'
|
||||||
|
},
|
||||||
|
{'name': 'reps_synchronization',
|
||||||
|
'group': __("Repositories synchronization"),
|
||||||
|
'tasks': [
|
||||||
|
{'name': 'sync_reps',
|
||||||
|
'foreach': 'cl_update_profile_sync_rep',
|
||||||
|
'message': __("Syncing the {eachvar:capitalize} repository"),
|
||||||
|
'method': 'Update.syncRepositories(eachvar)',
|
||||||
|
},
|
||||||
|
{'name': 'sync_reps:regen_cache',
|
||||||
|
'foreach': 'cl_update_sync_overlay_rep',
|
||||||
|
'message': __("Updating the {eachvar:capitalize} repository cache"),
|
||||||
|
'essential': False,
|
||||||
|
'method': 'Update.regenCache(eachvar)',
|
||||||
|
'condition': (
|
||||||
|
lambda Get: (Get('cl_update_outdate_set') == 'on' and
|
||||||
|
Get('cl_update_metadata_force') != 'skip' or
|
||||||
|
Get('cl_update_metadata_force') == 'force'))
|
||||||
|
},
|
||||||
|
{'name': 'emerge_metadata',
|
||||||
|
'message': __("Metadata transfer"),
|
||||||
|
'method': 'Update.emergeMetadata()',
|
||||||
|
'condition': (
|
||||||
|
lambda Get: (Get('cl_update_outdate_set') == 'on' and
|
||||||
|
Get('cl_update_metadata_force') != 'skip' or
|
||||||
|
Get('cl_update_metadata_force') == 'force'))
|
||||||
|
},
|
||||||
|
{'name': 'eix_update',
|
||||||
|
'message': __("Updating the eix cache for "
|
||||||
|
"{cl_update_eix_repositories}"),
|
||||||
|
'method': 'Update.eixUpdate(cl_repository_name)',
|
||||||
|
'condition': (
|
||||||
|
lambda Get: (Get('cl_update_outdate_set') == 'on' and
|
||||||
|
Get('cl_update_eixupdate_force') != 'skip' or
|
||||||
|
Get('cl_update_eixupdate_force') == 'force'))
|
||||||
|
},
|
||||||
|
# сообщение удачного завершения при обновлении репозиториев
|
||||||
|
{'name': 'success_syncrep',
|
||||||
|
'message': __("Synchronization finished"),
|
||||||
|
'depend': (Tasks.success() & Tasks.has_any("sync_reps",
|
||||||
|
"sync_other_reps",
|
||||||
|
"emerge_metadata",
|
||||||
|
"eix_update")),
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{'name': 'reps_synchronization',
|
||||||
|
'group': __("Setting up the profile"),
|
||||||
|
'tasks': [
|
||||||
|
{'name': 'set_profile',
|
||||||
|
'message': __("Switching to profile {cl_update_profile_system}"),
|
||||||
|
'method': 'Update.setProfile(cl_update_profile_system)'
|
||||||
|
},
|
||||||
|
{'name': 'rename_custom',
|
||||||
|
'method': 'Update.rename_custom_files()',
|
||||||
|
},
|
||||||
|
{'name': 'revision',
|
||||||
|
'message': __("Fixing the settings"),
|
||||||
|
'method': 'Update.applyProfileTemplates(cl_template_clt_set,'
|
||||||
|
'True,False,"update_profile")',
|
||||||
|
'condition': lambda Get: Get('cl_templates_locate')
|
||||||
|
},
|
||||||
|
{'name': 'reconfigure',
|
||||||
|
'message': __("The system is being configured"),
|
||||||
|
'method': 'Update.applyProfileTemplates(cl_template_clt_set,'
|
||||||
|
'True,False,"merge")',
|
||||||
|
'condition': lambda Get: (
|
||||||
|
Get('cl_update_templates_locate') and
|
||||||
|
Get('cl_update_skip_setup_set') == 'off')
|
||||||
|
},
|
||||||
|
{'name': 'dispatch_conf',
|
||||||
|
'message': __("Updating configuration files"),
|
||||||
|
'method': 'Update.dispatchConf()',
|
||||||
|
'condition': lambda Get: Get('cl_dispatch_conf') != 'skip'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,183 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2010-2016 Mir Calculate. http://www.calculate-linux.org
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from calculate.lib.datavars import VariableError,DataVarsError
|
||||||
|
|
||||||
|
from calculate.core.server.func import WsdlBase
|
||||||
|
from calculate.install.install import InstallError
|
||||||
|
from .update import Update, UpdateError
|
||||||
|
from calculate.lib.utils.git import GitError
|
||||||
|
from utils.cl_update import ClUpdateAction
|
||||||
|
from utils.cl_update_profile import ClUpdateProfileAction
|
||||||
|
from utils.cl_setup_update import ClSetupUpdateAction
|
||||||
|
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate, _
|
||||||
|
|
||||||
|
setLocalTranslate('cl_update3', sys.modules[__name__])
|
||||||
|
__ = getLazyLocalTranslate(_)
|
||||||
|
|
||||||
|
|
||||||
|
class Wsdl(WsdlBase):
|
||||||
|
methods = [
|
||||||
|
#
|
||||||
|
# Обновить текущую конфигурацию системы (world,ревизия)
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "update",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Update '),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Update the System"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-update',
|
||||||
|
# метод присутствует в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-update',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['update'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Update': Update},
|
||||||
|
# описание действия
|
||||||
|
'action': ClUpdateAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "update",
|
||||||
|
'native_error': (VariableError, DataVarsError,
|
||||||
|
InstallError, UpdateError, GitError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'sync'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Update the system"),
|
||||||
|
normal=(
|
||||||
|
'cl_update_binhost_stable_opt_set',
|
||||||
|
'cl_update_binhost_recheck_set',
|
||||||
|
'cl_update_with_bdeps_opt_set'
|
||||||
|
),
|
||||||
|
expert=(
|
||||||
|
'cl_update_sync_only_set',
|
||||||
|
'cl_update_other_set',
|
||||||
|
'cl_update_pretend_set',
|
||||||
|
'cl_update_sync_rep',
|
||||||
|
'cl_update_emergelist_set',
|
||||||
|
'cl_update_check_rep_set',
|
||||||
|
'cl_update_force_fix_set',
|
||||||
|
'cl_update_world',
|
||||||
|
'cl_update_gpg_force',
|
||||||
|
'cl_update_egencache_force',
|
||||||
|
'cl_update_eixupdate_force',
|
||||||
|
'cl_update_revdep_rebuild_set',
|
||||||
|
'cl_update_wait_another_set',
|
||||||
|
'cl_update_autocheck_schedule_set',
|
||||||
|
'cl_update_onedepth_set',
|
||||||
|
'cl_update_cleanpkg_set',
|
||||||
|
'cl_update_branch_data',
|
||||||
|
'cl_templates_locate',
|
||||||
|
'cl_verbose_set', 'cl_dispatch_conf'),
|
||||||
|
next_label=_("Run"))]},
|
||||||
|
#
|
||||||
|
# Сменить профиль
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "update_profile",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Update '),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Change the Profile"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-update-profile,'
|
||||||
|
'notification-display-brightness-full,gtk-dialog-info,'
|
||||||
|
'help-hint',
|
||||||
|
# метод присутствует в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-update-profile',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['change_profile'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Update': Update},
|
||||||
|
# описание действия
|
||||||
|
'action': ClUpdateProfileAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "update",
|
||||||
|
'native_error': (VariableError, DataVarsError,
|
||||||
|
InstallError, UpdateError, GitError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'update_profile'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Repository"),
|
||||||
|
brief=('cl_update_profile_repo_name',),
|
||||||
|
hide=('cl_update_profile_url',
|
||||||
|
'cl_update_profile_sync_set'),
|
||||||
|
normal=('cl_update_profile_url',),
|
||||||
|
expert=('cl_update_profile_sync_set',)),
|
||||||
|
lambda group: group(_("Profile"),
|
||||||
|
normal=('cl_update_profile_system',
|
||||||
|
'cl_update_world'),
|
||||||
|
expert=('cl_update_skip_setup_set',
|
||||||
|
'cl_update_templates_locate',
|
||||||
|
'cl_verbose_set',
|
||||||
|
'cl_dispatch_conf'),
|
||||||
|
hide=('cl_update_templates_locate',
|
||||||
|
'cl_verbose_set',
|
||||||
|
'cl_dispatch_conf'),
|
||||||
|
brief=('cl_update_profile_system',
|
||||||
|
'cl_update_profile_linux_fullname',
|
||||||
|
'cl_update_profile_depend_data')
|
||||||
|
)],
|
||||||
|
'brief': {'next': __("Run"),
|
||||||
|
'name': __("Set the profile")}},
|
||||||
|
#
|
||||||
|
# Настроить автопроверку обновлений
|
||||||
|
#
|
||||||
|
{
|
||||||
|
# идентификатор метода
|
||||||
|
'method_name': "setup_update",
|
||||||
|
# категория метода
|
||||||
|
'category': __('Configuration'),
|
||||||
|
# заголовок метода
|
||||||
|
'title': __("Update Check"),
|
||||||
|
# иконка для графической консоли
|
||||||
|
'image': 'calculate-setup-update,software-properties,preferences-desktop',
|
||||||
|
# метод присутствует в графической консоли
|
||||||
|
'gui': True,
|
||||||
|
# консольная команда
|
||||||
|
'command': 'cl-setup-update',
|
||||||
|
# права для запуска метода
|
||||||
|
'rights': ['setup_update'],
|
||||||
|
# объект содержащий модули для действия
|
||||||
|
'logic': {'Update': Update},
|
||||||
|
# описание действия
|
||||||
|
'action': ClSetupUpdateAction,
|
||||||
|
# объект переменных
|
||||||
|
'datavars': "update",
|
||||||
|
'native_error': (VariableError, DataVarsError,
|
||||||
|
InstallError, UpdateError, GitError),
|
||||||
|
# значения по умолчанию для переменных этого метода
|
||||||
|
'setvars': {'cl_action!': 'merge'},
|
||||||
|
# описание груп (список лямбда функций)
|
||||||
|
'groups': [
|
||||||
|
lambda group: group(_("Updates autocheck settings"),
|
||||||
|
normal=('cl_update_autocheck_set',
|
||||||
|
'cl_update_autocheck_interval',
|
||||||
|
'cl_update_cleanpkg_set',
|
||||||
|
'cl_update_other_set'),
|
||||||
|
next_label=_("Save"))]},
|
||||||
|
]
|
Loading…
Reference in new issue