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

Commit

Permalink
rename rollback info fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan committed Mar 22, 2024
1 parent 04a0490 commit a5dae78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions catalystwan/models/configuration/config_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,15 @@ class UX2Config(BaseModel):


class UX2ConfigRollback(BaseModel):
config_groups_ids: List[UUID] = Field(default_factory=list)
feature_profiles_ids: List[Tuple[UUID, ProfileType]] = Field(default_factory=list)
config_group_ids: List[UUID] = Field(
default_factory=list, serialization_alias="ConfigGroupIds", validation_alias="ConfigGroupIds"
)
feature_profile_ids: List[Tuple[UUID, ProfileType]] = Field(
default_factory=list, serialization_alias="FeatureProfileIds", validation_alias="FeatureProfileIds"
)

def add_config_group(self, config_group_id: UUID) -> None:
self.config_groups_ids.append(config_group_id)
self.config_group_ids.append(config_group_id)

def add_feature_profile(self, feature_profile_id: UUID, profile_type: ProfileType) -> None:
self.feature_profiles_ids.append((feature_profile_id, profile_type))
self.feature_profile_ids.append((feature_profile_id, profile_type))
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def __init__(self, session) -> None:

def rollback(self, rollback_config: UX2ConfigRollback) -> bool:
try:
for cg_id in rollback_config.config_groups_ids:
for cg_id in rollback_config.config_group_ids:
self._session.endpoints.configuration_group.delete_config_group(cg_id)
for feature_profile_id, type_ in rollback_config.feature_profiles_ids:
for feature_profile_id, type_ in rollback_config.feature_profile_ids:
api = FeatureProfileAPIFactory.get_api(type_, self._session)
if type_ == "policy-object":
continue
Expand Down

0 comments on commit a5dae78

Please sign in to comment.