Skip to content

Commit

Permalink
Merge branch '3.27.0_staged' into Replication
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog authored Jul 25, 2024
2 parents 1478649 + 4bddb90 commit fdc3f88
Show file tree
Hide file tree
Showing 24 changed files with 829 additions and 387 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ Brewtils Changelog
TBD

- Added support models for tracking primary replication
- New Models for User, UserToken, Role, and AliasUserMap
- Must upgrade to a minimum version of Beer Garden 3.27.0 to support new authentication models. If authentication is not enabled, upgrade
is not required.
- Removed 2.0 Legacy support for Principle and LegacyRole models
- Fixed bug in SystemClient to properly assign requester field from parent request

3.26.4
------
7/12/24

- Fixed bug where parameter type mapping did not match type hinting
- Exposed a read only feature to provide the current request that is being processed `from brewtils import get_current_request_read_only`
- Expand Job Export to include Job id

3.26.3
------
7/10/24

- Update Parameter decorator to map parameter type from literal to string value if possible
- Added Subscriber Types to Subscriber model
- Added Prefix Topics to System model
- Support adding Prefix Topics for the Generated Subscribers. It is supported through the `@client` or SystemClient inputs or beer.conf

3.26.2
------
Expand Down
7 changes: 6 additions & 1 deletion brewtils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
from brewtils.config import get_argument_parser, get_connection_info, load_config
from brewtils.decorators import client, command, parameter, subscribe, system
from brewtils.log import configure_logging
from brewtils.plugin import Plugin, RemotePlugin # noqa F401
from brewtils.plugin import (
get_current_request_read_only,
Plugin,
RemotePlugin,
) # noqa F401
from brewtils.rest import normalize_url_prefix
from brewtils.rest.easy_client import EasyClient, get_easy_client
from brewtils.rest.publish_client import PublishClient
Expand All @@ -28,6 +32,7 @@
"configure_logging",
"normalize_url_prefix",
"AutoDecorator",
"get_current_request_read_only",
]

# Aliased for compatibility
Expand Down
2 changes: 1 addition & 1 deletion brewtils/__version__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = "3.26.2"
__version__ = "3.26.4"
1 change: 0 additions & 1 deletion brewtils/auto_decorator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from inspect import Parameter as InspectParameter # noqa
from inspect import signature


from brewtils.models import Command, Parameter


Expand Down
31 changes: 24 additions & 7 deletions brewtils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def client(
bg_version=None, # type: Optional[str]
group=None, # type: str
groups=[], # type: Optional[List[str]]
prefix_topic=None, # type: Optional[str]
):
# type: (...) -> Type
"""Class decorator that marks a class as a beer-garden Client
Expand Down Expand Up @@ -68,14 +69,20 @@ def client(
bg_version: Optional plugin version
group: Optional plugin group
groups: Optional plugin groups
prefix_topic: Optional prefix for Generated Command to Topic mappings
Returns:
The decorated class
"""
if _wrapped is None:
return functools.partial(
client, bg_name=bg_name, bg_version=bg_version, groups=groups, group=group
client,
bg_name=bg_name,
bg_version=bg_version,
groups=groups,
group=group,
prefix_topic=prefix_topic,
) # noqa

# Assign these here so linters don't complain
Expand All @@ -84,6 +91,7 @@ def client(
_wrapped._bg_commands = []
_wrapped._current_request = None
_wrapped._groups = groups
_wrapped._prefix_topic = prefix_topic

if group:
_wrapped._groups.append(group)
Expand Down Expand Up @@ -288,12 +296,21 @@ def echo(self, message):
"""

# Allowing type matching: string == String == STRING
if type and type not in Parameter.TYPES:
for parameter_type in Parameter.TYPES:
if type.upper() == parameter_type.upper():
type = parameter_type
break
# Validate type against permitted string literals
if type:
if not isinstance(type, str):
# Try to map literal to string equivalent
temp_type = _format_type(type)
if temp_type in Parameter.TYPES:
type = temp_type
elif type not in Parameter.TYPES:
# Allowing type matching: string == String == STRING
for parameter_type in Parameter.TYPES:
if type.upper() == parameter_type.upper():
type = parameter_type
break
if type not in Parameter.TYPES:
raise ValueError(f"Unable to map type {type} to string literal")

if _wrapped is None:
return functools.partial(
Expand Down
Loading

0 comments on commit fdc3f88

Please sign in to comment.