Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

class-generator: fix when kind do not have properties #2181

Merged
merged 20 commits into from
Oct 31, 2024
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
747b5a5
Do not fail when kind do not have properties
myakove Oct 27, 2024
6739538
Do not fail when kind do not have properties
myakove Oct 27, 2024
f7b2bc1
Do not fail when kind do not have properties
myakove Oct 27, 2024
dcd6139
add class_generator/__cluster_version__.txt file
myakove Oct 27, 2024
43025c7
update schema
myakove Oct 27, 2024
eaf3d68
Do not update existing kind in __resources-mappings.json if cluster v…
myakove Oct 27, 2024
4babbb3
Do not update existing kind in __resources-mappings.json if cluster v…
myakove Oct 27, 2024
a9191a5
Do not update existing kind in __resources-mappings.json if cluster v…
myakove Oct 27, 2024
21c7bd7
Do not update existing kind in __resources-mappings.json if cluster v…
myakove Oct 27, 2024
0d4c1d7
Fix type
myakove Oct 27, 2024
41a4e87
Use the right generated definition file
myakove Oct 27, 2024
e8eba86
Add .coderabbit.yaml
myakove Oct 27, 2024
1100129
add type for schema_definition_file
myakove Oct 27, 2024
bfa7f58
Use Path(gettempdir()) for tmp dir
myakove Oct 27, 2024
47fc7fa
exit if cluster version file is missing
myakove Oct 27, 2024
3a7a53c
exit if error in copy files
myakove Oct 27, 2024
17d9eba
Merge branch 'main' of github.com:RedHatQE/openshift-python-wrapper i…
myakove Oct 28, 2024
bdd1365
Merge branch 'main' of github.com:RedHatQE/openshift-python-wrapper i…
myakove Oct 28, 2024
2a2a9e2
Merge branch 'main' of github.com:RedHatQE/openshift-python-wrapper i…
myakove Oct 29, 2024
ba44337
Merge branch 'main' of github.com:RedHatQE/openshift-python-wrapper i…
myakove Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
exit if error in copy files
  • Loading branch information
myakove committed Oct 27, 2024
commit 3a7a53c8728e0fdee64958ed80bc27c4a1a3422d
11 changes: 8 additions & 3 deletions class_generator/class_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _is_kind_and_namespaced(
return not_resource_dict


def map_kind_to_namespaced(client: str, newer_cluster_version: bool, schema_definition_file: str) -> None:
def map_kind_to_namespaced(client: str, newer_cluster_version: bool, schema_definition_file: Path) -> None:
not_kind_file: str = os.path.join(SCHEMA_DIR, "__not-kind.txt")

resources_mapping = read_resources_mapping_file()
Expand Down Expand Up @@ -228,8 +228,13 @@ def update_kind_schema():
# Copy only new files from tmp_schema_dir to schema dir
for root, _, files in os.walk(tmp_schema_dir):
for file_ in files:
if not os.path.isfile(Path(SCHEMA_DIR) / file_):
shutil.copy(src=Path(root) / file_, dst=Path(SCHEMA_DIR) / file_)
dst_file = Path(SCHEMA_DIR) / file_
try:
if not os.path.isfile(dst_file):
shutil.copy(src=Path(root) / file_, dst=dst_file)
except (OSError, IOError) as exp:
LOGGER.error(f"Failed to copy file {file_}: {exp}")
sys.exit(1)

map_kind_to_namespaced(
client=client, newer_cluster_version=newer_version, schema_definition_file=ocp_openapi_json_file
Expand Down