vanhempi 169141c918
commit 00757899b9

@ -1,37 +0,0 @@
# -*- 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.lib.datavars import ActionVariable
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_ldap3', sys.modules[__name__])
class Actions(object):
Setup = "ldap_setup"
class VariableAcLdapSetup(ActionVariable):
"""
Action variable which has value "on" for prepare squash
"""
def action(self, cl_action):
if cl_action == Actions.Setup:
return "on"
return "off"

@ -20,13 +20,13 @@ from calculate.lib.utils.tools import AddonError
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_ldap3', sys.modules[__name__])
setLocalTranslate('cl_unix3', sys.modules[__name__])
class DataVarsLdap(DataVars):
class DataVarsUnix(DataVars):
"""Variable class for desktop package"""
var_module = "ldap"
var_module = "unix"
def importLdap(self, **args):
def importUnix(self, **args):
"""Import desktop variables"""
self.importVariables()
self.importVariables('calculate.%s.variables' % self.var_module)

@ -15,25 +15,30 @@
# limitations under the License.
import sys
import os
from os import path
from calculate.core.server.func import MethodsInterface
from calculate.server.server import Server
from calculate.lib.utils.files import listDirectory
from calculate.ldap.ldap import Ldap
import shutil
_ = lambda x: x
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate)
setLocalTranslate('cl_ldap3', sys.modules[__name__])
setLocalTranslate('cl_unix3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
class LdapError(Exception):
class UnixError(Exception):
pass
class Ldap(MethodsInterface):
class Unix(Ldap):
"""Основной объект для выполнения действий связанных
с настройкой LDAP сервиса
с настройкой Unix сервиса
"""
class Method(object):
Setup = "ldap_setup"
Setup = "unix_setup"
All = (Setup,)
def init(self):

@ -19,29 +19,33 @@ 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.files import FilesError
from ..ldap import LdapError
from calculate.lib.datavars import VariableError
from calculate.server.variables.action import Actions
from ..unix import UnixError, Unix
from calculate.ldap.ldap import LdapError
from calculate.server.server import ServerError
_ = lambda x: x
setLocalTranslate('cl_ldap3', sys.modules[__name__])
setLocalTranslate('cl_unix3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
class ClLdapSetupAction(Action):
class ClUnixSetupAction(Action):
"""
Действие обновление конфигурационных файлов
"""
# ошибки, которые отображаются без подробностей
native_error = (FilesError,
TemplatesError,
VariableError,
ServerError,
UnixError,
LdapError)
successMessage = __("SUCCESS")
failedMessage = __("FAILED")
interruptMessage = __("INTERRUPT")
successMessage = __("Unix server configured!")
failedMessage = __("Failed to configure Unix server!")
interruptMessage = __("Unix server configuration manually interrupted")
# список задач для действия
tasks = [
{'name': 'test',
'message': 'test'
}
]

@ -15,6 +15,6 @@
# limitations under the License.
import action
import ldap
import unix
section = "ldap"
section = "unix"

@ -15,6 +15,8 @@
# limitations under the License.
import sys
from calculate.lib.datavars import ActionVariable
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_ldap3', sys.modules[__name__])
setLocalTranslate('cl_unix3', sys.modules[__name__])

@ -0,0 +1,51 @@
# -*- 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.lib.datavars import (ReadonlyVariable, Variable,
VariableInterface, VariableError)
from calculate.lib.utils.common import genpassword
from calculate.lib.utils.tools import repeater
_ = lambda x: x
from calculate.lib.cl_lang import (setLocalTranslate, getLazyLocalTranslate)
setLocalTranslate('cl_unix3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
class HashHelper(VariableInterface):
"""
Хэш пароля для LDAP
"""
source = ""
hash_var = "ld_encrypt"
def get(self):
return SlapPasswd(self.Get(self.hash_var)).get_hash(
self.Get(self.source))
class RandomPasswordHelper(VariableInterface):
"""
Генератор пароля
"""
password_len = 9
def get(self):
return genpassword(self.password_len).strip()

@ -19,14 +19,15 @@ import sys
from calculate.lib.datavars import VariableError, DataVarsError
from calculate.core.server.func import WsdlBase
from .ldap import Ldap, LdapError
from .variables.action import Actions as LdapActions
from utils.cl_ldap_setup import ClLdapSetupAction
from .unix import Unix, UnixError
from calculate.ldap.ldap import LdapError
from calculate.server.variables.action import Actions as ServerActions
from utils.cl_unix_setup import ClUnixSetupAction
_ = lambda x: x
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate
setLocalTranslate('cl_ldap3', sys.modules[__name__])
setLocalTranslate('cl_unix3', sys.modules[__name__])
__ = getLazyLocalTranslate(_)
@ -37,9 +38,9 @@ class Wsdl(WsdlBase):
#
{
# идентификатор метода
'method_name': Ldap.Method.Setup,
'method_name': Unix.Method.Setup,
# категория метода
'category': __('LDAP'),
'category': __('Unix'),
# заголовок метода
'title': __("Setup"),
# иконка для графической консоли
@ -47,28 +48,32 @@ class Wsdl(WsdlBase):
# метод присутствует в графической консоли
'gui': True,
# консольная команда
'command': 'cl-ldap-setup',
'command': 'cl-unix-setup',
# права для запуска метода
'rights': ['ldap'],
'rights': ['unix'],
# объект содержащий модули для действия
'logic': {'Ldap': Ldap},
'logic': {'Unix': Unix},
# описание действия
'action': ClLdapSetupAction,
'action': ClUnixSetupAction,
# объект переменных
'datavars': "ldap",
'native_error': (VariableError, DataVarsError, LdapError),
'datavars': "unix",
'native_error': (VariableError, DataVarsError, LdapError, UnixError),
# значения по умолчанию для переменных этого метода
'setvars': {'cl_action!': LdapActions.Setup},
'setvars': {'cl_action!': ServerActions.Setup,
'server.cl_server_name!': "unix",
'cl_autoupdate_set': 'on'
# 'cl_dispatch_conf_default': "usenew"
},
# описание груп (список лямбда функций)
'groups': [
lambda group: group(
_("Repository"),
brief=(),
_("Unix server"),
brief=('ldap.ld_base_dn',),
hide=(),
normal=(),
expert=()),
],
'brief': {'next': __("Perform"),
'name': __("Setup LDAP"),}
'name': __("Setup Unix"),}
},
]

