def validateIpaAndHttpdStatus(conf):
    """"
    This function serve as a pre-condition to the ports group. This function will always return True,
    Therefore the ports group will always be handled, but this function may changes the flow dynamically
    according to http & ipa rpm status.
    So, there are two purposes for this function:
    1. check whether the relevant httpd configuration files were changed,
    As it's an indication for the setup that the httpd application is being actively used,
    Therefore we may need to ask (dynamic change) the user whether to override this configuration.
    2. Check if IPA is installed and drop port 80/443 support.
    """
    controller = Controller()

    # Check if IPA installed
    if utils.installed(basedefs.IPA_RPM) or utils.installed(basedefs.FREEIPA_RPM):
        # Change default ports
        logging.debug("IPA rpms detected, disabling http proxy")
        print output_messages.WARN_IPA_INSTALLED
        utils.setHttpPortsToNonProxyDefault(controller)

        # Don't use http proxy
        paramToChange = controller.getParamByName("OVERRIDE_HTTPD_CONFIG")
        paramToChange.setKey("DEFAULT_VALUE", "no")
    else:
        if wereHttpdConfFilesChanged:
            # If conf files were changed, the user should be asked if he really wants to use ports 80/443
            paramToChange = controller.getParamByName("OVERRIDE_HTTPD_CONFIG")
            paramToChange.setKey("USE_DEFAULT", False)

    # This validator must return true, so ports will always be handled
    return True
Пример #2
0
def validateIpaAndHttpdStatus(conf):
    """"
    This function serve as a pre-condition to the ports group. This function will always return True,
    Therefore the ports group will always be handled, but this function may changes the flow dynamically
    according to http & ipa rpm status.
    So, there are two purposes for this function:
    1. check whether the relevant httpd configuration files were changed,
    As it's an indication for the setup that the httpd application is being actively used,
    Therefore we may need to ask (dynamic change) the user whether to override this configuration.
    2. Check if IPA is installed and drop port 80/443 support.
    """
    controller = Controller()

    # Check if IPA installed
    if utils.installed(basedefs.IPA_RPM) or utils.installed(basedefs.FREEIPA_RPM):
        # Change default ports
        logging.debug("IPA rpms detected, disabling http proxy")
        print output_messages.WARN_IPA_INSTALLED
        utils.setHttpPortsToNonProxyDefault(controller)

        # Don't use http proxy
        paramToChange = controller.getParamByName("OVERRIDE_HTTPD_CONFIG")
        paramToChange.setKey("DEFAULT_VALUE", "no")
    else:
        if wereHttpdConfFilesChanged:
            # If conf files were changed, the user should be asked if he really wants to use ports 80/443
            paramToChange = controller.getParamByName("OVERRIDE_HTTPD_CONFIG")
            paramToChange.setKey("USE_DEFAULT", False)

    # This validator must return true, so ports will always be handled
    return True
def validateOverrideHttpdConfAndChangePortsAccordingly(param, options=[]):
    """
    This validation function is specific for the OVERRIDE_HTTPD_CONF param and it does more than validating the answer.
    It actually changes the default HTTP/S ports in case the user choose not to override the httpd configuration.
    """
    logging.info("validateOverrideHttpdConfAndChangePortsAccordingly %s as part of %s"%(param, options))
    retval = validateOptions(param, options)
    if retval and param.lower() == "no":
        logging.debug("Changing HTTP_PORT & HTTPS_PORT to the default jboss values (8080 & 8443)")
        controller = Controller()
        utils.setHttpPortsToNonProxyDefault(controller)
    elif retval:
        #stopping httpd service (in case it's up) when the configuration can be overridden
        logging.debug("stopping httpd service")
        utils.Service(basedefs.HTTPD_SERVICE_NAME).stop()
    return retval
Пример #4
0
def validateOverrideHttpdConfAndChangePortsAccordingly(param, options=[]):
    """
    This validation function is specific for the OVERRIDE_HTTPD_CONF param and it does more than validating the answer.
    It actually changes the default HTTP/S ports in case the user choose not to override the httpd configuration.
    """
    logging.info("validateOverrideHttpdConfAndChangePortsAccordingly %s as part of %s"%(param, options))
    retval = validateOptions(param, options)
    if retval and param.lower() == "no":
        logging.debug("Changing HTTP_PORT & HTTPS_PORT to the default jboss values (8700 & 8701)")
        controller = Controller()
        utils.setHttpPortsToNonProxyDefault(controller)
    elif retval:
        #stopping httpd service (in case it's up) when the configuration can be overridden
        logging.debug("stopping httpd service")
        utils.Service(basedefs.HTTPD_SERVICE_NAME).stop()
    return retval