Skip to content

Commit

Permalink
fix a few issues with the install.py script when installing from GitH…
Browse files Browse the repository at this point in the history
…ub releases, idaholab#416
  • Loading branch information
mmguero committed Feb 29, 2024
1 parent f2c45d8 commit f80a0bc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
37 changes: 21 additions & 16 deletions scripts/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,6 @@ def install_malcolm_files(self, malcolm_install_file, default_config_dir):
if os.path.isfile(os.path.join(installPath, "docker-compose.yml")):
eprint(f"Malcolm runtime files extracted to {installPath}")
result = True
with open(os.path.join(installPath, "install_source.txt"), 'w') as f:
f.write(
f'{os.path.basename(malcolm_install_file)} (installed {str(datetime.datetime.now())})\n'
)
else:
eprint(f"Malcolm install file extracted to {installPath}, but missing runtime files?")

Expand Down Expand Up @@ -711,9 +707,11 @@ def tweak_malcolm_runtime(self, malcolm_install_path):
)
while (
not InstallerYesOrNo(
f'Setting {osMemory} for OpenSearch and {lsMemory} for Logstash. Is this OK?'
if opensearchPrimaryMode == DatabaseMode.OpenSearchLocal
else f'Setting {lsMemory} for Logstash. Is this OK?',
(
f'Setting {osMemory} for OpenSearch and {lsMemory} for Logstash. Is this OK?'
if opensearchPrimaryMode == DatabaseMode.OpenSearchLocal
else f'Setting {lsMemory} for Logstash. Is this OK?'
),
default=True,
)
and loopBreaker.increment()
Expand Down Expand Up @@ -976,6 +974,7 @@ def tweak_malcolm_runtime(self, malcolm_install_path):

# make sure paths specified (and their necessary children) exist
for pathToCreate in (
malcolm_install_path,
indexDirFull,
indexSnapshotDirFull,
os.path.join(pcapDirFull, 'arkime-live'),
Expand Down Expand Up @@ -1075,9 +1074,11 @@ def tweak_malcolm_runtime(self, malcolm_install_path):
break

if InstallerYesOrNo(
'Should Malcolm delete the oldest database indices and/or PCAP files based on available storage?'
if ((opensearchPrimaryMode == DatabaseMode.OpenSearchLocal) and (malcolmProfile == PROFILE_MALCOLM))
else 'Should Arkime delete PCAP files based on available storage (see https://arkime.com/faq#pcap-deletion)?',
(
'Should Malcolm delete the oldest database indices and/or PCAP files based on available storage?'
if ((opensearchPrimaryMode == DatabaseMode.OpenSearchLocal) and (malcolmProfile == PROFILE_MALCOLM))
else 'Should Arkime delete PCAP files based on available storage (see https://arkime.com/faq#pcap-deletion)?'
),
default=args.arkimeManagePCAP or bool(args.indexPruneSizeLimit),
):
# delete oldest indexes based on index pattern size
Expand Down Expand Up @@ -1292,9 +1293,11 @@ def tweak_malcolm_runtime(self, malcolm_install_path):
(
x,
'',
x == filePreserveModeDefault
if filePreserveModeDefault
else allowedFilePreserveModes[0],
(
x == filePreserveModeDefault
if filePreserveModeDefault
else allowedFilePreserveModes[0]
),
)
for x in allowedFilePreserveModes
],
Expand All @@ -1307,9 +1310,11 @@ def tweak_malcolm_runtime(self, malcolm_install_path):
'ZIP downloaded preserved files?', default=args.fileCarveHttpServerZip
)
fileCarveHttpServeEncryptKey = InstallerAskForString(
'Enter ZIP archive password for downloaded preserved files (or leave blank for unprotected)'
if fileCarveHttpServerZip
else 'Enter AES-256-CBC encryption password for downloaded preserved files (or leave blank for unencrypted)',
(
'Enter ZIP archive password for downloaded preserved files (or leave blank for unprotected)'
if fileCarveHttpServerZip
else 'Enter AES-256-CBC encryption password for downloaded preserved files (or leave blank for unencrypted)'
),
default=args.fileCarveHttpServeEncryptKey,
)
if fileCarveMode is not None:
Expand Down
8 changes: 5 additions & 3 deletions scripts/malcolm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,11 @@ def AskForString(
elif (uiMode & UserInterfaceMode.InteractionDialog) and (MainDialog is not None):
code, reply = MainDialog.inputbox(
question,
init=default
if (default is not None) and (defaultBehavior & UserInputDefaultsBehavior.DefaultsPrompt)
else "",
init=(
default
if (default is not None) and (defaultBehavior & UserInputDefaultsBehavior.DefaultsPrompt)
else ""
),
)
if (code == Dialog.CANCEL) or (code == Dialog.ESC):
raise RuntimeError("Operation cancelled")
Expand Down

0 comments on commit f80a0bc

Please sign in to comment.