3
ܓi @ s d dl mZ G dd deZdS ) )
SoSPrepperc @ s e Zd ZdZdZdd ZdS )HostnamePrepperaw
Prepper for providing domain and hostname information to the hostname
mapping.
The items from hostname sources are handled manually via the _get_items
method, rather than passing the file directly, as the parser does not know
what hostnames or domains to match on initially.
This will also populate the regex_items list with local short names.
hostnamec C sF g }d}|j rd}n
|jrd}|j|}|r|dkr|jd}t|dkrl|j|d | jd j|d t|dkrdj|dd }|j|j |j|j |jd
}xr|j
D ]f}|jdsd|krq|j dd } x<| D ]4}
t|
jddkr| jd j|
q|j|
qW qW x| jj
D ]}|j| q.W |S )
Nr zsos_commands/host/hostname_-fz"data/insights_commands/hostname_-fZ localhost. r z etc/hosts#)Zis_sosZis_insightsZget_file_contentsplitlenappendZregex_itemsaddjoinstrip
splitlines
startswithZoptsdomains)selfarchiveitemsZ_fileZcontentr Z
top_domainZ_hostslineZhostlnhostZdomain r /usr/lib/python3.6/hostname.py_get_items_for_hostname s8
z'HostnamePrepper._get_items_for_hostnameN)__name__
__module____qualname____doc__namer r r r r r s
r N)Zsos.cleaner.preppersr r r r r r