403Webshell
Server IP : 69.72.244.102  /  Your IP : 216.73.216.43
Web Server : LiteSpeed
System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
User : konzalta ( 1271)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/1621799/root/usr/lib/python3.6/site-packages/ipapython/install/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/1621799/root/usr/lib/python3.6/site-packages/ipapython/install/common.py
#
# Copyright (C) 2015  FreeIPA Contributors see COPYING for license
#

"""
Common stuff.
"""

import logging

from . import core
from .util import from_

__all__ = ['step', 'Installable', 'Interactive', 'installer',
           'uninstaller']

logger = logging.getLogger(__name__)


def step():
    def decorator(func):
        cls = core.Component(Step)
        cls._installer = staticmethod(func)
        return cls

    return decorator


class Installable(core.Configurable):
    """
    Configurable which does install or uninstall.
    """

    uninstalling = core.Property(False)

    def _get_components(self):
        components = super(Installable, self)._get_components()
        if self.uninstalling:  # pylint: disable=using-constant-test
            components = reversed(list(components))
        return components

    def _configure(self):
        if self.uninstalling:  # pylint: disable=using-constant-test
            return self._uninstall()
        else:
            return self._install()

    def _install(self):
        assert not hasattr(super(Installable, self), '_install')

        return super(Installable, self)._configure()

    def _uninstall(self):
        assert not hasattr(super(Installable, self), '_uninstall')

        return super(Installable, self)._configure()


class Step(Installable):
    @property
    def parent(self):
        raise AttributeError('parent')

    def _install(self):
        for unused in self._installer(self.parent):
            yield from_(super(Step, self)._install())

    @staticmethod
    def _installer(obj):
        yield

    def _uninstall(self):
        for unused in self._uninstaller(self.parent):
            yield from_(super(Step, self)._uninstall())

    @staticmethod
    def _uninstaller(obj):
        yield

    @classmethod
    def uninstaller(cls, func):
        cls._uninstaller = staticmethod(func)
        return cls


class Interactive(core.Configurable):
    interactive = core.Property(False)


def installer(cls):
    class Installer(cls, Installable):
        def __init__(self, **kwargs):
            super(Installer, self).__init__(uninstalling=False,
                                            **kwargs)
    Installer.__name__ = 'installer({0})'.format(cls.__name__)

    return Installer


def uninstaller(cls):
    class Uninstaller(cls, Installable):
        def __init__(self, **kwargs):
            super(Uninstaller, self).__init__(uninstalling=True,
                                              **kwargs)
    Uninstaller.__name__ = 'uninstaller({0})'.format(cls.__name__)

    return Uninstaller

Youez - 2016 - github.com/yon3zu
LinuXploit