MOON
Server: Apache
System: Linux server2.shieldcogroup.com 3.10.0-1160.119.1.el7.tuxcare.els12.x86_64 #1 SMP Fri Nov 8 05:49:38 UTC 2024 x86_64
User: jacom (1029)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python2.7/site-packages/leapp/actors/__init__.pyc
�
9�Egc@sddlZddlZddlZddlZyddlmZWn!ek
rgddlmZnXddlm	Z	m
Z
ddlmZddl
mZddlmZmZmZmZmZmZddlmZmZddlmZdd	lmZdd
lmZmZddl m!Z!ddl"m#Z#dd
l$m%Z%ddl&m'Z'de(fd��YZ)d�Z*d�Z+d�Z,d�Z-ej.e-e	d�Z/ej.e-ed�Z0ej.e-ed�Z1ej.e-e'd�Z2d�Z3e4e5de5d�Z6d�Z7d�Z8dS(i����N(tSequence(tConfigtretrieve_config(tstring_types(tDialog(tMissingActorAttributeErrortRequestStopAfterPhasetStopActorExecutiontStopActorExecutionErrortWorkflowConfigNotAvailabletWrongAttributeTypeError(tDialogModeltModel(t
ErrorSeverity(tTag(tget_api_modelstpath(tstore_dialog(tinstall_translation_for_actor(tget_flattened_subclasses(tWorkflowAPItActorcBsyeZdZdZeZdZdZdZdZ	dZ
dZd Zd!Z
dZd�Zddded�Zd�Zd�Zed��Zed��Zed��Zed��Zed	��Zed
��Zed��Zd�Zd
�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(ej)dd�Z*d�Z+RS("s�
    The Actor class represents the smallest step in the workflow. It defines what kind
    of data it expects, it consumes (processes) the given data, and it produces data for other
    actors in the workflow.
    cCsi	|jd6tjjtjt|�jj�d6t|�j	d6|j
pXt|�jd6g|jD]}|j	^qfd6g|j
D]}|j	^q�d6g|jD]}|j	^q�d6g|jD]}|j	^q�d6g|jD]}|j�^q�d	6S(
s?
        :return: Serialized information for the actor
        tnameRt
class_nametdescriptiontconfig_schemastconsumestproducesttagstdialogs(RtosRtdirnametsystmodulesttypet
__module__t__file__t__name__Rt__doc__RRRRRt	serialize(tselftctptttd((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyR'^s
&    cCs�d|_|t_tt|��||_|p=tjd�j	|j
�|_||_|r|t
|j|�d�|_nt|j�|_t|_tt|�d�t|�_dS(Nsleapp.actorsR(tNonet_configurationRtcurrent_instanceRR"t
_messagingtloggingt	getLoggertgetChildRtlogtskip_dialogstnexttconsumeRRtconfigRt_pathRR(R(t	messagingtloggertconfig_modelR5((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt__init__ns			$		cCsr|jj||�d}|t|�jkra|jrL|jj|�}qa|jj|�}nt||�|S(s�
        Gets the answers for a dialog. The dialog needs be predefined in :py:attr:`dialogs`.

        :param dialog: Dialog instance to show
        :return: dictionary with the requested answers, None if not a defined dialog
        N(	R0tregister_dialogR-R"RR5tget_answerstrequest_answersR(R(tdialogtanswer((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyR?�s	
cCs|jj|�dS(s�
        Display a message in user interterface currently in use (CLI, GUI).

        It uses one of the dialog renderers in :py:mod:`leapp.dialogs.renderer`.

        :param message: Message to show
        :type message: str
        N(R0tshow_message(R(tmessage((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyRC�s	cCs"|jst|j��n|jS(s]
        Returns the config model generated by specific workflow configuration actor
        (R.R	R(R(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt
configuration�s	cCstjdd�jd�S(s~
        Returns the file paths that are bundled with the actor. (Path to the content of the actor's file directory).
        tLEAPP_FILEStt:(Rtgetenvtsplit(R(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytactor_files_paths�scCs|j|jS(sQ Returns all actor file paths related to the actor and common actors file paths. (RKtcommon_files_paths(R(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytfiles_paths�scCstjdd�jd�S(s+ Returns all common repository file paths. tLEAPP_COMMON_FILESRGRH(RRIRJ(R(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyRL�scCstjdd�jd�S(s
        Returns the tool paths that are bundled with the actor. (Path to the content of the actor's tools directory).
        tLEAPP_TOOLSRGRH(RRIRJ(R(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytactor_tools_paths�scCstjdd�jd�S(s+ Returns all common repository tool paths. tLEAPP_COMMON_TOOLSRGRH(RRIRJ(R(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytcommon_tools_paths�scCs|j|jS(sS Returns all actor tools paths related to the actor and common actors tools paths. (RPRR(R(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyttools_paths�scCs|jj|j|�S(s�
        Finds the first matching folder path within :py:attr:`files_paths`.

        :param name: Name of the folder
        :type name: str
        :return: Found folder path
        :rtype: str or None
        (R9tget_folder_pathRM(R(R((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyRT�s	cCs|jj|j|�S(s�
        Finds the first matching folder path within :py:attr:`common_files_paths`.

        :param name: Name of the folder
        :type name: str
        :return: Found folder path
        :rtype: str or None
        (R9RTRL(R(R((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytget_common_folder_path�s	cCs|jj|j|�S(s�
        Finds the first matching folder path within :py:attr:`actor_files_paths`.

        :param name: Name of the folder
        :type name: str
        :return: Found folder path
        :rtype: str or None
        (R9RTRK(R(R((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytget_actor_folder_path�s	cCs|jj|j|�S(s�
        Finds the first matching file path within :py:attr:`files_paths`.

        :param name: Name of the file
        :type name: str
        :return: Found file path
        :rtype: str or None
        (R9t
get_file_pathRM(R(R((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyRW�s	cCs|jj|j|�S(s�
        Finds the first matching file path within :py:attr:`common_files_paths`.

        :param name: Name of the file
        :type name: str
        :return: Found file path
        :rtype: str or None
        (R9RWRL(R(R((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytget_common_file_paths	cCs|jj|j|�S(s�
        Finds the first matching file path within :py:attr:`actor_files_paths`.

        :param name: Name of the file
        :type name: str
        :return: Found file path
        :rtype: str or None
        (R9RWRK(R(R((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytget_actor_file_paths	cCs|jj|j|�S(s�
        Finds the first matching executable file path within :py:attr:`tools_paths`.

        :param name: Name of the file
        :type name: str
        :return: Found file path
        :rtype: str or None
        (R9t
get_tool_pathRS(R(R((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyRZs	cCs|jj|j|�S(s�
        Finds the first matching executable file path within :py:attr:`common_tools_paths`.

        :param name: Name of the file
        :type name: str
        :return: Found file path
        :rtype: str or None
        (R9RZRR(R(R((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytget_common_tool_path!s	cCs|jj|j|�S(s�
        Finds the first matching executable file path within :py:attr:`actor_tools_paths`.

        :param name: Name of the file
        :type name: str
        :return: Found file path
        :rtype: str or None
        (R9RZRP(R(R((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytget_actor_tool_path,s	cGs�|jtjd<zty|j|�Wn\tk
r7nLtk
re}|j|j|j|j	�nt
k
r�|jj�nXWdtjj
dd�XdS(s7 Runs the actor calling the method :py:func:`process`. tLEAPP_CURRENT_ACTORN(RRtenvirontprocessRRtreport_errorRDtseveritytdetailsRR0trequest_stop_after_phasetpopR-(R(targsterr((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytrun7s

cOs
t��dS(sj Main processing method. In inherited actors, the function needs to be defined to be able to be processed.N(tNotImplementedError(R(Retkwargs((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyR_FscGsn|jrjx^|D]S}t|t|�j�rD|jj||�q|jjdjt|���qWndS(sN
        By calling produce, model instances are stored as messages. Those messages can be then consumed by other actors.

        :param models: Messages to be sent (those model types have to be specified in :py:attr:`produces`
        :type models: Variable number of the derived classes from :py:class:`leapp.models.Model`
        s�Actor is trying to produce a message of type "{}" without mentioning it explicitely in the actor's "produces" tuple. The message will be ignoredN(R0t
isinstanceR"RtproduceR4twarningtformat(R(tmodelstmodel((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyRkJs	
cGs |jr|jj||�SdS(s�
        Retrieve messages specified in the actors :py:attr:`consumes` attribute, and filter message types by
        models.

        :param models: Models to use as a filter for the messages to return
        :type models: Variable number of the derived classes from :py:class:`leapp.models.Model`
        :return: All messages of the specified model(s) produced by other actors
        :rtype: Iterable with messages or an empty tuple
        ((R0R7(R(Rn((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyR7Zs
	c	Csc|jr_tj|�s7|jjd|�tj}n|jjd|d|d|d|�ndS(s�
        Reports an execution error

        :param message: A message to print the possible error
        :type message: str
        :param severity: Severity of the error default :py:attr:`leapp.messaging.errors.ErrorSeverity.ERROR`
        :type severity: str with defined values from :py:attr:`leapp.messaging.errors.ErrorSeverity.ERROR`
        :param details: A dictionary where additional context information is passed along with the error
        :type details: dict
        :return: None
        sJreport_error: Unknown severity value %s was passed - Falling back to ERRORRDRatactorRbN(R0R
tvalidateR4RltERRORR`(R(RDRaRb((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyR`hs	cCs
t|j�S(s�
        Retrieve the configuration described by self.config_schema.

        :return: Dictionary containing requested configuration.
        :rtype: dict
        (Rt
config_schema(R(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyR~sN(((((((,R%R#R&R-R/R
RRRRRRRtapisttext_domainR'tFalseR=R?RCtpropertyRERKRMRLRPRRRSRTRURVRWRXRYRZR[R\RgR_RkR7RrR`R(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyRsL																	cs�fd�}|S(Ncs1t|��s-tdj||����n|S(Ns.Actor {} attribute {} should be of the type {}(RjR
Rm(RpRtvalue(t
value_type(s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyRq�s((RyRq((Rys9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt_is_type�scs�fd�}|S(Ncsxtt�|||�|s:tdj||����nt�fd�|D��sttdj||����n|S(NsEActor {} attribute {} should contain at least one item of the type {}c3s|]}t|��VqdS(N(Rj(t.0titem(Ry(s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pys	<genexpr>�ss?Actor {} attribute {} should contain only values of the type {}(RzttupleR
Rmtall(RpRRx(Ry(s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyRq�s((RyRq((Rys9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt_is_tuple_of�s	cCsit|di�}|j|d�set||d<t|d|�tjd�jd|||�ndS(Nt	_warningst_tuplesleapp.linters)Actor %s field %s should be a tuple of %s(tgetattrtgettTruetsetattrR1R2Rl(RpRt	type_nametwarnings((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt
_lint_warn�s
cs�t|t�r:t|��r:t|||�|f}ntt�|||�t�fd�|D��s�tdj|||���n|S(Nc3s-|]#}t|t�o$t|��VqdS(N(RjR"t
issubclass(R{R|(tcls(s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pys	<genexpr>�ss,Actor {} attribute {} should contain only {}(	RjR"R�R�RzRR~R
Rm(R�tcls_nameRpRRx((R�s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt_is_foo_sequence�stConfigstModelstTagstWorkflowAPIscCs�t|t�r+t||d�|f}ntt�|||�ttgg|D]}t|t�^qQ�s�tdj||���n|S(NtDialogss1Actor {} attribute {} should contain only Dialogs(	RjRR�RzR}R~R�R
Rm(RpRRxR|((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt_is_dialog_tuple�s/RGcCs�|r|||�}nt||d�}|rU|rUtdj|||���n|sa|rv||||�}n|r�|dk	r�|}n||fS(Ns#Actor {} is missing attribute {}.{}(R�R-RRm(RpRt	validatortrequiredt
default_valuetadditional_infotresolveRx((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt_get_attribute�s
	cCs=d}td|jfdtjjtjjtj|jj	��ft
|dtt�dt
�t
|dtdt
d|�t
|dtdtd	dd
t�t
|dtdtd	dd
t�t
|dtdtd	d�t
|d
tt�dtd	|jp�d�t
|dtdtd	d�t
|dtdtd	d�g
�S(s
    Creates Actor's metadata dictionary

    :param actor: Actor whose metadata are needed
    :type actor: derived class from :py:class:`leapp.actors.Actor`
    :return: Dictionary with the name, tags, consumes, produces, and description of the actor
    sD At least one tag is required for actors. Please fill the tags fieldRRRR�RR�RR�R�RRRs6There has been no description provided for this actor.RRt((((((tdictR%RRRtrealpathR R!R#R$R�RzRR�t_is_tag_sequencet_is_model_sequenceRvRR�R&t_is_config_sequencet_is_api_sequence(Rptadditional_tag_info((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pytget_actor_metadata�s.!!cCs+tt�}x|D]}t|�qW|S(s<
    :return: All registered actors with their metadata
    (RRR�(tactorsRp((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt
get_actors�s
(9t	functoolsR1RR tcollections.abcRtImportErrortcollectionstleapp.actors.configRRtleapp.compatRt
leapp.dialogsRtleapp.exceptionsRRRRR	R
tleapp.modelsRRtleapp.models.error_severityR
t
leapp.tagsRtleapp.utilsRRtleapp.utils.auditRtleapp.utils.i18nRtleapp.utils.metaRtleapp.workflows.apiRtobjectRRzRR�R�tpartialR�R�R�R�R�RvR-R�R�R�(((s9/usr/lib/python2.7/site-packages/leapp/actors/__init__.pyt<module>sB
.�m