Skip to content

Commit

Permalink
Verify that this is a valid Payara installation, and a supported vers…
Browse files Browse the repository at this point in the history
…ion, from python.

(ref. #6761)
  • Loading branch information
landreev committed Apr 6, 2020
1 parent 178dc80 commit b82f54e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/installer/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pwd
from tempfile import mkstemp
import xml.etree.cElementTree as ET
from installUtils import (check_user, read_user_input, linux_ram, macos_ram, test_smtp_server, test_glassfish_directory, validate_admin_email)
from installUtils import (check_user, read_user_input, linux_ram, macos_ram, test_smtp_server, test_appserver_directory, validate_admin_email)
from installGlassfish import runAsadminScript
from installConfig import read_config_file

Expand Down Expand Up @@ -211,7 +211,7 @@

if gfDir != "":
print("testing "+gfDir+"...")
if test_glassfish_directory(gfDir):
if test_appserver_directory(gfDir):
print("ok")
config.set('glassfish', 'GLASSFISH_DIRECTORY', gfDir)
else:
Expand Down
22 changes: 21 additions & 1 deletion scripts/installer/installUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,29 @@ def validate_admin_email(emailAddress):
return True
return False

def test_glassfish_directory(directory):
def test_appserver_directory(directory):
if os.path.isdir(directory+"/glassfish/domains/domain1"):
major_version = 0
minor_version = 0
try:
with open(directory+"/glassfish/config/branding/glassfish-version.properties") as f:
for line in f:
if "=" in line:
name, value = line.rstrip().split("=", 1)

if name == "major_version":
major_version = int(value)
elif name == "minor_version":
minor_version = int(value)
except:
return False

#print("version: major: "+str(major_version)+", minor: "+str(minor_version))

if major_version != 5 or minor_version < 201:
return False
return True

return False

def test_smtp_server(address):
Expand Down

0 comments on commit b82f54e

Please sign in to comment.