Skip to content

client: Do not call AdminClient.create_topics with an empty topics list

It raises ValueError otherwise, spotted in docker environment.

docker-swh-counters-journal-client-1  | DEBUG:swh.journal.client:Creating topics: []
docker-swh-counters-journal-client-1  | Traceback (most recent call last):
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/bin/swh", line 8, in <module>
docker-swh-counters-journal-client-1  |     sys.exit(main())
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/core/cli/__init__.py", line 174, in main
docker-swh-counters-journal-client-1  |     return swh(auto_envvar_prefix="SWH")
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1157, in __call__
docker-swh-counters-journal-client-1  |     return self.main(*args, **kwargs)
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1078, in main
docker-swh-counters-journal-client-1  |     rv = self.invoke(ctx)
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1688, in invoke
docker-swh-counters-journal-client-1  |     return _process_result(sub_ctx.command.invoke(sub_ctx))
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1688, in invoke
docker-swh-counters-journal-client-1  |     return _process_result(sub_ctx.command.invoke(sub_ctx))
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 1434, in invoke
docker-swh-counters-journal-client-1  |     return ctx.invoke(self.callback, **ctx.params)
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/core.py", line 783, in invoke
docker-swh-counters-journal-client-1  |     return __callback(*args, **kwargs)
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/click/decorators.py", line 33, in new_func
docker-swh-counters-journal-client-1  |     return f(get_current_context(), *args, **kwargs)
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/counters/cli.py", line 78, in journal_client
docker-swh-counters-journal-client-1  |     client = KeyOrientedJournalClient(**journal_cfg)
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/journal/client.py", line 305, in __init__
docker-swh-counters-journal-client-1  |     for topic in admin_client.create_topics(topic_list).values():
docker-swh-counters-journal-client-1  |   File "/srv/softwareheritage/venv/lib/python3.7/site-packages/confluent_kafka/admin/__init__.py", line 482, in create_topics
docker-swh-counters-journal-client-1  |     super(AdminClient, self).create_topics(new_topics, f, **kwargs)
docker-swh-counters-journal-client-1  | ValueError: Expected non-empty list of NewTopic objects

Merge request reports