Example #1
0
#   value    - default variable value
#   select   - list of posible values for variable
#   hide - flag, if it is True, then the variable is not printable
#   printval - print value of variable

from calculate.lib.datavars import Variable,ReadonlyVariable,VariableError
import os, glob, sys
try:
    import OpenSSL
except:
    OpenSSL = None

from calculate.lib.cl_lang import setLocalTranslate
from calculate.lib.utils.files import readLinesFile
#from calculate.api.cert_cmd import find_id_cert
setLocalTranslate('cl_core3',sys.modules[__name__])

class VariableClAllReqId(Variable):
    def get(self):
        data_path = self.Get('cl_core_data')
        result = []
        cert_dir =  data_path + '/client_certs/'
        for filename in glob.glob(cert_dir+"*"):
            if filename.endswith('.csr'):
                temp = filename.split('.')[0].split('/')
                id = temp[len(temp)-1]
                try:
                    result.append(id)
                except:
                    pass
        return result
Example #2
0
import os
import sys
import re
from os import path
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
from calculate.lib.utils.portage import isPkgInstalled
from calculate.lib.utils.files import process,STDOUT,getProgPath
from calculate.lib.utils.common import (getVideoFromXorgLog,
                getVideoFromXorgConf, getVideoFromCmdLine,
                getAvailableVideo, getValueFromCmdLine,
                getCompositeFromXorgconf, getVideoFromModules,
                getVideoFromVendor,getInstalledVideo)

from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_install3',sys.modules[__name__])

class VideoVariable(Variable):
    """
    Video variables not using for flash installation
    """
    xorg_need = True

    def uncompatible(self):
        """
        Video setting up unavailable for flash installation
        """
        if self.Get('os_install_root_type') == 'flash':
            return \
                _("Video configuration unavailable for Flash install")
        if self.Get('os_install_x11_server_set') == 'no' and self.xorg_need:
Example #3
0
#  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.

__app__ = "calculate-client"
__version__ = "3.1.4"

import os
import sys
from calculate.lib.datavars import DataVars

from calculate.lib.cl_lang import setLocalTranslate

setLocalTranslate("cl_client3", sys.modules[__name__])


class DataVarsClient(DataVars):
    """Variable class for client package"""

    def importClient(self, **args):
        """Import client variables"""
        self.importVariables()
        self.importVariables("calculate.client.variables")
        self.defaultModule = "client"
Example #4
0
# -*- coding: utf-8 -*-
import sys, time
from array import array

from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('calculate_console',sys.modules[__name__])

try:
    from fcntl import ioctl
    import termios
except ImportError:
    pass
#import signal

class ProgressBarWidgetHFill(object):
    def update(self, pbar, width):
        pass

class ETA(object):
    "Widget for the Estimated Time of Arrival"
    def format_time(self, seconds):
        return time.strftime('%H:%M:%S', time.gmtime(seconds))
    def update(self, pbar):
        if pbar.finished:
            return _('Time').decode('utf-8') + ': %s' \
                                    %self.format_time(pbar.seconds_elapsed)
        else:
            return _('Time').decode('utf-8') + ': %s' \
                                    %self.format_time(pbar.seconds_elapsed)

class Percentage(object):
Example #5
0
from sudsds.transport.http import (
    HttpTransport,
    SUDSHTTPRedirectHandler,
    CheckingHTTPSConnection,
    CheckingHTTPSHandler,
    PYOPENSSL_AVAILABLE,
    PyOpenSSLSocket,
)
from sudsds.transport import Transport
from sudsds.properties import Unskin
from cookielib import CookieJar, DefaultCookiePolicy
from logging import getLogger
from calculate.console.datavars import DataVarsConsole
from calculate.lib.cl_lang import setLocalTranslate

setLocalTranslate("cl_console3", sys.modules[__name__])
# import cert_func.verify
log = getLogger(__name__)
flag = 0


