You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.1 KiB

  1. #-*- coding: utf-8 -*-
  2. # Copyright 2010-2013 Calculate Ltd. http://www.calculate-linux.org
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. import sys
  16. from calculate.core.server.func import Action
  17. from calculate.lib.cl_lang import setLocalTranslate,getLazyLocalTranslate
  18. from calculate.lib.utils.files import FilesError
  19. from calculate.install.install import (MigrationError, TemplatesError,
  20. InstallError)
  21. setLocalTranslate('cl_update3',sys.modules[__name__])
  22. __ = getLazyLocalTranslate(_)
  23. class ClUpdateAction(Action):
  24. """
  25. Действие обновление конфигурационных файлов
  26. """
  27. # ошибки, которые отображаются без подробностей
  28. native_error = (FilesError,)
  29. successMessage = None
  30. failedMessage = __("Revision update failed")
  31. interruptMessage = __("Update manually interrupted")
  32. # список задач для дейсвия
  33. tasks = [
  34. {'name':'dispatch',
  35. 'method':'Install.applyTemplates(install.cl_source,cl_template_clt_set,'\
  36. 'True,None)',
  37. },
  38. # сообщение удачного завершения при обновлении ревизии
  39. {'name':'success_rev',
  40. 'message' : __("Revision update finished!"),
  41. 'condition':lambda Get:Get('cl_update_rev_set') == 'on'
  42. },
  43. # сообщение удачного завершения при пересоздании world
  44. {'name':'success_world',
  45. 'message' : __("World rebuild finished!"),
  46. 'condition':lambda Get:Get('cl_rebuild_world_set') == 'on'
  47. }]