#740 Fix missing yaml entry, fedbages complain:
Merged 2 years ago by jflory7. Opened 2 years ago by misc.
misc/fedora-badges fix_badge  into  master

@@ -15,3 +15,6 @@ 

  

  # That's us!

  issuer_id:      fedora-project

+ 

+ trigger:

+ criteria:

Initializing rule for '/usr/share/badges/rules/release-party-f31-organizer.yml' failed with
ValueError("BadgeRule requires frozenset(['name', 'creator', 'discussion', 'issuer_id', 'trigger', 'image_url',
'criteria', 'description']). Missing frozenset(['trigger', 'criteria'])",)

Metadata Update from @jflory7:
- Request assigned

2 years ago

Metadata Update from @jflory7:
- Pull-request tagged with: bug

2 years ago

Oops. This one is on me. Good to know for future reference though.

Pull-Request has been merged by jflory7

2 years ago

Seems my fix is not enough, as it is also crashing differently:

Traceback (most recent call last):
 File "/usr/lib/python2.7/site-packages/moksha/hub/hub.py", line 410, in __init_consumers
 c = c_class(self)
 File "/usr/lib/python2.7/site-packages/fedbadges/consumers.py", line 68, in __init__
self.badge_rules = self._load_badges_from_yaml(directory)
 File "/usr/lib/python2.7/site-packages/fedbadges/consumers.py", line 119, in _load_badges_from_yaml
badge, self.l.tahrir, self.issuer_id)
File "/usr/lib/python2.7/site-packages/fedbadges/rules.py", line 143, in __init__
self.trigger = Trigger(self._d['trigger'], self)
File "/usr/lib/python2.7/site-packages/fedbadges/rules.py", line 310, in __init__
super(AbstractTopLevelComparator, self).__init__(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/fedbadges/rules.py", line 280, in __init__
argued_fields = frozenset(d.keys())
AttributeError: 'NoneType' object has no attribute 'keys'

Nirik removed the badge and I will see what should be the right syntax

So, it seems that we need either 'topic' or 'category' in the current code. Of course, in a ideal world, it should just skip that, but in the mean time, I think fixing the yaml is the right choice.

ok, so the correct patch should have been:

trigger:
  topic: