-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Changes to support external credentials in envgene #1375
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,10 +141,7 @@ def alignYamlComments(yamlContent, extra_indent=0): | |
|
|
||
|
|
||
| def sortYaml(yaml_data, schema_path, remove_additional_props): | ||
| with open(schema_path, 'r') as f: | ||
| schema_data = json.load(f) | ||
| logger.debug(f'Checking yaml with schema: {schema_path}') | ||
| jsonschema.validate(yaml_data, schema_data) | ||
| schema_data = validateSchema(yaml_data, schema_path) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. schema validation should remain separate method and not be encapsulated in sorting or sm else |
||
| sort_data = jschon_tools.process_json_doc( | ||
| schema_data=schema_data, | ||
| doc_data=yaml_data, | ||
|
|
@@ -153,6 +150,13 @@ def sortYaml(yaml_data, schema_path, remove_additional_props): | |
| ) | ||
| return sort_data | ||
|
|
||
| def validateSchema(yaml_data, schema_path): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we already have https://github.com/tesmarishy/qubership-envgene/blob/1272b27df2c78f865d17bd5f987e13301640a856/python/envgene/envgenehelper/yaml_helper.py#L406. no need to produce identical methods |
||
| with open(schema_path, 'r') as f: | ||
| schema_data = json.load(f) | ||
| logger.debug(f'Checking yaml with schema: {schema_path}') | ||
| jsonschema.validate(yaml_data, schema_data) | ||
| return schema_data | ||
|
|
||
|
|
||
| def get_nested_yaml_attribute_or_fail(yaml_content, attribute_str): | ||
| keys = attribute_str.split('.') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -992,4 +992,4 @@ | |
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,4 +168,4 @@ | |
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -466,7 +466,7 @@ def process_additional_template_parameters(render_env_dir, source_env_dir, all_i | |
|
|
||
|
|
||
| def build_env(env_name, env_instances_dir, parameters_dir, env_template_dir, resource_profiles_dir, | ||
| env_specific_resource_profile_map, all_instances_dir, render_context, templates_dirs=None): | ||
| env_specific_resource_profile_map, all_instances_dir, render_context, templates_dirs=None, isExternalCredEnv=False): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls no some camel case in python |
||
| # Check which role-specific templates were downloaded | ||
| templates_dirs = templates_dirs or {} | ||
| origin_template_exists = NamespaceRole.ORIGIN in templates_dirs | ||
|
|
@@ -525,7 +525,7 @@ def build_env(env_name, env_instances_dir, parameters_dir, env_template_dir, res | |
| header_text=generated_header_text, | ||
| process_env_specific=False) | ||
| # process cloud passport | ||
| process_cloud_passport(env_dir, env_instances_dir, all_instances_dir) | ||
| process_cloud_passport(env_dir, env_instances_dir, all_instances_dir, isExternalCredEnv) | ||
| logger.info("Processing cloud with env specific parameters.") | ||
| processTemplate( | ||
| cloudTemlatePath, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why cast to string? it may be worth falling if what is passed is not of correct str type(int)