canonical / canonical/data-platform-libs

S3Requirer method to get s3 connection info assumes a limit of 1 relation

Open
#263 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
13
Forks
12
PR merge metrics
No merged PRs in 30d

Description

## Steps to reproduce

1. deploy s3 integrator with set of credentials 1
2. deploy s3 integrator with set of credentials 2
3. deploy s3 requirer charm that has no limit on the number of requires relations it can form over the `s3` interface
4. relate s3 integrator charms (both) with s3 requirer charm
5. shell into s3 requirer charm and call `s3_requires.get_s3_connection_info()` (https://github.com/canonical/s3-integrator/blob/main/lib/charms/data_platform_libs/v0/s3.py#L777-L783)
6. this will return credentials from only one of the relations (the first one it finds when it iterates over all relations over the same endpoint)

https://documentation.ubuntu.com/ops/latest/reference/ops/#ops.Model.relations shows that the `model.relations` array is key-ed by the relation endpoint

## Expected behavior
The method should return s3 connection from all upstream related s3-integrator charms

Furthermore, it would likely be a good idea to enable tagging of s3 connections (on the s3 integrator charm), and including this tag in the relation data + property to access tag S3Requires s3 connection info. This way, I can configure 2 s3 connections (1 for backups, 1 for logs) and be able to appropriately distinguish the two connections by their tags in the requirer charm

## Actual behavior

## Versions

Operating system: ubuntu 24.04

Juju CLI: 3.6

Juju agent: 3.6

## Log output

Juju debug log:

n/a

## Additional context

n/a

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.