This file is indexed.

/usr/lib/python2.7/dist-packages/jnpr/junos/facts/domain.py is in python-junos-eznc 2.0.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from jnpr.junos.utils.fs import FS
from jnpr.junos.exception import RpcError
from jnpr.junos.jxml import INHERIT
from lxml.builder import E


def facts_domain(junos, facts):
    """
    The following facts are required:
        facts['hostname']

    The following facts are assigned:
        facts['domain']
        facts['fqdn']
    """

    try:
        domain_filter_xml = E('configuration', E('system', E('domain-name')))
        domain = junos.rpc.get_config(filter_xml=domain_filter_xml, options=INHERIT)
        domain_name = domain.xpath('.//domain-name')
        if len(domain_name) > 0:
            facts['domain'] = domain_name[0].text
            facts['fqdn'] = facts['hostname'] + '.' + facts['domain']
            return
    except RpcError:
        pass

    fs = FS(junos)
    file_content = fs.cat('/etc/resolv.conf') or fs.cat('/var/etc/resolv.conf')
    words = file_content.split() if file_content is not None else ''
    if 'domain' not in words:
        facts['domain'] = None
        facts['fqdn'] = facts['hostname']
    else:
        idx = words.index('domain') + 1
        facts['domain'] = words[idx]
        facts['fqdn'] = facts['hostname'] + '.' + facts['domain']