confluentinc / confluentinc/examples
ccloud_lib.py throws error if there is a new line in the librdkafka.config file
- Dominant language
- Java
- Stars
- 2.1k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/confluentinc/examples/tree/5.5.0-post/clients/cloud/python
As per the docs, the config file should look like:
```
# Kafka
bootstrap.servers={{ BROKER_ENDPOINT }}
security.protocol=SASL_SSL
sasl.mechanisms=PLAIN
sasl.username={{ CLUSTER_API_KEY }}
sasl.password={{ CLUSTER_API_SECRET }}
# Confluent Cloud Schema Registry
schema.registry.url=https://{{ SR_ENDPOINT }}
basic.auth.credentials.source=USER_INFO
schema.registry.basic.auth.user.info={{ SR_API_KEY }}:{{ SR_API_SECRET }}
```
During runtime, ccloud_lib throws:
```
Traceback (most recent call last):
File "./consumer_ccsr.py", line 39, in
conf = ccloud_lib.read_ccloud_config(config_file)
File "/Users/jtsmith/confluent/examples/clients/cloud/python/ccloud_lib.py", line 130, in read_ccloud_config
if line[0] != "#" and len(line) != 0:
IndexError: string index out of range
```
Upon removing the newline between `sasl.password...` and `# Confluent Cloud...` it works as expected.
It might be easier to update https://github.com/confluentinc/configuration-templates/blob/master/clients/cloud/librdkafka-sr.config than the code, but that's just my opinion! Leaving it up to the experts to decide.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.