charm-keystone/hooks/keystone_types.py
Frode Nordahl 0a02c30fe5
Replace use of admin_token with Keystone bootstrap
Stop the use of the admin_token and use the bootstrap process
to initialize Keystone instead.  Fortunately the implementation
of the bootstrap process is both idempotent when it needs to be
and it can be safely called on an existing deployment.

Subsequently we can migrate by just removing the admin_token
from the configuration and create new credentials for use by
the charm with a call to ``keystone-manage bootstrap``.

Remove configuration templates for versions prior to Mitaka, by
doing this we need to move any configuration initially defined
prior to Miataka forward to the ``templates/mitaka`` folder.

A side effect of this migration is that newly bootstrapped
deployments will get their ``default`` domain created with a
literal ID of ``default``.  Prior to this change third party
software making assumptions about that being the case may have
had issues.

Closes-Bug: #1859844
Closes-Bug: #1837113
Related-Bug: #1774733
Closes-Bug: #1648719
Closes-Bug: #1578678
Func-Test-Pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/191
Change-Id: I23940720c24527ee34149f035c3bdf9ff54812c9
2020-03-13 09:52:10 +01:00

41 lines
1.5 KiB
Python

#!/usr/bin/env python2
# Copyright 2020 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE(fnordahl): This file needs to remain Python2 as it is used both by the
# charm code which is Python3 and the special ``manager.py`` script that is in
# place to support both Python2 and Python3 systems with the same codebase.
#
# The need for jumping through these hoops come from classic charms being
# deployed without any form of Python environment with direct dependencies.
# Subsequently we live at the grace of whatever dependencies our payload has
# in the running system. This may change underneath us as we upgrade between
# UCA pockets and across series.
import collections
CharmCredentials = collections.namedtuple(
'CharmCredentials',
(
'username',
'password',
'system_scope',
'project_name', # For V2 and pre system scope compatibility
'project_domain_name', # For Mitaka -> Pike (pre system scope)
'user_domain_name', # For Mitaka -> Pike (pre system scope)
),
)