Files
portfolio/migration-validation-framework/collectors/__pycache__/services.cpython-312.pyc
T

36 lines
7.9 KiB
Plaintext
Raw Normal View History

Ë
£Šòiuãó†dZddlZddlZddlZddlmZmZmZeje «Z
Gdd«Z de dee effdZ
y) z
Services Data Collector
Collects system service information including running services,
their states, startup configuration, and dependencies.
éN)ÚDictÚAnyÚListcó®eZdZdZdZdedeeeffdZdedefdZ dede
eeeffdZ dededeeeffd „Z dede
eeeffd
Z
dedefd Zy )
ÚServicesCollectorz)Collector for system service information.có d|_d|_y)systemdF)Úservice_managerÚinclude_disabled)Úselfs úcollectors/services.pyÚ__init__zServicesCollector.__init__sØÔØ %ˆÕóÚsystemÚreturncóRtjd|« |j|«}|dk(r|j|«}n%|dk(r|j |«}nt d|«|||j
|«dœS#t$r!}tjd|d|«d}~wwxYw) z/Collect service information from target system.zCollecting services data from r ÚsysvzUnsupported service manager: )r
ÚservicesÚ timestampz Failed to collect services from ú: N) ÚloggerÚinfoÚdetect_service_managerÚcollect_systemd_servicesÚcollect_sysv_servicesÚ RuntimeErrorÚ
get_timestampÚ ExceptionÚerror)r rr
rÚes r
Úcollect_servicesz"ServicesCollector.collect_servicesä Ð4°V°HÐ à"×9¸Aˆ ×Ó@‘Ø  FÒ×5°fÓ=ä"Ð%BÀ?ÐBSÐ#TÓ$3ØÓð
øô ò Ü L‰LÐ;¸F¸8À2ÀaÀSÐ ûð úsšA!A<Á< B&ÂB!Â!B&cóF tjd|dgddd¬«}|jdk(r:d|jj «vryd|jj «vry tjd|d
gddd¬«}|jdk(ryy #t
$rYy wxYw) z6Detect which service manager is running on the system.Ússhzps -p 1 -o comm=Té
©Úcapture_outputÚtextÚtimeoutrr Úinitrzwhich systemctlÚunknown©Ú
subprocessÚrunÚ
returncodeÚstdoutÚstripr©r rÚresults r
rz(ServicesCollector.detect_service_manager/ð ä—^‘^ؘР2ÐØô ˆFð× Ñ  AÒ §
¡
× 3Ñ 3Ó 5јvŸ}™}× —^‘^ؘР1ÐØô ˆFð× Ñ  AÒ àøäò Ùð ús‚ABÁ
BÁ'+B B ÂB có g} tjd|dgddd¬«}|jdk7rtd|j«|j
j
«jd«D]}|j
«sŒ|j«}t|«d k\sŒ3|d}|d
}|d }|d } |js|d
k(rŒY|j||«}
|j|||| dœ|
¥«Œ„ |S#tj$rtjd|«t$r!} tjd|d| «d} ~ wwxYw)z$Collect systemd service information.r#z@systemctl list-units --type=service --all --no-pager --no-legendTér%rzsystemctl list-units failed: ú