This file is indexed.

/usr/lib/python2.7/dist-packages/ipaserver/install/ipa_server_upgrade.py is in python-ipaserver 4.7.0~pre1+git20180411-2ubuntu2.

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
58
59
60
#
# Copyright (C) 2015  FreeIPA Contributors see COPYING for license
#

import logging

from ipalib import api
from ipaplatform.paths import paths
from ipapython import admintool
from ipaserver.install import installutils
from ipaserver.install import server

logger = logging.getLogger(__name__)


class ServerUpgrade(admintool.AdminTool):
    log_file_name = paths.IPAUPGRADE_LOG
    command_name = 'ipa-server-upgrade'

    usage = "%prog [options]"

    @classmethod
    def add_options(cls, parser):
        super(ServerUpgrade, cls).add_options(parser)
        parser.add_option("--force", action="store_true",
                          dest="force", default=False,
                          help="force upgrade (alias for --skip-version-check)")
        parser.add_option("--skip-version-check", action="store_true",
                          dest="skip_version_check", default=False,
                          help="skip version check. WARNING: this may break "
                               "your system")

    def validate_options(self):
        super(ServerUpgrade, self).validate_options(needs_root=True)

        if self.options.force:
            self.options.skip_version_check = True

    def setup_logging(self):
        super(ServerUpgrade, self).setup_logging(log_file_mode='a')

    def run(self):
        super(ServerUpgrade, self).run()

        api.bootstrap(in_server=True, context='updates', confdir=paths.ETC_IPA)
        api.finalize()

        try:
            server.upgrade_check(self.options)
            server.upgrade()
        except RuntimeError as e:
            raise admintool.ScriptError(str(e))

    def handle_error(self, exception):
        if not isinstance(exception, SystemExit):
            # do not log this message when ipa is not installed
            logger.error("IPA server upgrade failed: Inspect "
                         "/var/log/ipaupgrade.log and run command "
                         "ipa-server-upgrade manually.")
        return installutils.handle_error(exception, self.log_file_name)