+
     g!                     ,   ^ RI t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	H
t
HtHtHt ] P                  ! ]P                  ! ]4      4      t]
P$                  ! 4       t]! R. RO4      t ! R R]]4      t ! R	 R
4      tRsR tR R ltR R ltR R ltR# )    N)
namedtuple)Enum)List)defaultsevent_loggermessagessystemutilNoticeFileDetailsc                      ] tR t^t]! RRR]P                  R7      t]! RRRRR7      t]! R	R
R]P                  R7      t	]! RRR]P                  R7      t
]! RRR]P                  R7      t]! RRR]P                  R7      t]! RRR]P                  R7      t]! RRR]P                  R7      t]! RRR]P                   P"                  R7      t]! RRR]P$                  R7      t]! RRR]P(                  R7      t]! RRR]P,                  R7      t]! RRRRR7      t]! RR R]P0                  R7      t]! R!R"R]P4                  R7      t]! R#R$R]P8                  R7      tR%tR&# )'Noticecontract_expired5T)labelorder_idis_permanentmessagereboot_required10FzSystem reboot requiredenable_reboot_required11reboot_script_failed12fips_reboot_required20fips_system_reboot_required21fips_install_out_of_date22fips_disable_reboot_required23fips_proc_file_error24fips_manual_disable_url25wrong_fips_metapackage_on_cloudlp_lts_reboot_required30operation_in_progress60z"Operation in progress: {operation}auto_attach_retry_full_notice70auto_attach_total_failure71limited_to_release80 N)__name__
__module____qualname____firstlineno__r   r   CONTRACT_EXPIREDREBOOT_REQUIREDENABLE_REBOOT_REQUIRED_TMPLENABLE_REBOOT_REQUIREDREBOOT_SCRIPT_FAILEDFIPS_REBOOT_REQUIRED_MSGFIPS_REBOOT_REQUIREDFIPS_SYSTEM_REBOOT_REQUIREDFIPS_INSTALL_OUT_OF_DATEFIPS_DISABLE_REBOOT_REQUIREDFIPS_PROC_FILE_ERRORtmpl_msgNOTICE_FIPS_MANUAL_DISABLE_URLFIPS_MANUAL_DISABLE_URL&NOTICE_WRONG_FIPS_METAPACKAGE_ON_CLOUDWRONG_FIPS_METAPACKAGE_ON_CLOUDLIVEPATCH_LTS_REBOOT_REQUIREDOPERATION_IN_PROGRESSAUTO_ATTACH_RETRY_NOTICEAUTO_ATTACH_RETRY_FULL_NOTICE&AUTO_ATTACH_RETRY_TOTAL_FAILURE_NOTICEAUTO_ATTACH_RETRY_TOTAL_FAILURELIMITED_TO_RELEASE__static_attributes__r1       8/usr/lib/python3/dist-packages/uaclient/files/notices.pyr   r      s   ( ))	 ((	O /&44	 -$--	 -$11	 #4+44	#  1(11	  $5,55	$  -$--66	 0'77	 '8/??	'# %6&66	%! .%4	 %6-11	%! '8)??	'# +"++	rN   r   c                      a  ] tR t^st o V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	Rt
V tR# )NoticesManagerc                &   < V ^8  d   QhRS[ RS[/# )   notice_detailsdescription)r   str)format__classdict__s   "rO   __annotate__NoticesManager.__annotate__t   s     
 

 
rN   c                   \         P                  ! 4       '       g-   \        P                  RVP                  P
                  4       R# VP                  P                  '       d   \        P                  M\        P                  pRP                  VP                  P                  VP                  P
                  4      p\        P                  ! \        P                  P!                  W44      V4       R# )zAdds a notice file. If the notice is found,
it overwrites it.

:param notice_details: Holds details concerning the notice file.
:param description: The content to be written to the notice file.
z.NoticesManager.add(%s) called as non-root userN{}-{})r
   we_are_currently_rootLOGwarningvaluer   r   r   NOTICES_PERMANENT_DIRECTORYNOTICES_TEMPORARY_DIRECTORYrW   r   r	   
write_fileospathjoin)selfrT   rU   	directoryfilenames   &&&  rO   addNoticesManager.addt   s     ))++KK@$$**  ##000 0055 	
 >>  ))>+?+?+E+E
 	GGLL-	
rN   c                    < V ^8  d   QhRS[ /# )rS   rT   r   )rW   rX   s   "rO   rY   rZ      s     E EV ErN   c                   \         P                  ! 4       '       g-   \        P                  RVP                  P
                  4       R# VP                  P                  '       d   \        P                  M\        P                  pRP                  VP                  P                  VP                  P
                  4      p\        P                  ! \        P                  P!                  W#4      4       R# )zYDeletes a notice file.

:param notice_details: Holds details concerning the notice file.
z1NoticesManager.remove(%s) called as non-root userNr\   )r
   r]   r^   r_   r`   r   r   r   ra   rb   rW   r   r	   ensure_file_absentrd   re   rf   )rg   rT   rh   ri   s   &&  rO   removeNoticesManager.remove   s    
 ))++KKC$$**  ##000 0055 	
 >>  ))>+?+?+E+E
 	!!"'',,y"CDrN   c                6   < V ^8  d   QhRS[ RS[S[ ,          /# )rS   rh   return)rV   r   )rW   rX   s   "rO   rY   rZ      s     
 
 
S	 
rN   c           	        \         P                  ! V4       Uu. uFb  p\         P                  P                  \         P                  P	                  W4      4      '       g   KG  V P                  W4      '       g   K`  VNKd  	  up# u upi )zGets the list of notice file names in the given directory.

