Skip to content

Commit

Permalink
Fix the directory for getting the war files, if we're running from th…
Browse files Browse the repository at this point in the history
…e script in development mode; and improve the output on failures.
  • Loading branch information
devilgate committed Mar 26, 2019
1 parent e9d459a commit f6a7f6d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions installer/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from dataclasses import dataclass
from distutils.util import strtobool
from getpass import getpass
from inspect import currentframe, getframeinfo
from pathlib import Path

WAR_FILES_LOCATION = "war_files_location"
Expand Down Expand Up @@ -134,22 +135,25 @@ def main():

if process.returncode is not None and process.returncode != 0:
db_created = False
msg = """Something went wrong when running the script {}
msg = """Something went wrong when running the script {}
Output from script: {}
Errors from script: {}
{}
Database creation failed"""
banner(msg.format(script, process.stdout, process.stderr),
banner(msg.format(
script, process.stdout,
("Errors from script: "
+ process.stderr) if process.stderr else ""),
120)
break
db_created = True

if db_created:
ensure_tomcat_directories_exist(settings)

# Deploy WAR files
for f in get_war_files(settings):
shutil.copy(f, settings.cat_home / "webapps")
Expand Down Expand Up @@ -242,9 +246,9 @@ def get_settings():
# under the project root. The root directory is thus one level up.
if settings.dev_mode:

# TODO: this should actually use the parent of the directory of the
# current script, not of the current working directory.
settings.war_dir = Path.cwd().resolve().parent
# We want the parent of the directory containing the current script
this_script_name = getframeinfo(currentframe()).filename
settings.war_dir = Path(this_script_name).resolve().parent.parent
else:
settings.war_dir = base_path / "warfiles"

Expand Down

0 comments on commit f6a7f6d

Please sign in to comment.