g$ddlZddlZddlZddlZddlZddlmZddlmZej ddeZ dZ dZ dZ d Zd ezZd Zd Zd ZdZdZddefdZdZdS)N)CLEditionDetectionError) PKG_VERSIONz \.el\w(h?)\.z.elX.zehttps://9713d1296f804031b058b8f2d789d7ac:8ddacae32d8246cf8b25cf826bf3fc0a@cl.sentry.cloudlinux.com/12z/var/lve/.edition.previousz/etc/sysconfig/rhn/systemidiQcZtjd|rdndd|gddtjdS)z$ Run reconfiguration script z/usr/sbin/cloudlinux-customizer preconfigure reconfigurez-tT)checktextstderrN) subprocessrunSTDOUTcurrent_edition is_pre_checks py/clconfigure/watcher.py_reconfigure_serverrsMN)&9M o'+ *+ c&t||dS)z? Called when saved edition does not match current one. Nr)previous_editionrrs r_on_edition_changedr-66666rc&t||dS)zI Called when saved server id detected as one registered recently Nrrs r_on_server_newly_registeredr4rrcn tjtS#t$rYdSwxYw)zV Assume that last registration time is the date of systemid modification. N)ospathgetmtimeSYSTEMID_FILE_PATHFileNotFoundErrorrr_get_registration_timer#;s@ w 2333 tt #& 44cn tjtS#t$rYdSwxYw)zZ Assume that last check time is equal to the date of last cache modification. N)rrrLAST_KNOWN_EDITION_CACHE_PATHr!r"rr_get_last_check_timer'Fs@ w =>>> ttr$F new_editionc ttd5}|}dddn #1swxYwYn#t$rd}YnwxYwt }|o||k}|duo|t jt z k}t}|dup |duo||ko|}tj dt|t|t||rC|rAtj dt|t|t||nf|rBtj dt|t|t|||n"tj dt||s4tj dt|t| dSdS) a  Compares current edition with latest saved in file and @param new_edition: provides information about new edition that server is using Depending on is_pre_check this edition can either be already applied or just planning to be installed @param is_pre_check: True means that current check is executed BEFORE new jwt is actually saved in jwt.token file False means that registration is complete and jwt.token file was updated with new edition token utf-8encodingNzYChecking edition registration data: registration time=%s, last edition=%s, new edition=%szJNew server registration detected, last check time=%s, registration time=%sz8Edition change detected, last edition=%s, new edition=%sz6Nothing to do, requested edition=%s already configuredzSaving new edition="%s")edition)openr&readr!r#timeSYSTEMID_NEW_TIMEr'logginginfostrrr save_edition) r(rf last_editionregistration_timeis_edition_changedis_registration_freshlast_check_time!is_last_check_before_registrations rr r Qsi /' B B B $a6688L $ $ $ $ $ $ $ $ $ $ $ $ $ $ $  /00%E,+*E % C $)++0A"A B+,,O D  P!-O#&77O>>> a O&&%% ' ' ' L+|DDDD MsS^O_O_``` * .K0@0@AAA[))))))**s.A9 A=A=A AAc ttdd5}||ddddS#1swxYwYdS#t$r }t jd|Yd}~dSd}~wwxYw)z4 Stores current edition value in cache file wr*r+Nz*Unable to detect current edition, error=%s)r.r&writerr2warning)r-r6es rr5r5sI /w G G G 1 GGG                      "IIIDaHHHHHHHHHIs7A < A AA AA A3A..A3)F)r2rrer r0clcommon.lib.cleditionr lve_utilsrsubPKG_VERSION_TINY SENTRY_DSNr&r _SECONDS_IN_DAYr1rrrr#r'r4r r5r"rrrIs!   ::::::!!!!!!26/7K@@L <2'   777777;*;*s;*;*;*;*|IIIIIr