:param directory: The directory to search for notice files.
:returns: List of notice file names.
)rd   listdirre   isfilerf   _is_valid_notice_file)rg   rh   	file_names   && rO   _get_notice_file_names%NoticesManager._get_notice_file_names   sf      ZZ	2
2	ww~~bggll9@A  **9@ I2
 	
 
s   AB"B;Bc                ,   < V ^8  d   QhRS[ RS[ RS[/# )rS   rh   rx   rs   )rV   bool)rW   rX   s   "rO   rY   rZ      s"     - -s -s -t -rN   c                    V\         P                  8H  p\         Uu0 uF<  pVP                  V8X  g   K  RP	                  VP
                  VP                  4      kK>  	  ppW%9   # u upi )zChecks if the notice file is valid.

:param file_name: The name of the notice file.
:returns: True if the file is valid, False otherwise.
r\   )r   ra   r   r   rW   r   r   )rg   rh   rx   is_permanent_dirnvalid_file_namess   &&&   rO   rw   $NoticesManager._is_valid_notice_file   si     %(L(LL 
~~!11 0GNN1::qww/ 	 

 ,,
s
   A$*A$c                &   < V ^8  d   QhRS[ RS[ /# )rS   rx   rs   )rV   )rW   rX   s   "rO   rY   rZ      s     
 
c 
c 
rN   c                    VP                  R4      w  r#\         F?  pVP                  V8X  g   K  VP                  V8X  g   K)  VP                  P
                  u # 	  R# )zGets the default message for a notice file.

:param file_name: The name of the notice file.
:returns: The default message defined in the enum.
- )splitr   r   r   r`   r   )rg   rx   r   r   notices   &&   rO   _get_default_message#NoticesManager._get_default_message   sJ     $//#.F(*v||u/D||+++  rN   c                0   < V ^8  d   QhRS[ S[,          /# rS   rs   r   rV   )rW   rX   s   "rO   rY   rZ      s        d3i  rN   c                <   \         P                  \         P                  3p. pV F  p\        P                  P                  V4      '       g   K*  V P                  V4      pV Ft  p \        P                  ! \        P                  P                  W54      4      pT'       d   TP                  T4       KR  T P                  T4      pTP                  T4       Kv  	  K  	  VP                  4        V#   \         d!    \        P                  RT,           4        K  i ; i)zTGets all the notice files currently saved.

:returns: List of notice file contents.
zPermission error while reading )r   ra   rb   rd   re   existsry   r	   	load_filerf   PermissionErrorr^   r_   appendr   sort)rg   notice_directoriesnoticesnotice_directorynotice_file_namesnotice_file_namenotice_file_contentsdefault_messages   &       rO   listNoticesManager.list   s     0000
  277>>"233 $ ; ;<L M$5 +1+;+;%5H,( (NN#78&*&?&?('O NN?3! %6	 !3* 	 ' KK9<LL 	s   &3C00'DDr1   N)r2   r3   r4   r5   rj   rp   ry   rw   r   r   rM   __classdictcell__)rX   s   @rO   rQ   rQ   s   sC     
 
>E E,
 
- -
 
   rN   rQ   c                  2    \         f   \        4       s \         # N)_notice_clsrQ   r1   rN   rO   
get_noticer      s    $&rN   c                (    V ^8  d   QhR\         RR/# rS   rT   rs   Nrm   )rW   s   "rO   rY   rY      s     , , ,T ,rN   c                 t    \        4       pV P                  P                  ! R/ VB pVP                  W4       R # )Nr1   )r   r   rW   rj   )rT   kwargsr   rU   s   &,  rO   rj   rj      s.    \F ((//9&9K
JJ~+rN   c                (    V ^8  d   QhR\         RR/# r   rm   )rW   s   "rO   rY   rY     s     " "6 "d "rN   c                 <    \        4       pVP                  V 4       R # r   )r   rp   )rT   r   s   & rO   rp   rp     s    \F
MM.!rN   c                :    V ^8  d   QhR\         \        ,          /# r   r   )rW   s   "rO   rY   rY   	  s      d3i rN   c                  6    \        4       p V P                  4       # r   )r   r   )r   s    rO   r   r   	  s    \F;;=rN   )r   r   r   r   )loggingrd   collectionsr   enumr   typingr   uaclientr   r   r   r	   r
   	getLoggerreplace_top_level_logger_namer2   r^   get_event_loggereventr   r   rQ   r   r   rj   rp   r   r1   rN   rO   <module>r      s     	 "   C C::8DE%%'I 
` `F} }@ ,"
rN   