Skip to content

Commit

Permalink
Merge pull request #173 from luck3y/legacy-7.3
Browse files Browse the repository at this point in the history
[CLOUD-3473] Legacy zip installer support for 7.3 & layered products
  • Loading branch information
jmesnil authored Mar 5, 2020
2 parents e4d726a + ac24df9 commit ab61078
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 30 deletions.
6 changes: 3 additions & 3 deletions os-eap-probes/2.0/added/probes/probe/jolokia.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import os
import requests
import sys
import configparser as ConfigParser
from io import StringIO
import ConfigParser
import StringIO

from collections import OrderedDict

Expand Down Expand Up @@ -61,7 +61,7 @@ def __readConfig(self):
self.logger.info("Reading jolokia properties file")
with open("/opt/jolokia/etc/jolokia.properties") as jolokiaProperties:
# fake a section
jolokiaConfig.readfp(StringIO("[jolokia]\n" + jolokiaProperties.read()))
jolokiaConfig.readfp(StringIO.StringIO("[jolokia]\n" + jolokiaProperties.read()))

self.host = "localhost"
self.port = int(jolokiaConfig.get("jolokia", "port")) + int(os.getenv('PORT_OFFSET', 0))
Expand Down
5 changes: 1 addition & 4 deletions os-eap-probes/2.0/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ set -e
SCRIPT_DIR=$(dirname $0)
ADDED_DIR=${SCRIPT_DIR}/added

# Add liveness and readiness probes and helper library
# Add jolokia specific scripts
cp -r "$ADDED_DIR"/* $JBOSS_HOME/bin/

chown -R jboss:root $JBOSS_HOME/bin/
chmod -R g+rwX $JBOSS_HOME/bin/

# ensure added scripts are executable
chmod ug+x $JBOSS_HOME/bin/readinessProbe.sh $JBOSS_HOME/bin/livenessProbe.sh
chmod -R ug+x $JBOSS_HOME/bin/probes
12 changes: 6 additions & 6 deletions os-eap-probes/2.0/module.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
schema_version: 1
name: os-eap-probes
version: '2.0'
description: os-eap-probes script package for python 3
description: os-eap-probes script package for python 2
execute:
- script: configure.sh
user: '185'
packages:
install:
- python3-requests
envs:
- name: "PROBE_DISABLE_BOOT_ERRORS_CHECK"
example: "true"
description: Disable the boot errors check in the probes.
- python-enum34
- python-requests
modules:
install:
- name: os-eap-probes-common
6 changes: 1 addition & 5 deletions os-eap-probes/3.0/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ set -e
SCRIPT_DIR=$(dirname $0)
ADDED_DIR=${SCRIPT_DIR}/added

# Add liveness and readiness probes and helper library
# Add jolokia specific scripts
cp -r "$ADDED_DIR"/* $JBOSS_HOME/bin/

chown -R jboss:root $JBOSS_HOME/bin/
chmod -R g+rwX $JBOSS_HOME/bin/

# ensure added scripts are executable
chmod ug+x $JBOSS_HOME/bin/readinessProbe.sh $JBOSS_HOME/bin/livenessProbe.sh
chmod -R ug+x $JBOSS_HOME/bin/probes
7 changes: 3 additions & 4 deletions os-eap-probes/3.0/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ execute:
packages:
install:
- python3-requests
envs:
- name: "PROBE_DISABLE_BOOT_ERRORS_CHECK"
example: "true"
description: Disable the boot errors check in the probes.
modules:
install:
- name: os-eap-probes-common
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def evaluate(self, results):
elsif the 'read-resource' step failed:
READY as failure means no health check subsystem configured on the system
elsif the 'check' step succeeded:
READY if the 'check' step result's outcome field is 'UP'
READY if the 'check' step result's status field is 'UP'
HARD_FAILURE otherwise
else:
HARD_FAILURE as the query failed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def evaluate(self, results):
Evaluates the test:
READY for a 404 due to InstanceNotFoundException as that means no health check configured on the system
HARD_FAILURE for any other non-200 as the query failed
READY if the result value's outcome field is 'UP'
READY if the result value's status field is 'UP'
HARD_FAILURE otherwise
In no case do we return NOT_READY as MicroProfile Health Check is not a readiness check.
Expand All @@ -177,13 +177,13 @@ def evaluate(self, results):
if results["status"] != 200 or not results.get("value"):
return (Status.HARD_FAILURE, "Jolokia query failed " + str(results))

outcome = results["value"].get("outcome")
status = results["value"].get("status")

if not outcome:
return (Status.HARD_FAILURE, "No outcome")
if not status:
return (Status.HARD_FAILURE, "No status")

if re.compile("\W*UP\W*").match(outcome):
if re.compile("\W*UP\W*").match(status):
return (Status.READY, "Status is UP")

return (Status.HARD_FAILURE, outcome)
return (Status.HARD_FAILURE, status)

File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions os-eap-probes/common/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
set -e

SCRIPT_DIR=$(dirname $0)
ADDED_DIR=${SCRIPT_DIR}/added

# Add liveness and readiness probes and helper library
cp -r "$ADDED_DIR"/* $JBOSS_HOME/bin/

chown -R jboss:root $JBOSS_HOME/bin/
chmod -R g+rwX $JBOSS_HOME/bin/

# ensure added scripts are executable
chmod ug+x $JBOSS_HOME/bin/readinessProbe.sh $JBOSS_HOME/bin/livenessProbe.sh
chmod -R ug+x $JBOSS_HOME/bin/probes
12 changes: 12 additions & 0 deletions os-eap-probes/common/module.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
schema_version: 1
name: os-eap-probes-common
version: '1.0'
description: os-eap-probes common scripts
execute:
- script: configure.sh
user: '185'

envs:
- name: "PROBE_DISABLE_BOOT_ERRORS_CHECK"
example: "true"
description: Disable the boot errors check in the probes.
2 changes: 1 addition & 1 deletion os-eap7-openshift/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: '1.0'
description: Legacy os-eap7-openshift script package.
modules:
install:
- name: os-java-run
- name: jboss.container.java.jvm.bash
execute:
- script: prepare.sh
- script: configure.sh
Expand Down

0 comments on commit ab61078

Please sign in to comment.