Skip to content

Commit

Permalink
fix(NextFpmPort): exit early if NextFpmPort file does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Dec 6, 2024
1 parent c58c37c commit e32c918
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions imageroot/update-module.d/10fix_NextFpmPort
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import sys
directory = "databases/vhosts/"
output_file = "databases/NextFpmPort"

# no vhosts, no need to continue
if not os.path.exists(output_file):
sys.exit(0)

# Find all .ini files
ini_files = [f for f in os.listdir(directory) if f.endswith('.ini')]

Expand All @@ -49,12 +53,11 @@ except:

# Read the current value from the NextFpmPort file if it exists
current_id = None
if os.path.exists(output_file):
with open(output_file, "r") as f:
try:
current_id = int(f.read().strip())
except ValueError:
current_id = None
with open(output_file, "r") as f:
try:
current_id = int(f.read().strip())
except ValueError:
current_id = None

# Write the last ID only if it's greater than the current value
if current_id is None or last_id > current_id:
Expand Down

0 comments on commit e32c918

Please sign in to comment.