freeipa/ipaserver/install/ipa_server_upgrade.py
Fraser Tweedale b24fe0eb73 Import included profiles during install or upgrade
Add a default service profile template as part of FreeIPA and format
and import it as part of installation or upgrade process.

Also remove the code that modifies the old (file-based)
`caIPAserviceCert' profile.

Fixes https://fedorahosted.org/freeipa/ticket/4002

Reviewed-By: Martin Basti <mbasti@redhat.com>
2015-06-04 08:27:33 +00:00

55 lines
1.7 KiB
Python

#
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
#
import os
from ipalib import api
from ipaplatform.paths import paths
from ipapython import admintool
from ipaserver.install import installutils
from ipaserver.install import server
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')
import ipaserver.plugins.dogtag # ensure profile backend gets loaded
api.finalize()
try:
server.upgrade_check(self.options)
server.upgrade()
except RuntimeError as e:
raise admintool.ScriptError(str(e))
def handle_error(self, exception):
return installutils.handle_error(exception, self.log_file_name)