This file is indexed.

/usr/share/pyshared/landscape/manager/fakepackagemanager.py is in landscape-common 12.04.3-0ubuntu1.

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import logging
import os
import random

from twisted.internet.utils import getProcessOutput
from twisted.internet.defer import succeed

from landscape.package.store import PackageStore
from landscape.package.changer import PackageChanger
from landscape.package.releaseupgrader import ReleaseUpgrader
from landscape.manager.plugin import ManagerPlugin
from landscape.manager.manager import SUCCEEDED


class FakePackageManager(ManagerPlugin):

    run_interval = 1800
    randint = random.randint

    def register(self, registry):
        super(FakePackageManager, self).register(registry)
        self.config = registry.config

        registry.register_message("change-packages",
                                  self.handle_change_packages)
        registry.register_message("change-package-locks",
                                  self.handle_change_package_locks)
        registry.register_message("release-upgrade",
                                  self.handle_release_upgrade)

    def _handle(self, response):
        delay = self.randint(30, 300)
        self.registry.reactor.call_later(
            delay, self.manager.broker.send_message, response, urgent=True)

    def handle_change_packages(self, message):
        response = {"type": "change-packages-result",
                    "operation-id": message.get("operation-id"),
                    "result-code": 1,
                    "result-text": "OK done."}
        return self._handle(response)

    def handle_change_package_locks(self, message):
        response = {"type": "operation-result",
                    "operation-id": message.get("operation-id"),
                    "status": SUCCEEDED,
                    "result-text": "Package locks successfully changed.",
                    "result-code": 0}
        return self._handle(response)

    def handle_release_upgrade(self, message):
        response = {"type": "operation-result",
                    "operation-id": message.get("operation-id"),
                    "status": SUCCEEDED,
                    "result-text": "Successful release upgrade.",
                    "result-code": 0}
        return self._handle(response)