@ -1,7 +1,7 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# setup.py --- Setup script for calculate-ldap
# setup.py --- Setup script for calculate-unix
# Copyright 2016 Mir Calculate. http://www.calculate-linux.org
#
@ -17,7 +17,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__app__ = "calculate-ldap"
__app__ = "calculate-unix"
__version__ = "3.5.0_alpha1"
import os
@ -27,18 +27,20 @@ from distutils.command import install_data as module_install_data
from distutils.util import change_root, convert_path
packages = [
"calculate."+str('.'.join(root.split(os.sep)[1:]))
for root, dirs, files in os.walk('pym/ldap')
"calculate." + str('.'.join(root.split(os.sep)[1:]))
for root, dirs, files in os.walk('pym/unix')
if '__init__.py' in files
]
]
print packages
setup(
name=__app__,
version=__version__,
description="LDAP service for Calculate utilities",
description="Unix service for Calculate utilities",
author="Calculate Ltd.",
author_email="support@calculate.ru",
url="http://calculate-linux.org",
license="http://www.apache.org/licenses/LICENSE-2.0",
package_dir = {'calculate.ldap': "pym/ldap"},
packages = packages)
package_dir={'calculate.unix': "pym/unix", },
packages=packages)

Ladataan…
Peruuta
Tallenna