class Client_suds(Client):
    def set_parameters(self, path_to_cert, CERT_FILE, PKEY_FILE):
        self.path_to_cert = path_to_cert
        if not CERT_FILE:
            CERT_FILE = ""
        self.CERT_FILE = CERT_FILE
        self.REQ_FILE = path_to_cert + "client.csr"
        self.PKEY_FILE = PKEY_FILE
        self.SID_FILE = path_to_cert + "sid.int"
        self.CRL_PATH = path_to_cert + "ca/crl/"
Example #6
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 os import path
from calculate.core.server.func import Action,Tasks
from calculate.lib.cl_lang import setLocalTranslate,getLazyLocalTranslate
from calculate.lib.utils.files import FilesError, isMount
from calculate.desktop.desktop import DesktopError
from calculate.lib.cl_template import TemplatesError

setLocalTranslate('cl_desktop3',sys.modules[__name__])
__ = getLazyLocalTranslate(_)

class ClDesktopLogoutAction(Action):
    """
    Вывести пользователя из X сессии
    """
    # ошибки, которые отображаются без подробностей
    native_error = (FilesError,DesktopError,TemplatesError)

    successMessage = __("The user logged out from the session!")
    failedMessage = __("Unable to logout the user")
    interruptMessage = __("Logout manually interrupted")

    # список задач для действия
    tasks = [
Example #7
0
#      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 os
import sys
from os import path
from calculate.lib.datavars import Variable, VariableError, ReadonlyVariable

from calculate.lib.cl_lang import setLocalTranslate

setLocalTranslate("cl_update3", sys.modules[__name__])


class VariableAcUpdateSync(ReadonlyVariable):
    """
    Action variable which has value "up" for package install and
    install this package
    """

    def get(self):
        action = self.Get("cl_action")
        if action in ("sync",):
            if self.Get("cl_update_world"):
                return self.Get("cl_update_world")
        return ""
Example #8
0
#  See the License for the specific language governing permissions and
#  limitations under the License.

import os
import sys
from os import path
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
from calculate.lib.utils.files import readLinesFile
from calculate.lib.utils.common import getValueFromCmdLine
from calculate.lib.utils.ip import isOpenPort
import ldap
from calculate.lib.cl_ldap import ldapUser
from calculate.lib.variables.user import LdapHelper

from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_client3',sys.modules[__name__])

class VariableClRemoteHost(Variable):
    """
    IP or domain name of CDS
    """
    value = ""

class VariableClRemoteHostNew(Variable):
    """
    IP or domain name of CDS
    """
    opt = ["cl_remote_host_new"]
    metavalue = "DOMAIN"
    type = "choiceedit"
    value = ""
Example #9
0
#  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 re
import sys

import sys
import re
from os import path
from files import listDirectory, readFile
from common import getTupleVersion

from calculate.lib.cl_lang import setLocalTranslate

setLocalTranslate("cl_lib3", sys.modules[__name__])

reVerSplit = re.compile(r"^(?:.*/var/db/pkg/)?(?:(\w+-\w+)/)?(.*?)-(([^-]+?)" "(?:-(r\d+))?)(?:.(tbz2))?$", re.S)


def reVerSplitToPV(x):
    """Convert match from reVerSplit to PV hash"""
    if type(x) == str:
        x = reVerSplit.search(x)
    if x:
        match = x.groups()
        return {
            "CATEGORY": match[0] or "",
            "PN": match[1],
            "PF": "%s-%s" % (match[1], match[2]),
            "P": "%s-%s" % (match[1], match[3]),
Example #10
0
#  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 calculate.lib.datavars import Variable
import sys
from os import path

from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_consolegui3',sys.modules[__name__])

class VariableClGuiData(Variable):
    """
    Variable store path to data files
    """
    value = '/var/calculate/server'

class VariableClGuiDatabase(Variable):
    """
    Variable store name files containing clients certificates
    """
    def get(self):
        return path.join(self.Get('cl_gui_data'),"client_certs/Database")

class VariableClGuiImagePath(Variable):