Update to 2024.2
Redfish changed the directory structure again. Don't see that ZipFile
has a "cd" so insert the version in the path when checking or building
the path.
You can see this directory structure change by downloading 2024.2 vs
2024.1. Also by printing the ZipFile Info.
<ZipInfo filename='DSP8010_2024.2/info.json' compress_type=deflate
filemode='-rw-r--r--' file_size=54 compress_size=42>
This is how we used to do it. [1]
[1]: https://github.com/openbmc/bmcweb/commit/60c922dfacd5d1aeec8789e03edc91b47f4a6661
Make the changes for the script, bump the version, and run the script.
See below for more info on this release:
https://www.dmtf.org/content/redfish-release-20242-now-available
Tested: Validator is happy.
Change-Id: I87674d5b9ff19b39d3cdf2fb046543e21a6ebc5b
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py
index 4207c53..d4e8785 100755
--- a/scripts/update_schemas.py
+++ b/scripts/update_schemas.py
@@ -9,7 +9,7 @@
import requests
from generate_schema_collections import generate_top_collections
-VERSION = "DSP8010_2024.1"
+VERSION = "DSP8010_2024.2"
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
@@ -72,19 +72,18 @@
csdl_filenames = []
json_schema_files = defaultdict(list)
-
for zip_file in zip_ref.infolist():
if zip_file.is_dir():
continue
- if zip_file.filename.startswith("csdl/"):
+ if zip_file.filename.startswith(VERSION + "/csdl/"):
csdl_filenames.append(os.path.basename(zip_file.filename))
- elif zip_file.filename.startswith("json-schema/"):
+ elif zip_file.filename.startswith(VERSION + "/json-schema/"):
filename = os.path.basename(zip_file.filename)
filenamesplit = filename.split(".")
json_schema_files[filenamesplit[0]].append(filename)
- elif zip_file.filename.startswith("openapi/"):
+ elif zip_file.filename.startswith(VERSION + "/openapi/"):
pass
- elif zip_file.filename.startswith("dictionaries/"):
+ elif zip_file.filename.startswith(VERSION + "/dictionaries/"):
pass
# sort the json files by version
@@ -99,12 +98,12 @@
for csdl_file in csdl_filenames:
with open(os.path.join(schema_path, csdl_file), "wb") as schema_out:
- content = zip_ref.read(os.path.join("csdl", csdl_file))
+ content = zip_ref.read(os.path.join(VERSION + "/csdl", csdl_file))
content = content.replace(b"\r\n", b"\n")
schema_out.write(content)
for schema_filename, versions in json_schema_files.items():
- zip_filepath = os.path.join("json-schema", versions[0])
+ zip_filepath = os.path.join(VERSION + "/json-schema", versions[0])
with open(
os.path.join(json_schema_path, versions[0]), "wb"