mirror of
https://github.com/MAGICGrants/truenas-apps.git
synced 2026-01-08 04:03:51 -05:00
* chore(deps): update updates-patch-minor * devbox (#3726) * bump devbox * order * another * more scripts * opencloud: fix csp (#3741) * opencloud: fix csp * better --------- Co-authored-by: bugclerk <bugclerk@ixsystems.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
29 lines
755 B
Python
Executable File
29 lines
755 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import os
|
|
import sys
|
|
import yaml
|
|
|
|
|
|
def migrate(values):
|
|
new_csp = []
|
|
for x in values["opencloud"]["additional_csp"]:
|
|
new_item = {"directive": x["directive"], "items": []}
|
|
for i in x["items"]:
|
|
if isinstance(i, str):
|
|
new_item["items"].append({"value": i, "placeholder": ""})
|
|
else:
|
|
new_item["items"].append(i)
|
|
new_csp.append(new_item) # ← This line was missing!
|
|
values["opencloud"]["additional_csp"] = new_csp
|
|
return values
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) != 2:
|
|
exit(1)
|
|
|
|
if os.path.exists(sys.argv[1]):
|
|
with open(sys.argv[1], "r") as f:
|
|
print(yaml.dump(migrate(yaml.safe_load(f.read()))))
|