Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Push UX2 - Create config group and feature profiles #492

Merged
merged 5 commits into from
Feb 26, 2024

Conversation

jpkrajewski
Copy link
Collaborator

@jpkrajewski jpkrajewski commented Feb 23, 2024

Pull Request summary:

Created part of a Push Migration script.
It creates Config group and feature profiles to which we can attach parcels.

Description of changes:

How to run (for now):

with create_manager_session(
    url="exmaple.com",
    username="admin",
    password="pass",
    port=11011,
    logger=logger,
) as session:
    result = push_ux2_config(session, UX2Config(), logger)
    print(result)

Effect:
image
image

Added more fields to ConfigGroup Pydantic model, because the endpoint is returning more fields
Changed ConfigGroup GET endpoint to get all or get by id

Checklist:

  • Make sure to run pre-commit before committing changes
  • Make sure all checks have passed
  • PR description is clear and comprehensive
  • Mentioned the issue that this PR solves (if applicable)
  • Make sure you test the changes

@jpkrajewski jpkrajewski marked this pull request as ready for review February 23, 2024 14:59
Kuba and others added 4 commits February 23, 2024 16:40
This commit refactors the code responsible for normalizing template definitions by implementing improved type annotations, better function organization, and enhanced error handling. Key changes include:

1. Refactoring the to_snake_case function to use the str.replace method for kebab-case to snake_case conversion.
2. Improving the cast_value_to_global function to handle different types of input values, including lists and IP addresses, and utilizing IPv4Address and IPv6Address from the ipaddress module.
3. Enhancing the transform_dict function to handle nested dictionaries and lists, casting leaf values to global types recursively.
4. Updating the template_definition_normalization function to utilize the refactored transform_dict function for key transformation and value normalization.

These changes improve code readability, maintainability, and robustness, providing a more efficient and reliable solution for template definition normalization.
@sbasan sbasan merged commit 1ecfc0d into dev-ux-migration Feb 26, 2024
10 checks passed
@sbasan sbasan deleted the dev/configgroup-create branch February 26, 2024 12:56
jpkrajewski added a commit that referenced this pull request Mar 7, 2024
* Push UX2 - Create config group and feature profiles

* Simplify push_ux2_config

* UX2Config rework

* Refactor code for template definition normalization

This commit refactors the code responsible for normalizing template definitions by implementing improved type annotations, better function organization, and enhanced error handling. Key changes include:

1. Refactoring the to_snake_case function to use the str.replace method for kebab-case to snake_case conversion.
2. Improving the cast_value_to_global function to handle different types of input values, including lists and IP addresses, and utilizing IPv4Address and IPv6Address from the ipaddress module.
3. Enhancing the transform_dict function to handle nested dictionaries and lists, casting leaf values to global types recursively.
4. Updating the template_definition_normalization function to utilize the refactored transform_dict function for key transformation and value normalization.

These changes improve code readability, maintainability, and robustness, providing a more efficient and reliable solution for template definition normalization.

* Add tests for normalization and Literal casting

---------

Co-authored-by: Kuba <[email protected]>
Co-authored-by: sbasan <[email protected]>
Co-authored-by: Jakub Krajewski <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants