Skip to content

Fix cluster_id length check in startup.py - #700

Open
MKoesters wants to merge 5 commits into
BiBiServ:masterfrom
MKoesters:patch-3
Open

Fix cluster_id length check in startup.py#700
MKoesters wants to merge 5 commits into
BiBiServ:masterfrom
MKoesters:patch-3

Conversation

@MKoesters

Copy link
Copy Markdown
Contributor

MAX_ID_LENGTH suggests a maximum length, not a static length. I adapted the condition accordingly

MAX_ID_LENGTH suggests a maximum length, not a static length.
I adapted the condition accordingly
@XaverStiensmeier

XaverStiensmeier commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Good catch. At the beginning I planned to set it only as a maximum. Later I thought that it might be wise to not allow shorter cluster ids to make it less likely to have two clusters with the same id. However, this is not a fix. A fix is to perform a bibigrid.core.utility.id_generation.is_unique_cluster_id check on the given cluster id to guarantee that the id is not in use before creation, which is much safer.

changing != to > also has to be done for rest_startup.

@MKoesters

Copy link
Copy Markdown
Contributor Author

Good catch. At the beginning I planned to set it only as a maximum. Later I thought that it might be wise to not allow shorter cluster ids to make it less likely to have two clusters with the same id. However, this is not a fix. A fix is to perform a bibigrid.core.utility.id_generation.is_unique_cluster_id check on the given cluster id to guarantee that the id is not in use before creation, which is much safer.

changing != to > also has to be done for rest_startup.

I'll have a look at this

@MKoesters
MKoesters marked this pull request as draft January 30, 2026 10:48
@MKoesters
MKoesters marked this pull request as ready for review July 23, 2026 08:12
@MKoesters

Copy link
Copy Markdown
Contributor Author

@XaverStiensmeier I finally added the missing code
Does this look good to you?

@XaverStiensmeier

XaverStiensmeier commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

I am on holidays starting tomorrow and will not have the time to thoroughly review it before.

Quick comment without actually testing it: Am I mistaken or is this preventing cluster termination, listing and update (so everything where cid is needed for a running cluster) as it now runs into

if not id_generation.is_unique_cluster_id(cluster_id, providers):
        msg = f"Cluster id ({cluster_id}) already exists"
        LOG.error(msg)
        raise RuntimeError(msg)

because the cluster to terminate of course already exists and the cid is checked independent of selected action. I might be mistaken as it is just my first thought without any testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants