This file is indexed.

/usr/lib/apt-spacewalk/pre_invoke.py is in apt-transport-spacewalk 1.0.6-4.1.

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

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#! /usr/bin/python
#
# APT::Update::Pre-Invoke hook for updating sources.list
#
# Author:  Simon Lukasik
# Date:    2011-03-14
# License: GPLv2
#
# Copyright (c) 1999--2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.


import sys
import os
from urlparse import urlparse
from aptsources import sourceslist
import apt_pkg

# Once we have the up2date stuff in a site-packages,
# we don't have to do path magic
import warnings
warnings.filterwarnings("ignore",
    message='the md5 module is deprecated; use hashlib instead')
sys.path.append('/usr/share/rhn/')
from up2date_client import config
from up2date_client import rhnChannel
from up2date_client import up2dateAuth
from up2date_client import up2dateErrors


def get_channels():
    """Return channels associated with a machine"""
    try:
        channels = ['main']
        for channel in rhnChannel.getChannelDetails():
            if channel['parent_channel']:
                channels.append(channel['label'])
        return channels
    except up2dateErrors.Error:
        return []

def get_server():
    """Spacewalk server fqdn"""
    return urlparse(config.getServerlURL()[0]).netloc

def get_conf_file():
    """Path to spacewalk.list configuration file"""
    apt_pkg.init_config()
    directory = apt_pkg.config.get('Dir::Etc::sourceparts',
        'sources.list.d')
    if not os.path.isabs(directory):
        directory = os.path.join('/etc/apt', directory)
    return os.path.join(directory, 'spacewalk.list')

def update_sources_list():
    sources = sourceslist.SourcesList()
    sw_source = []
    for source in sources.list:
        if source.uri.startswith('spacewalk://'):
            source.set_enabled(False)
            sw_source.append(source)

    if up2dateAuth.getSystemId():
        channels = get_channels()
        if len(channels):
            for source in sw_source:
                sources.remove(source)
            sources.add(type='deb',
                        uri='spacewalk://' + get_server(),
                        dist='channels:',
                        orig_comps=channels,
                        file=get_conf_file()
                        )
    sources.save()

if __name__ == '__main__':
    print "Apt-Spacewalk: Updating sources.list"
    update_sources_list()