Skip to content

Store swift token in the Moodle Universal Cache#734

Merged
danmarsden merged 2 commits into
MOODLE_404_STABLEfrom
openstack_muc_token_cache
Apr 6, 2026
Merged

Store swift token in the Moodle Universal Cache#734
danmarsden merged 2 commits into
MOODLE_404_STABLEfrom
openstack_muc_token_cache

Conversation

@catalystfd
Copy link
Copy Markdown
Contributor

@catalystfd catalystfd commented Apr 2, 2026

Presently tool_objectfs authenticates to openstack, then caches the resulting authtoken in the database (mdl_config_plugins / tool_objectfs / openstack_authtoken) until it expires.

This is undesirable from two angles:

  1. When particulars change (eg destination project/tenant) in config.php the plugin continues using the existing token/details, acting on the wrong location (eg uploading files to the wrong location)

  2. This cached token is available in database dumps, and when restored to non-prod environments, continuing to persist even if all MUC caches are purged on all web/cron servers.

This change moves the token to the Moodle Universal Cache, with a localstoreallowed definition, this means a purge of caches will remove the token.

I chose local store allowed as there's no reason to not allow each cluster server to acquire it's own token to openstack as you can have more than one token and the load from requesting tokens per node in the cluster is unlikely to be onerous (and you can store it in your fastest available cache)

Presently tool_objectfs authenticates to openstack, then caches the
resulting authtoken in the database (mdl_config_plugins / tool_objectfs
/ openstack_authtoken) until it expires.

This is undesirable from two angles:
1. When particulars change (eg destination project/tenant) in config.php
the plugin continues using the existing token/details, acting on the
wrong location (eg uploading files to the wrong location)

2. This cached token is available in database dumps, and when restored
to non-prod environments, continuing to persist even if all MUC caches
are purged on all web/cron servers.

This change moves the token to the Moodle Universal Cache, with a
localstoreallowed definition, this means a purge of caches will remove
the token.

I chose local store allowed as there's no reason to not allow each
cluster server to acquire it's own token to openstack as you can have
more than one token and the load from requesting tokens per node in the
cluster is unlikely to be onerous
@catalystfd catalystfd force-pushed the openstack_muc_token_cache branch from 12c0785 to 2299d86 Compare April 2, 2026 02:05
@catalystfd catalystfd requested a review from danmarsden April 2, 2026 04:41
@danmarsden danmarsden merged commit 7706b52 into MOODLE_404_STABLE Apr 6, 2026
32 checks passed
@danmarsden danmarsden deleted the openstack_muc_token_cache branch April 6, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants