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/workflows/__init__.pyc
�
9�Egc@s�ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZddl
mZddlmZddlmZddlmZdd	lmZdd
lmZmZmZmZmZddlmZmZddl m!Z!m"Z"dd
l#m$Z$ddl%m&Z&ddl'm(Z(d�Z)d�Z*d�Z+e,d�Z-e,d�Z.e,d�Z/d�Z0de1fd��YZ2de$fd��YZ3dee2�fd��YZ4d�Z5dS(i����N(tretrieve_config(tRawMessageDialog(tCommandErrortMultipleConfigActorsErrortWorkflowConfigNotAvailable(tAnswerStore(tInProcessMessaging(tSkipPhasesUntilCommand(tExperimentalTag(t
reboot_system(t
checkpointt
get_errorstcreate_audit_entrytstore_workflow_metadatatstore_actor_metadata(twith_metaclasstget_flattened_subclasses(tdisplay_status_current_phasetdisplay_status_current_actor(tPhase(tPolicies(tPhaseActorscCs
|j�S(N(t	get_index(ta((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyt_phase_sorter_keyscCst|t�ot|t�S(N(t
isinstancettypet
issubclassR(tattr((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyt	_is_phasescCs;ttg|j�D]}t|�r|^qdt��S(Ntkey(ttupletsortedtvaluesRR(tattrsR((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyt_get_phases_sortedscCs&|r"|jj�|jj�fSdS(N((tnametlowert
class_name(tactor((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytactor_names#scCs.|r*|djj�|djj�fSdS(Ni((t__name__R%R$(tphase((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytphase_names'scCs&|r"|jj�|jj�fSdS(N((R)R%R$(ttag((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyt	tag_names+scCsYt�}x!|D]}|jt|��qWt|jg|D]}|j�^q=��S(N(tsettupdateR-tbooltintersectionR%(tneedle_tagst
actor_tagsthayR,((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytcontains_tag/s	
tWorkflowMetacBseZdZd�ZRS(s6
    Meta class for the registration of workflows
    cCsmtt|�j||||�}ttj|j|d�sZttj|j||�nt	|�|_
|S(N(tsuperR6t__new__tgetattrtsystmodulest
__module__tNonetsetattrR#tphases(tmcsR$tbasesR"tklass((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyR8:s
!(R)R<t__doc__R8(((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyR66st_ConfigPhasecBseZdZRS(tconfiguration_phase(R)R<R$(((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyRDBstWorkflowcBs%eZdZdZdZdZdZdZe	d��Z
e	d��Ze	d��Zd�Z
d�Zd�Zded�Zd	�Ze	d
��Zd�Ze	d��Ze	d
��Ze	d��Ze	d��Ze	d��Zed��Zdd�Zddddedd�ZRS(s`
    Workflow is the base class for all :ref:`workflow <terminology:workflow>` definitions.
    tcCs|jS(s.
        :return: All reported errors
        (t_errors(tself((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyterrorsZscCs|jp|jp|jS(N(RHt_unhandled_exceptiont_stop_after_phase_requested(RI((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytfailureascCs|jS(sC
        : return: AnswerStore instance used for messaging
        (t
_answer_store(RI((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytanswer_storeescCs0|jj|j|�|jj|dt�dS(s�
        Generates an answer file for the dialogs of the workflow and saves it to `answerfile_path`.
        Updates a .userchoices file at `userchoices_path` with new answers encountered in answerfile.

        :param answerfile_path: The path where to store the answer file.
        :param userchoices_path: The path where to store the .userchoices file.
        :return: None
        t
allow_missingN(RNtgeneratet_dialogsR/tTrue(RItanswerfile_pathtuserchoices_path((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytsave_answersls
cCs<tjj|�r%|jj|�n|jjd|�dS(NsPrevious file %s not found(tostpathtisfileRNtloadtlogtwarning(RItfilepath((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyt_load_from_filezscCs|j|�|j|�dS(N(R^(RIRTRU((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytload_answers�s
c
Cs|ptjd�jd�|_g|_t�|_t�|_t�|_g|_	t�|_
||_t|_
t�|_g|_t|_|jrSg|jjD]}|j|jkr�|^q�}|rSt|�dkr%|j	jttdd�tt|�d�td	d�f�qPg|D]}|j^q,}t|��qSn|jpht|�j|_x�|j D]�}|j!j"|j|j!j"kr�|jfnd
7_"|j	j||j#|j!j$�d�|j#|j!j%�d�|j#|j!j&�d�f�qxWdS(s�
        :param logger: Optional logger to be used instead of leapp.workflow
        :type logger: Instance of :py:class:`logging.Logger`
        tleapptworkflowitBeforetMaintAfterN(((('tloggingt	getLoggertgetChildR[RHR.t
_all_consumedt
_all_producedt_initialt
_phase_actorst_experimental_whitelistt_auto_reboottFalseRKRRNRRRLt
configurationR,tactorstproducestlentappendRDRRR$RtdescriptionRRCR?tfilterttagst_apply_phaset
get_beforetgett	get_after(RItloggertauto_rebootR't
config_actorsRtconfig_actor_namesR*((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyt__init__�s>!							1	3	cCsYt||�}|jjt|j�|j�|jj|j�|jj|j�|S(N(	RRjR/R.tinitialRiRhtconsumesRq(RIRptstagetphase_actors((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyRw�s
 cCs|jS(sQ Whitelist of actors that may be executed even that they are marked experimental (Rl(RI((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytexperimental_whitelist�scCs|r|jj|�ndS(s�
        Adds an actor to the experimental whitelist and allows them to be executed.

        :param actor: Actor to be whitelisted
        :type actor: class derived from py:class:`leapp.actors.Actor`
        :return: None
        N(Rltadd(RIR'((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytwhitelist_experimental_actor�scCs|jS(s! Return all actors for the phase (Rk(RI((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyR��scCs|jS(s Initial messages required (Rj(RI((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyR��scCs|jS(s All consumed messages (Rh(RI((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyR��scCs|jS(s All produced messages (Ri(RI((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyRq�scCs|jS(s All encountered dialogs (RR(RI((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytdialogs�scCsRi|jd6|jd6|jjd6|jd6g|jD]}|j�^q8d6S(s:
        :return: Serialized form of the workflow
        R$t
short_nameR,RtR?(R$R�R,R)RtR?t	serialize(tclsR*((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyR��s



cCs=|r9|g|jD]}t|�D]}|^q#qkSdS(N(RkR+(RIR*tphsR$((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pytis_valid_phase�scCs�|pttj��}|tjd<tjjdd�sPtj�tjd<n|j	j
djd|jdtjd��t
|�|p�dj�}|p�d}d}d|kr�|jdd�\}}n|j�}|p�dj�}|p�dj�}	t|�|_t|�j}
xE||fD]7}|r,|j|�r,td	jd
|���q,q,WxN|jD]C}x:|dD].}x%|jD]}
t|
|dj�q�Wq�WqqWt|_x|jD]}|djtjd<|r/|t|�krd}n|j	j
d
jd|dj��q�nt|�|j	j
djd|dj��|j	j|dj�}t}x�|dD]�}|r�dS|j
djd
|djd|j��x|jD]}
|r�dSd}t|
j kr(d}|
|j!kr(|j
djd|
j��q�q(n|rct"||
j �rc|j
djd|
j��q�nt#|
d|�|j
djd|d|
j��t$d|
d|j%�}|j&|
j'�|
d|d|d|
d|�}z~y|j(�Wnit)k
rZ}t*|_+|j,d|j-d|j.d|
j�|j/d jd|
jd|j.���nXWd|
jtjd!<t0d"d#d$i|j+r�dndd%6�tjj1d!�X|j2p�|j|_|j3j4|j5��|j6�r/|jj4|j6��|dj7j/t8j9j:kr/|j	j
d&�t*}Pq/nxN|j;D]C}|d't<j=kr9|d(d)}|j	j
d*j|��q9q9Wt>d|
jd
|djd+|d,tjd�|	t?|
�kr�|j	j
d-�t*}Pq�q�W|js$t>ddd
|djd|jd+|d,tjd�n|t|�kr�||jj�kr�|j	j
d.�t*}Pq�q�Wt>ddd
|djd+|d,tjd�|jr�|dj7j/t8j9j@kr�|j	j
d/�t*}n�|t|�kr�|j	j
d.�t*}n�|jr!|j	j
d0�t*}n�|djAjBsA|djAjCr�t*}|djAjBr�|jDr�t}|jEtFdd1��n|r�|j	j
d2�tG�nt*}n)|djAjHr�|j	j
d3�t*}n|r�dSq�WdS(4s�
        Executes the workflow

        :param context: Custom execution ID to be used instead of a randomly generated UUIDv4
        :type context: str
        :param until_phase: Specify until including which phase the execution should run - phase.stage can be used to
                            control it even more granularly. `phase` is any phase name where `stage` refers to `main`,
                            `before` or `after`. If no stage is defined, `after` is assumed to be the default value.
                            The execution ends when this phase (and stage, if specified) has been executed.
        :type until_phase: str
        :param until_actor: The execution finishes when this actor has been executed.
        :type until_actor: str
        :param skip_phases_until: Skips all phases until including the phase specified, and then continues the
               execution.
        :type skip_phases_until: str or None
        :param skip_dialogs: Inform actors about the mode of dialogs processing. If skip_dialogs is set to True it
                             means that dialogs can't be processed in the current workflow run interactively and
                             every attempted call of get_answers api method will be non-blocking, returning an empty
                             dict if no user choice was found in answerfile or a selected option otherwise.
                             If skip_dialogs is set to False then in case of absent recorded answer the dialog will
                             be rendered in a blocking user input requiring way.
                             The value of skip_dialogs will be passed to the actors that can theoretically use it for
                             their purposes.
        :type skip_dialogs: bool
        :param only_with_tags: Executes only actors with the given tag, any other actor is going to get skipped.
        :type only_with_tags: List[str]

        tLEAPP_EXECUTION_IDtLEAPP_HOSTNAMEs.Starting workflow execution: {name} - ID: {id}R$tidRGt.is,Phase {phase} does not exist in the workflowR*itLEAPP_CURRENT_PHASEsSkipping phase {name}sStarting phase {name}Ns'Starting stage {stage} of phase {phase}R�s[EXPERIMENTAL]s#Skipping experimental actor {actor}R's:Actor {actor} does not contain any required tag. Skipping.tdesignations%Executing actor {actor} {designation}tconfig_modelROR{t	messagingtskip_dialogstmessagettracet	actornames"Actor {actor} has crashed: {trace}tLEAPP_CURRENT_ACTORteventsactor-exit-statustdatatexit_statuss8Workflow interrupted due to FailImmediately error policytcommandt	argumentstuntil_phases9SkipPhasesUntilCommand received. Skipping phases until {}tcontextthostnames-Workflow finished due to the until-actor flags-Workflow finished due to the until-phase flags6Workflow interrupted due to the FailPhase error policys.Workflow received request to stop after phase.s<A reboot is required to continue. Please reboot your system.s=Initiating system reboot due to the restart_after_reboot flags=Stopping the workflow execution due to the is_checkpoint flag(Itstrtuuidtuuid4RWtenvironRyR=tsockettgetfqdnR[tinfotformatR$R
R%tsplitRRHRRoR�RRkRpRRnRLR+RRgR�RRvR�R5RRRNRZR�trunt
BaseExceptionRSRKtreport_stacktraceR�texception_infoterrorRtpoptstop_after_phaseRRtextendR�RJtpoliciesRtErrorstFailImmediatelytcommandsRtCOMMANDR
R(t	FailPhasetflagstrequest_restart_after_phasetrestart_after_phaseRmtrequest_answersRR	t
is_checkpoint(RIR�R�tuntil_actortskip_phases_untilR�tonly_with_tagstneedle_phasetneedle_stagetneedle_actorR�R*R�R'tcurrent_loggertearly_finishR�R�tinstancetexcR�treboot((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyR��s

 		#
#	
		

"	*'-%				 
		N(R)R<RCR=R$R�R,RtRotpropertyRJRMRORVR^R_RnRRwR�R�R�R�R�RqR�tclassmethodR�R�R�(((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyRFFs2		
	,		
cCs
tt�S(s+
    :return: all registered workflows
    (RRF(((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyt
get_workflows�s(6ReRWR�R:R�tleapp.actors.configRt
leapp.dialogsRtleapp.exceptionsRRRtleapp.messaging.answerstoreRtleapp.messaging.inprocessRtleapp.messaging.commandsRt
leapp.tagsRtleapp.utilsR	tleapp.utils.auditR
RRR
Rtleapp.utils.metaRRtleapp.utils.outputRRtleapp.workflows.phasesRtleapp.workflows.policiesRtleapp.workflows.phaseactorsRRRR#R=R(R+R-R5RR6RDRFR�(((s</usr/lib/python2.7/site-packages/leapp/workflows/__init__.pyt<module>s<(				�p