Page MenuHomePhabricator

Keystone generates random ids for new projects, should use the name
Closed, ResolvedPublic

Description

We have some custom hooks and monkey-patching to force keystone to override the
project ids and use the same as the project name, that seems to have stopped
working on the last upgrade:

See ./modules/openstack/files/stein/keystone/wmfkeystonehooks/wmfkeystonehooks.py

This blocks creating any new projects (and probably will break a number of
other tools relying on that).

Event Timeline

dcaro triaged this task as High priority.

Depending on which is faster, it may be worth it to fix our scripts to use the project name or ID as appropriate instead of fixing a monkeypatch. Since project creation is currently broken, and exisitng projects have id==name already, it's a situation where it would be difficult to break everything by trying to remove the dependency on keeping id==name. Changes would probably have little impact on the existing projects, but new projects are already broken, so we cannot break them much worse than they are.

On a quick check of the code in puppet, I don't think that is trivial because there is widespread confusion between names/ids in scripts. I really don't know which is worse yet. Hacks based on our system being very old just seem good to strip out where we can.

I just realized that I didn't find that log warning because "monkey" is misspelled. 😐

I just realized that I didn't find that log warning because "monkey" is misspelled. 😐

No, actually, I'm not sure the patched version ran at all. The hooks run, but the patched version of post doesn't seem to have (or didn't log to logstash).

via some extra log lines I've determined that the monkeypatch is applied immediately after the function in need of patching is invoked :(

dammit

andrew@buster:~/puppet/modules/openstack$ head files/rocky/keystone/keystone-wsgi-admin.py
#! /usr/bin/python3
# PBR Generated from 'wsgi_scripts'

import threading

# This import is so our custom monkeypatch(es)
#  get loaded before anything else.  The rest
#  of this file is the same as the packaged
#  upstream usgi script.
import wmfkeystonehooks.wmfkeystonehooks  # noqa: F401

Change 662800 had a related patch set uploaded (by Andrew Bogott; owner: Andrew Bogott):
[operations/puppet@production] Keystone: a new (but still terrible) approach to making projectid==projectname

https://gerrit.wikimedia.org/r/662800

Change 662800 merged by Andrew Bogott:
[operations/puppet@production] Keystone: a new (but still terrible) approach to making projectid==projectname

https://gerrit.wikimedia.org/r/662800

This is resolved; the goal of removing the hack is https://phabricator.wikimedia.org/T274268