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/repository/actor_definition.pyo
�
9�Egc@sYddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ddlZddlmZmZddlmZddlmZmZmZmZddlmZddlmZdd	lmZdd
l m!Z!d�Z"de#fd
��YZ$de#fd��YZ%dS(i����N(tUnsupportedOperation(tProcesstQueuetPipe(tget_actor_metadatat
get_actors(tload_module(tActorInspectionFailedErrortLeappRuntimeErrortMultipleActorsErrortUnsupportedDefinitionKindError(tDefinitionKind(tcreate_audit_entry(t_LeappDeprecationWarning(tLeappLibrariesFindercCsi|j�gt�D]}t|�^q}g|D]}|d|jkr3|^q3}|j|�dS(s]
    Retrieves the actor information in a child process and returns the results back through `result_queue`.

    :param definition: the actor definition to load
    :type definition: :py:class:`ActorDefinition`
    :param result_queue: queue to pass results back to the calling process
    :type result_queue: :py:class:`multiprocessing.Queue`
    tpathN(tloadRRt	full_pathtput(t
definitiontresult_queuetactortresulttentry((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyt
inspect_actors	
",tActorCallContextcBs/eZdZd�Zed��Zd�ZRS(s7
    Wraps the actor execution into child process.
    cCs1||_||_||_||_||_dS(s�
        :param definition: Actor definition
        :type definition: :py:class:`leapp.repository.actor_definition.ActorDefinition`
        :param logger: Logger
        :type logger: :py:class:`logging.Logger`
        :param messaging: Leapp Messaging
        :type messaging: :py:class:`leapp.messaging.BaseMessaging`
        :param config_model: Workflow provided configuration model
        :type config_model: :py:class:`leapp.models.Model` derived class
        N(Rtloggert	messagingtconfig_modeltskip_dialogs(tselfRRRRR((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyt__init__+s
				c	Cs�|dk	r9ytj|�t_Wq9tk
r5q9Xntjdt���}	tj	dddt
�|j�|j���gt
�D]}
|
j|jkr�|
^q�d}|d|d|d|d	|�}y|j||�Wn'tk
r|jtj���nXWdQXz�|jtjd
<x�|	D]�}
t|
jt
�r,it|
j�d6|
jd6|
jdkr�tj|
j|
j�n|
jd
6|
jd6|
jjd6|
jjd6}t d|�q,q,WWdtjj!d
�XWdQXdS(NtrecordtactiontalwaystcategoryiRRRRtLEAPP_CURRENT_ACTORtmessagetfilenametlinetlinenotsincetreasontdeprecation("tNonetostfdopentsyststdintOSErrortwarningstcatch_warningstTruetsimplefilterR
Rtinjected_contextRtnametrunt	Exceptiontsendt	tracebackt
format_exctenviront
issubclassR#tstrR%R&R't	linecachetgetlineR(R)tmsgRtpop(R0RRRRRt
error_pipetargstkwargst	recordingRttarget_actortactor_instancetrecR((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyt_do_run<s<


2	



1

c	
Os�ytjj�}Wntk
r,d}nXt�\}}td|jd||j|j	|j
|j|j|||f	�}|j
�|j�|jdkr�djd|j
jd|j�}d}|j�r�|j�}nt||��ndS(sD
        Performs the actor execution in the child process.
        ttargetREisDActor {actorname} unexpectedly terminated with exit code: {exitcode}t	actornametexitcodeN(R/R0tfilenoRR,RRRKRRRRRtstarttjoinRNtformatR7tpolltrecvR(	RRERFR0t
pipe_receivertpipe_sendertpterr_messagetexception_info((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR8cs"



	(t__name__t
__module__t__doc__RtstaticmethodRKR8(((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR&s	'tActorDefinitioncBsUeZdZdd�Zed��Zd�Zd�Zd�Z	d�Z
ddded�Zed��Z
ed	��Zed
��Zed��Zed��Zed
��Zed��Zed��Zejd��Zed��Zed��Zed��Zed��Zed��Zed��Zed��ZRS(s#
    Defines actor resources.

    cCsI|ptjd�|_||_||_i|_d|_d|_dS(s�
        :param log: Logger
        :type log: :py:class:`logging.Logger`
        :param directory: Actor directory
        :type directory: str
        :param repo_dir: Repository directory
        :type repo_dir: str
        sleapp.actorN(	tloggingt	getLoggertlogt
_directoryt	_repo_dirt_definitionsR,t_modulet
_discovery(Rt	directorytrepo_dirRa((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR�s					cCs%tjjtjj|j|j��S(N(R-RtrealpathRQRcRb(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR�scCsc|tjkrC|jjd|j�tdjd|j���n|jj|g�j	|�dS(s�
        Adds any kind of actor resource to the Definition

        :param kind: kind of resource added
        :type kind: str
        :param path: path to the added resource
        :type path: str
        s:Attempt to add item type %s to actor that is not supportedsActors do not support {kind}.tkindN(
RtACTOR_WHITELISTRaterrorR7R
RRRdt
setdefaulttappend(RRjR((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pytadd�s	cCs�i|jd6|jd6|jd6|jd6|jd6|jd6|jd6|jd6|jd	6g|j	D]}|j
�^qgd
6|jd6|jd6|j
d
6|jd6|jd6S(s_
        :return: dump of actor resources (path, name, tools, files, libraries, tests)
        RR7t
class_nametdescriptionttagstconfig_schemastconsumestproducestapistdialogsttoolstfilest	librariestconfigsttests(RgR7RpRqRrRsRtRuRvRwt	serializeRxRyRzR{R|(Rtdialog((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR}�s 








#



cCs�|js�|j��ntjjtjj|j|j��}x?tj	|f�D]+\}}}|sPt
||�|_PqPqPWWdQXndS(s>
        Loads the actor module to be introspectable.
        N(ReR6R-RtabspathRQRcRgtpkgutiltiter_modulesR(RRtimporterR7tis_pkg((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR�s	
'"cCs�|js�|jjd|j�td�}tdtd||f�}|j�|j�|j	dkr�|jj
d|j|j	�tdjd|j���n|j
��|j�}Wd	QX|s�|jj
d
|j�tdjd|j���nt|�dkr6|jj
d|j�t|j��n|d|_x<|jd
D]*}||jkrQ|j|f7_qQqQWn|jS(sr
        Performs introspection through a subprocess.

        :return: Dictionary with discovered items.
        sStarting actor discovery in %siRLREis-Process inspecting actor in %s failed with %ds$Inspection of actor in {path} failedRNs1Process inspecting actor in %s returned no results1Inspection of actor in {path} produced no resultss$Actor in %s returned multiple actorsRr(RfRatdebugRgRRRRPRQRNRlRRRR6tgettlenR	tactors(RtqRWRttag((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pytdiscover�s.	




cCs%td|d|d|d|d|�S(NRRRRR(R(RRRRR((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyt__call__�scCs|j�dS(s3
        :return: Tuple of defined dialogs
        Rw(R�(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRw�scCs|j�dS(s3
        :return: Tuple of consumed models
        Rt(R�(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRtscCs|j�dS(s3
        :return: Tuple of produced models
        Ru(R�(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRuscCs|j�dS(s>
        :return: Tuple of tags assigned to the actor
        Rr(R�(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRrscCs|j�dS(s+
        :return: Actor class name
        Rp(R�(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRpscCs|j�dS(s.
        :return: Actor internal name
        R7(R�(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR7scCs|j�dS(s,
        :return: Actor description
        Rq(R�(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRq#scCs|j�dS(s/
        :return: Actor config_schemas
        Rs(R�(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRs*sc#sOtjjdd�}dj|jd�t�fd��jD���tjd<tjjdd�}�jr�tj	j�j
�j�jd�tjd<ntjjdd�}�jr�tj	j�j
�j�jd�tjd<ntj
}tj
jtdd	d
g�jD]$}tj	j�j
�j|�^q��tj
jtddd
g�jD]$}tj	j�j
�j|�^qa��tj�}tjtj	j�j
�j��z	dVWdtj|�|tjd<|dk	r�|tjd<ntjjdd�|dk	r.|tjd<ntjjdd�|t_
XdS(
s

        Prepares the actor environment for running the actor.
        This includes injecting actor private libraries into :py:mod:`leapp.libraries.actor`
        and setting environment variables for private tools and files.

        :note: Use with caution.
        tPATHtt:c3s-|]#}tjj�j�j|�VqdS(N(R-RRQRcRb(t.0R(R(sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pys	<genexpr>=stLEAPP_FILESitLEAPP_TOOLSt
module_prefixsleapp.libraries.actortpathssleapp.configs.actorN(R-R=R�RQtsplittlistRxR,RyRRcRbR/t	meta_pathRnRRzRgR{tgetcwdtchdirRC(Rtpath_backuptfiles_backupttools_backuptmeta_path_backuptxt
previous_path((RsE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR61s>
'	/	/
	8	8"	

cCst|j�d�S(s;
        :return: names of APIs used by this actor
        Rv(ttupleR�(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRviscCs|jS(s7
        :return: The folder path of the actor
        (Rb(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRgpscCst|jjtjd��S(s`
        :return: Tuple with path to the tools folder of the actor, empty tuple if none
        ((R�RdR�RtTOOLS(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRxwscCst|jjtjd��S(sd
        :return: Tuple with path to the libraries folder of the actor, empty tuple if none
        ((R�RdR�Rt	LIBRARIES(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRz~scCst|jjtjd��S(s`
        :return: Tuple with path to the files folder of the actor, empty tuple if none
        ((R�RdR�RtFILES(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyRy�scCst|jjtjd��S(sb
        :return: Tuple with path to the configs folder of the actor, empty tuple if none
        ((R�RdR�RtCONFIGS(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR{�scCst|jjtjd��S(s`
        :return: Tuple with path to the tests folder of the actor, empty tuple if none
        ((R�RdR�RtTESTS(R((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR|�sN(RZR[R\R,RtpropertyRRoR}RR�tFalseR�RwRtRuRrRpR7RqRst
contextlibtcontextmanagerR6RvRgRxRzRyR{R|(((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyR^�s0				+8(&R�R@R_R-R�R/R;R2tioRtmultiprocessingRRRtleapp.libraries.actortleapptleapp.actorsRRtleapp.compatRtleapp.exceptionsRRR	R
tleapp.repository.definitionRtleapp.utils.auditRtleapp.utils.deprecationR
tleapp.utils.libraryfinderRRtobjectRR^(((sE/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.pyt<module>s("	Z