nova/nova/tests/unit/fake_console_auth_token.py
melanie witt fc38e95784 Add access_url_base to console_auth_tokens table
Unfortunately this column was missed off when console_auth_tokens
was added to the database. This change adds it in.

The access_url is needed for a protocol check in the console proxies.
Console proxies run per cell and do not run on compute hosts and thus
do not have access to the access_url config options in the compute
hosts nova.conf files.

So, we need to store part of the access_url in the database. We cannot
store the entire access_url because it contains the unhashed token, but
we can keep the base part of the url and generate the full access_url
on demand. An access url base looks something like this:

  http://127.0.0.1:6080/vnc_auto.html

and using it, we can generate the full access_url on demand for the
protocol check in the console proxies.

partially-implements: blueprint convert-consoles-to-objects

Change-Id: I0f672f5667d42b67d869ff9f467dbb64eb6c9ff9
2018-01-06 02:02:26 +00:00

35 lines
1.2 KiB
Python

# Copyright 2016 Intel Corp.
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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.
from nova.tests import uuidsentinel
from nova import utils
fake_token = uuidsentinel.token
fake_token_hash = utils.get_sha256_str(fake_token)
fake_instance_uuid = uuidsentinel.instance
fake_token_dict = {
'created_at': None,
'updated_at': None,
'id': 123,
'token_hash': fake_token_hash,
'console_type': 'fake-type',
'host': 'fake-host',
'port': 1000,
'internal_access_path': 'fake-path',
'instance_uuid': fake_instance_uuid,
'expires': 100,
'access_url_base': 'http://fake.url.fake/root.html'
}