This file is indexed.

/usr/share/pyshared/landscape/lib/command.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
"""Shell commands execution."""
import commands

class CommandError(Exception):
    """
    Raised by L{run_command} in case of non-0 exit code.

    @cvar command: The shell command that failed.
    @cvar exit_status: Its non-zero exit status.
    @cvar output: The command's output.
    """
    def __init__(self, command, exit_status, output):
        self.command = command
        self.exit_status = exit_status
        self.output = output

    def __str__(self):
        return "'%s' exited with status %d (%s)" % (
            self.command, self.exit_status, self.output)

    def __repr__(self):
        return "<CommandError command=<%s> exit_status=%d output=<%s>>" % (
            self.command, self.exit_status, self.output)


def run_command(command):
    """
    Execute a command in a shell and return the command's output.

    If the command's exit status is not 0 a L{CommandError} exception
    is raised.
    """
    exit_status, output = commands.getstatusoutput(command)
    # shift down 8 bits to get shell-like exit codes
    exit_status = exit_status >> 8
    if exit_status != 0:
        raise CommandError(command, exit_status, output)
    return output