Skip to content

Commit

Permalink
fix migration and helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed Jul 23, 2024
1 parent e1cd3d1 commit 8ece40f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ix-dev/charts/plex/migrations/migrate_from_kubernetes
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def migrate(values):
"logs": migrate_storage_item(config["plexStorage"]["logs"]),
"transcode": migrate_storage_item(config["plexStorage"]["transcode"]),
"additional_storage": [
migrate_storage_item(item)
migrate_storage_item(item, include_read_only=True)
for item in config["plexStorage"]["additionalStorages"]
],
},
Expand Down
3 changes: 2 additions & 1 deletion ix-dev/charts/plex/migrations/migration_helpers/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ def transform_memory(memory):

result = math.ceil(result)
result = min(result, TOTAL_MEM)
# Convert to Megabytes
result = result / 1024 / 1024
return f"{int(result)}M"
return int(result)
5 changes: 3 additions & 2 deletions ix-dev/charts/plex/migrations/migration_helpers/storage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def migrate_storage_item(storage_item):
def migrate_storage_item(storage_item, include_read_only=False):
if not storage_item:
raise ValueError("Expected [storage_item] to be set")

Expand All @@ -16,7 +16,8 @@ def migrate_storage_item(storage_item):
if mount_path:
result.update({"mount_path": mount_path})

result.update({"read_only": storage_item.get("readOnly", False)})
if include_read_only:
result.update({"read_only": storage_item.get("readOnly", False)})
return result


Expand Down

0 comments on commit 8ece40f

Please sign in to comment.