python-tripleoclient/tripleoclient/tests/fixture_data/deployment.py
Jiri Stransky 479a530656 Always run upgrades/updates as tripleo-admin
This change has two main parts:

* Ensure that when we ssh *via Mistral*, we always use
  tripleo-admin. `--ssh-user` argument to any update/upgrade run
  commands is now deprecated. The reason i didn't remove it completely
  is that how current upgrade commands use ssh needed some mental
  untangling, and i want us to keep an easy way back in case my
  understanding is wrong here. Deprecation seems safer than outright
  removal.

* On upgrade prepare and FFWD prepare, make sure that the
  tripleo-admin user is created and authorized.

  Note that for tripleo-admin creation and authorization, the
  `--overcloud-ssh-user` parameter is used, and that one still
  defaults to `heat-admin`, which is correct. So initially we connect
  via whatever credentials user provided (which works on Nova+Ironic
  envs unless user customized it), and from that point on we always
  use tripleo-admin, which is common for all environments regardless
  of any user customizations. This is how deployment already works
  now, and after this change upgrades will work that way too.

Change-Id: Ib1a75a0a3f3b2a3bec00d8820c3a097620fa6256
Closes-Bug: #1801066
2018-11-01 15:16:47 +01:00

80 lines
2.9 KiB
Python

# Copyright 2018 Red Hat, Inc.
#
# 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.
#
import fixtures
class DeploymentWorkflowFixture(fixtures.Fixture):
def _setUp(self):
super(DeploymentWorkflowFixture, self)._setUp()
self.mock_get_hosts_and_enable_ssh_admin = self.useFixture(
fixtures.MockPatch('tripleoclient.workflows.deployment.'
'get_hosts_and_enable_ssh_admin')
).mock
self.mock_config_download = self.useFixture(fixtures.MockPatch(
'tripleoclient.workflows.deployment.config_download')
).mock
self.mock_get_horizon_url = self.useFixture(fixtures.MockPatch(
'tripleoclient.workflows.deployment.get_horizon_url')
).mock
self.mock_set_deployment_status = self.useFixture(fixtures.MockPatch(
'tripleoclient.workflows.deployment.set_deployment_status')
).mock
class PlanManagementFixture(fixtures.Fixture):
def _setUp(self):
super(PlanManagementFixture, self)._setUp()
self.mock_tarball = self.useFixture(fixtures.MockPatch(
'tripleoclient.workflows.plan_management.tarball')
).mock
self.mock_list_plans = self.useFixture(fixtures.MockPatch(
'tripleoclient.workflows.plan_management.list_deployment_plans',
return_value=[])
).mock
class UtilsOvercloudFixture(fixtures.Fixture):
def _setUp(self):
super(UtilsOvercloudFixture, self)._setUp()
self.mock_deploy_tht = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.create_tempest_deployer_input')
).mock
self.mock_utils_endpoint = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.get_overcloud_endpoint')
).mock
self.mock_create_ocrc = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.write_overcloudrc')
).mock
class UtilsFixture(fixtures.Fixture):
def _setUp(self):
super(UtilsFixture, self)._setUp()
self.wait_for_stack_ready_mock = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.wait_for_stack_ready',
return_value=True)
).mock
self.mock_remove_known_hosts = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.remove_known_hosts')
).mock
self.mock_write_overcloudrc = self.useFixture(fixtures.MockPatch(
'tripleoclient.utils.write_overcloudrc')
).mock