From f80a0bc1df3fc366e9d7a07173e4b21612457d54 Mon Sep 17 00:00:00 2001 From: SG Date: Thu, 29 Feb 2024 10:59:36 -0700 Subject: [PATCH] fix a few issues with the install.py script when installing from GitHub releases, idaholab/Malcolm#416 --- scripts/install.py | 37 +++++++++++++++++++++---------------- scripts/malcolm_common.py | 8 +++++--- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/scripts/install.py b/scripts/install.py index 18ad5a85a..c7e2ddad6 100755 --- a/scripts/install.py +++ b/scripts/install.py @@ -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?") @@ -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() @@ -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'), @@ -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 @@ -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 ], @@ -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: diff --git a/scripts/malcolm_common.py b/scripts/malcolm_common.py index d8e95ded3..dbb31f605 100644 --- a/scripts/malcolm_common.py +++ b/scripts/malcolm_common.py @@ -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")