Skip to content

Commit

Permalink
Fix for ruamel interactions with awxkit objects
Browse files Browse the repository at this point in the history
Cole encountered an issue where inventory syncs were failing because
ruamel wasn't able to handle awxkit's Psuedonamespace objects. This
simply adds a new representer for them, fixing the issue.
  • Loading branch information
JacobCallahan committed Nov 26, 2024
1 parent 5af7b3f commit 969f974
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion broker/providers/ansible_tower.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from logzero import logger

from broker import exceptions
from broker.helpers import eval_filter, find_origin
from broker.helpers import eval_filter, find_origin, yaml
from broker.settings import settings

try:
Expand All @@ -21,6 +21,12 @@
from broker import helpers
from broker.providers import Provider

# ruamel has a hard time with PseudoNamespace objects
yaml.representer.add_representer(
awxkit.utils.PseudoNamespace,
lambda dumper, data: dumper.represent_dict(dict(data)),
)


def convert_pseudonamespaces(attr_dict):
"""Recursively convert PsuedoNamespace objects into dictionaries."""
Expand Down

0 comments on commit 969f974

Please sign in to comment.