From 345c53542cb601303b780b52ae153925aca585cc Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Mon, 8 Jan 2024 12:08:13 -0500 Subject: [PATCH] Expand garden model (#428) --- CHANGELOG.rst | 9 ++++++++- brewtils/models.py | 18 +++++++++++++++++- brewtils/schemas.py | 5 +++++ brewtils/test/fixtures.py | 3 +++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0cf79a2b..fdbf9552 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,12 +1,18 @@ Brewtils Changelog ================== +3.24.0 +------ +TBD + +- Expanding Garden model to include children gardens +- Added Source/Target Garden labels on Request model + 3.23.1 ------ TBD - Fixed self reference bug that was returning back output instead of Request object. -- Added Source/Target Garden labels on Request model 3.23.0 ------ @@ -29,6 +35,7 @@ TBD - Adding default topic for PublishClient to Plugins {Namespace}.{System}.{Version}.{Instance} - Removed Python 12 support until we upgrade Marshmallow dependency to 3.15 or greater + 3.21.0 ------ 11/16/2023 diff --git a/brewtils/models.py b/brewtils/models.py index afe6722e..fcc02218 100644 --- a/brewtils/models.py +++ b/brewtils/models.py @@ -1452,6 +1452,9 @@ def __init__( systems=None, connection_type=None, connection_params=None, + has_parent=None, + parent=None, + children=None, ): self.id = id self.name = name @@ -1463,11 +1466,24 @@ def __init__( self.connection_type = connection_type self.connection_params = connection_params + self.has_parent = has_parent + self.parent = parent + self.children = children + def __str__(self): return "%s" % self.name def __repr__(self): - return "" % (self.name, self.status) + return ( + "" + % ( + self.name, + self.status, + self.parent, + self.has_parent, + self.connection_type, + ) + ) class Operation(BaseModel): diff --git a/brewtils/schemas.py b/brewtils/schemas.py index 7a02a7f1..237429b7 100644 --- a/brewtils/schemas.py +++ b/brewtils/schemas.py @@ -497,6 +497,11 @@ class GardenSchema(BaseSchema): connection_params = fields.Dict(allow_none=True) namespaces = fields.List(fields.Str(), allow_none=True) systems = fields.Nested("SystemSchema", many=True, allow_none=True) + has_parent = fields.Bool(allow_none=True) + parent = fields.Str(allow_none=True) + children = fields.Nested( + "self", exclude=("parent"), many=True, default=None, allow_none=True + ) class GardenDomainIdentifierSchema(BaseSchema): diff --git a/brewtils/test/fixtures.py b/brewtils/test/fixtures.py index 45c86b50..d03a2bf7 100644 --- a/brewtils/test/fixtures.py +++ b/brewtils/test/fixtures.py @@ -763,6 +763,9 @@ def garden_dict(ts_epoch, system_dict): "systems": [system_dict], "connection_type": "http", "connection_params": {}, + "parent": None, + "has_parent": False, + "children": [], }