#!/usr/bin/python2

import subprocess
import re
from preupg.script_api import *

check_rpm_to (check_rpm="",check_bin="python")

#END GENERATED SECTION

try:
    from ipaserver.install import installutils
    from ipalib import api
    ipaserver_installed = True
except ImportError:
    ipaserver_installed = False


def main():
    if not ipaserver_installed:
        log_info("The ipa-server package is not installed.")
        exit_not_applicable()

    if not installutils.is_ipa_configured():
        log_info("Identity Managament Server is not configured.")
        exit_not_applicable()

    log_extreme_risk("Identity Management Server cannot be in-place upgraded.")
    exit_fail()

if __name__ == "__main__":
    main()
    exit_pass()

