Page MenuHomePhabricator

Spicerack service catalog throws a TypeError when looping through its entries
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • SSH to cumin1003 and open a Python shell as root
  • Create a new spicerack.service_catalog() and attempt to print its entries:
>>> from spicerack import Spicerack
>>> spicerack = Spicerack()
>>> catalog = spicerack.service_catalog()
>>> for service in catalog: print(service)

What happens?:
Error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/spicerack/service.py", line 575, in <genexpr>
    return (self.get(name) for name in self._catalog)
            ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/spicerack/service.py", line 630, in get
    return Service(**params)
           ^^^^^^^^^^^^^^^^^
TypeError: Service.__init__() got an unexpected keyword argument 'exclude_from_switchover'`

What should have happened instead?:

Printing all the entries of service catalog.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
Python3 and current version deployed on cumin1003 (I didn't install anything specific for this test).

However this happened after https://gerrit.wikimedia.org/r/c/operations/puppet/+/1217189 got merged, where the new exclude_from_switchover field got created.

Event Timeline

I think this is caused by a change in service_catalog schema which is not matched by a change in spicerack.

The new exclude_from_switchover field has been created in Puppet but not yet in Spicerack as explained in https://phabricator.wikimedia.org/T412211

Similar error happened yesterday and @Volans explanation at that time were similar.

If this assessment is correct, how can we prevent those dependent changes to break Spicerack:

  • Those fields are optional in Puppet, so can they be ignored by Spicerack if not present?
  • And/or should we have a test case or presubmit rule that avoids to merge one without the other?

The newest change in schema was reverted as explained in https://phabricator.wikimedia.org/T412211 , but there is still an issue with a previous schema change: TypeError: Service.__init__() got an unexpected keyword argument 'team'

@Volans @elukey do we know when the release should be done?

@MLechvien-WMF Hi! I just created a new spicerack release, it is just a matter of coordinating on the deploy (if you need to check the Service definition etc..). Should we coordinate on IRC?

To keep archives happy - new spicerack release deployed, the issue is fixed.