Drop six
Since we're python3 only, we don't need six anymore.
Change-Id: I82c35f364315129a41dd5cbea64c0c5a50662026
(cherry picked from commit 4d511679e8
)
This commit is contained in:
parent
0021766610
commit
3956b20a97
@ -11,7 +11,6 @@ python-ironicclient!=2.5.2,!=2.7.1,!=3.0.0,>=2.3.0 # Apache-2.0
|
|||||||
python-mistralclient!=3.2.0,>=3.1.0 # Apache-2.0
|
python-mistralclient!=3.2.0,>=3.1.0 # Apache-2.0
|
||||||
python-openstackclient>=5.2.0 # Apache-2.0
|
python-openstackclient>=5.2.0 # Apache-2.0
|
||||||
simplejson>=3.5.1 # MIT
|
simplejson>=3.5.1 # MIT
|
||||||
six>=1.10.0 # MIT
|
|
||||||
osc-lib>=2.3.0 # Apache-2.0
|
osc-lib>=2.3.0 # Apache-2.0
|
||||||
tripleo-common>=15.2.0 # Apache-2.0
|
tripleo-common>=15.2.0 # Apache-2.0
|
||||||
cryptography>=2.1 # BSD/Apache-2.0
|
cryptography>=2.1 # BSD/Apache-2.0
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import configparser
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
from six.moves import configparser
|
|
||||||
from tripleo_common.image import kolla_builder
|
from tripleo_common.image import kolla_builder
|
||||||
|
|
||||||
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
||||||
|
@ -137,7 +137,7 @@ class TestExport(TestCase):
|
|||||||
mock_get_stack.return_value = self.mock_stack
|
mock_get_stack.return_value = self.mock_stack
|
||||||
self.mock_open = mock.mock_open(
|
self.mock_open = mock.mock_open(
|
||||||
read_data='{"an_key":"an_value","ovn_dbs_vip":"vip"}')
|
read_data='{"an_key":"an_value","ovn_dbs_vip":"vip"}')
|
||||||
with mock.patch('six.moves.builtins.open', self.mock_open):
|
with mock.patch('builtins.open', self.mock_open):
|
||||||
data = export.export_stack(heat, "overcloud", should_filter=True)
|
data = export.export_stack(heat, "overcloud", should_filter=True)
|
||||||
|
|
||||||
expected = \
|
expected = \
|
||||||
@ -229,7 +229,7 @@ class TestExport(TestCase):
|
|||||||
self.assertEqual(mock_passwords, data)
|
self.assertEqual(mock_passwords, data)
|
||||||
|
|
||||||
def test_export_ceph_net_key(self):
|
def test_export_ceph_net_key(self):
|
||||||
with mock.patch('six.moves.builtins.open', self.mock_open_ceph_global):
|
with mock.patch('builtins.open', self.mock_open_ceph_global):
|
||||||
mon_key = export.export_ceph_net_key('dcn0',
|
mon_key = export.export_ceph_net_key('dcn0',
|
||||||
config_download_dir='/foo')
|
config_download_dir='/foo')
|
||||||
self.assertEqual(mon_key, 'storage_ip')
|
self.assertEqual(mon_key, 'storage_ip')
|
||||||
@ -237,7 +237,7 @@ class TestExport(TestCase):
|
|||||||
'/foo/dcn0/global_vars.yaml', 'r')
|
'/foo/dcn0/global_vars.yaml', 'r')
|
||||||
|
|
||||||
def test_export_storage_ips(self):
|
def test_export_storage_ips(self):
|
||||||
with mock.patch('six.moves.builtins.open', self.mock_open_ceph_inv):
|
with mock.patch('builtins.open', self.mock_open_ceph_inv):
|
||||||
storage_ips = export.export_storage_ips('dcn0',
|
storage_ips = export.export_storage_ips('dcn0',
|
||||||
config_download_dir='/foo',
|
config_download_dir='/foo',
|
||||||
ceph_net_key='foo_ip')
|
ceph_net_key='foo_ip')
|
||||||
@ -260,7 +260,7 @@ class TestExport(TestCase):
|
|||||||
'fsid': 'a5a22d37-e01f-4fa0-a440-c72585c7487f',
|
'fsid': 'a5a22d37-e01f-4fa0-a440-c72585c7487f',
|
||||||
'dashboard_enabled': False
|
'dashboard_enabled': False
|
||||||
}
|
}
|
||||||
with mock.patch('six.moves.builtins.open', self.mock_open_ceph_all):
|
with mock.patch('builtins.open', self.mock_open_ceph_all):
|
||||||
data = export.export_ceph('dcn0', 'openstack',
|
data = export.export_ceph('dcn0', 'openstack',
|
||||||
config_download_dir='/foo',
|
config_download_dir='/foo',
|
||||||
mon_ips=['192.168.24.42'])
|
mon_ips=['192.168.24.42'])
|
||||||
|
@ -197,7 +197,7 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
mock_untar.side_effect = untar
|
mock_untar.side_effect = untar
|
||||||
|
|
||||||
mock_open = mock.mock_open()
|
mock_open = mock.mock_open()
|
||||||
with mock.patch('six.moves.builtins.open', mock_open):
|
with mock.patch('builtins.open', mock_open):
|
||||||
# pylint: disable=bad-str-strip-call
|
# pylint: disable=bad-str-strip-call
|
||||||
launcher.do_restore_db()
|
launcher.do_restore_db()
|
||||||
self.assertEqual(mock.call(str(three), launcher.heat_dir),
|
self.assertEqual(mock.call(str(three), launcher.heat_dir),
|
||||||
@ -211,7 +211,7 @@ class TestHeatPodLauncher(base.TestCase):
|
|||||||
self.run.reset_mock()
|
self.run.reset_mock()
|
||||||
two.touch()
|
two.touch()
|
||||||
mock_open = mock.mock_open()
|
mock_open = mock.mock_open()
|
||||||
with mock.patch('six.moves.builtins.open', mock_open):
|
with mock.patch('builtins.open', mock_open):
|
||||||
# pylint: disable=bad-str-strip-call
|
# pylint: disable=bad-str-strip-call
|
||||||
launcher.do_restore_db()
|
launcher.do_restore_db()
|
||||||
self.assertEqual(mock.call(str(two), launcher.heat_dir),
|
self.assertEqual(mock.call(str(two), launcher.heat_dir),
|
||||||
|
@ -44,8 +44,8 @@ from tripleoclient import utils
|
|||||||
from tripleoclient.tests import base
|
from tripleoclient.tests import base
|
||||||
from tripleoclient.tests import fakes
|
from tripleoclient.tests import fakes
|
||||||
|
|
||||||
from six.moves.configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from six.moves.urllib import error as url_error
|
from urllib import error as url_error
|
||||||
|
|
||||||
from ansible_runner import Runner
|
from ansible_runner import Runner
|
||||||
|
|
||||||
@ -212,10 +212,12 @@ class TestRunAnsiblePlaybook(TestCase):
|
|||||||
extra_vars=arglist
|
extra_vars=arglist
|
||||||
)
|
)
|
||||||
|
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('os.chmod')
|
||||||
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tripleoclient.utils.makedirs')
|
@mock.patch('tripleoclient.utils.makedirs')
|
||||||
@mock.patch('os.path.exists', side_effect=(False, True, True))
|
@mock.patch('os.path.exists', side_effect=(False, True, True))
|
||||||
def test_run_with_timeout(self, mock_exists, mock_mkdir, mock_open):
|
def test_run_with_timeout(self, mock_exists, mock_mkdir, mock_open,
|
||||||
|
mock_chmod):
|
||||||
ansible_runner.ArtifactLoader = mock.MagicMock()
|
ansible_runner.ArtifactLoader = mock.MagicMock()
|
||||||
ansible_runner.Runner.run = mock.MagicMock(return_value=('', 0))
|
ansible_runner.Runner.run = mock.MagicMock(return_value=('', 0))
|
||||||
ansible_runner.runner_config = mock.MagicMock()
|
ansible_runner.runner_config = mock.MagicMock()
|
||||||
@ -233,7 +235,7 @@ class TestRunAnsiblePlaybook(TestCase):
|
|||||||
mock_open.mock_calls)
|
mock_open.mock_calls)
|
||||||
|
|
||||||
@mock.patch('os.chmod')
|
@mock.patch('os.chmod')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tripleoclient.utils.makedirs')
|
@mock.patch('tripleoclient.utils.makedirs')
|
||||||
@mock.patch('os.path.exists', side_effect=(False, True, True))
|
@mock.patch('os.path.exists', side_effect=(False, True, True))
|
||||||
def test_run_with_extravar_file(self, mock_exists, mock_mkdir, mock_open,
|
def test_run_with_extravar_file(self, mock_exists, mock_mkdir, mock_open,
|
||||||
@ -1495,7 +1497,7 @@ class TestStoreCliParam(TestCase):
|
|||||||
self.a = 1
|
self.a = 1
|
||||||
|
|
||||||
dt = datetime.datetime(2017, 11, 22)
|
dt = datetime.datetime(2017, 11, 22)
|
||||||
with mock.patch("six.moves.builtins.open", mock_file):
|
with mock.patch("builtins.open", mock_file):
|
||||||
with mock.patch('tripleoclient.utils.datetime') as mock_date:
|
with mock.patch('tripleoclient.utils.datetime') as mock_date:
|
||||||
mock_date.datetime.now.return_value = dt
|
mock_date.datetime.now.return_value = dt
|
||||||
utils.store_cli_param("overcloud plan list", ArgsFake())
|
utils.store_cli_param("overcloud plan list", ArgsFake())
|
||||||
@ -1506,7 +1508,7 @@ class TestStoreCliParam(TestCase):
|
|||||||
]
|
]
|
||||||
mock_file.assert_has_calls(expected_call, any_order=True)
|
mock_file.assert_has_calls(expected_call, any_order=True)
|
||||||
|
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('os.path.isdir')
|
@mock.patch('os.path.isdir')
|
||||||
@mock.patch('os.path.exists')
|
@mock.patch('os.path.exists')
|
||||||
def test_fail_to_write_data(self, mock_exists, mock_isdir, mock_open):
|
def test_fail_to_write_data(self, mock_exists, mock_isdir, mock_open):
|
||||||
@ -1576,7 +1578,7 @@ class ProcessMultipleEnvironments(TestCase):
|
|||||||
'parse', autospec=True, return_value=dict())
|
'parse', autospec=True, return_value=dict())
|
||||||
@mock.patch('yaml.safe_dump', autospec=True)
|
@mock.patch('yaml.safe_dump', autospec=True)
|
||||||
@mock.patch('yaml.safe_load', autospec=True)
|
@mock.patch('yaml.safe_load', autospec=True)
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tempfile.NamedTemporaryFile', autospec=True)
|
@mock.patch('tempfile.NamedTemporaryFile', autospec=True)
|
||||||
def test_rewrite_env_files(self,
|
def test_rewrite_env_files(self,
|
||||||
mock_temp, mock_open,
|
mock_temp, mock_open,
|
||||||
@ -1819,13 +1821,13 @@ class TestDeploymentPythonInterpreter(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class TestWaitApiPortReady(TestCase):
|
class TestWaitApiPortReady(TestCase):
|
||||||
@mock.patch('six.moves.urllib.request.urlopen')
|
@mock.patch('urllib.request.urlopen')
|
||||||
def test_success(self, urlopen_mock):
|
def test_success(self, urlopen_mock):
|
||||||
has_errors = utils.wait_api_port_ready(8080)
|
has_errors = utils.wait_api_port_ready(8080)
|
||||||
self.assertFalse(has_errors)
|
self.assertFalse(has_errors)
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
'six.moves.urllib.request.urlopen',
|
'urllib.request.urlopen',
|
||||||
side_effect=[
|
side_effect=[
|
||||||
url_error.HTTPError("", 201, None, None, None), socket.timeout,
|
url_error.HTTPError("", 201, None, None, None), socket.timeout,
|
||||||
url_error.URLError("")
|
url_error.URLError("")
|
||||||
@ -1838,7 +1840,7 @@ class TestWaitApiPortReady(TestCase):
|
|||||||
self.assertEqual(sleep_mock.call_count, 30)
|
self.assertEqual(sleep_mock.call_count, 30)
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
'six.moves.urllib.request.urlopen',
|
'urllib.request.urlopen',
|
||||||
side_effect=[
|
side_effect=[
|
||||||
socket.timeout,
|
socket.timeout,
|
||||||
url_error.URLError(""),
|
url_error.URLError(""),
|
||||||
@ -1851,7 +1853,7 @@ class TestWaitApiPortReady(TestCase):
|
|||||||
self.assertEqual(sleep_mock.call_count, 4)
|
self.assertEqual(sleep_mock.call_count, 4)
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
'six.moves.urllib.request.urlopen',
|
'urllib.request.urlopen',
|
||||||
side_effect=[
|
side_effect=[
|
||||||
socket.timeout,
|
socket.timeout,
|
||||||
url_error.URLError(""),
|
url_error.URLError(""),
|
||||||
@ -1864,7 +1866,7 @@ class TestWaitApiPortReady(TestCase):
|
|||||||
self.assertEqual(urlopen_mock.call_count, 3)
|
self.assertEqual(urlopen_mock.call_count, 3)
|
||||||
self.assertEqual(sleep_mock.call_count, 3)
|
self.assertEqual(sleep_mock.call_count, 3)
|
||||||
|
|
||||||
@mock.patch('six.moves.urllib.request.urlopen', side_effect=NameError)
|
@mock.patch('urllib.request.urlopen', side_effect=NameError)
|
||||||
@mock.patch('time.sleep')
|
@mock.patch('time.sleep')
|
||||||
def test_dont_retry_at_unknown_exception(self, urlopen_mock, sleep_mock):
|
def test_dont_retry_at_unknown_exception(self, urlopen_mock, sleep_mock):
|
||||||
with self.assertRaises(NameError):
|
with self.assertRaises(NameError):
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
|
from io import StringIO
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import six
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
|
|
||||||
def _custom_create_params_env(parameters, tht_root,
|
def _custom_create_params_env(parameters, tht_root,
|
||||||
stack):
|
stack):
|
||||||
for key, value in six.iteritems(parameters):
|
for key, value in parameters.items():
|
||||||
self.assertEqual(value, expected_parameters[key])
|
self.assertEqual(value, expected_parameters[key])
|
||||||
parameter_defaults = {"parameter_defaults": parameters}
|
parameter_defaults = {"parameter_defaults": parameters}
|
||||||
return parameter_defaults
|
return parameter_defaults
|
||||||
@ -350,7 +350,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
'CtlplaneNetworkAttributes': {}}}
|
'CtlplaneNetworkAttributes': {}}}
|
||||||
mock_process_env.return_value = {}, parameters_env
|
mock_process_env.return_value = {}, parameters_env
|
||||||
mock_open_context = mock.mock_open()
|
mock_open_context = mock.mock_open()
|
||||||
with mock.patch('six.moves.builtins.open', mock_open_context):
|
with mock.patch('builtins.open', mock_open_context):
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
self.assertTrue(orchestration_client.stacks.create.called)
|
self.assertTrue(orchestration_client.stacks.create.called)
|
||||||
@ -1028,7 +1028,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
|
|
||||||
def _custom_create_params_env(parameters, tht_root,
|
def _custom_create_params_env(parameters, tht_root,
|
||||||
stack):
|
stack):
|
||||||
for key, value in six.iteritems(parameters):
|
for key, value in parameters.items():
|
||||||
self.assertEqual(value, expected_parameters[key])
|
self.assertEqual(value, expected_parameters[key])
|
||||||
parameter_defaults = {"parameter_defaults": parameters}
|
parameter_defaults = {"parameter_defaults": parameters}
|
||||||
return parameter_defaults
|
return parameter_defaults
|
||||||
@ -1777,7 +1777,7 @@ class TestGetDeploymentStatus(utils.TestCommand):
|
|||||||
@mock.patch("tripleoclient.workflows.deployment.get_deployment_status")
|
@mock.patch("tripleoclient.workflows.deployment.get_deployment_status")
|
||||||
def test_get_deployment_status(self, mock_get_deployment_status):
|
def test_get_deployment_status(self, mock_get_deployment_status):
|
||||||
parsed_args = self.check_parser(self.cmd, [], [])
|
parsed_args = self.check_parser(self.cmd, [], [])
|
||||||
self.cmd.app.stdout = six.StringIO()
|
self.cmd.app.stdout = StringIO()
|
||||||
status = 'DEPLOY_SUCCESS'
|
status = 'DEPLOY_SUCCESS'
|
||||||
mock_get_deployment_status.return_value = status
|
mock_get_deployment_status.return_value = status
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class TestOvercloudExternalUpdateRun(fakes.TestOvercloudExternalUpdateRun):
|
|||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('os.path.expanduser')
|
@mock.patch('os.path.expanduser')
|
||||||
@mock.patch('oslo_concurrency.processutils.execute')
|
@mock.patch('oslo_concurrency.processutils.execute')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
def test_update_with_user_and_tags(self, mock_open, mock_execute,
|
def test_update_with_user_and_tags(self, mock_open, mock_execute,
|
||||||
mock_expanduser, update_ansible,
|
mock_expanduser, update_ansible,
|
||||||
mock_run, mock_run_prepare):
|
mock_run, mock_run_prepare):
|
||||||
@ -77,7 +77,7 @@ class TestOvercloudExternalUpdateRun(fakes.TestOvercloudExternalUpdateRun):
|
|||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('os.path.expanduser')
|
@mock.patch('os.path.expanduser')
|
||||||
@mock.patch('oslo_concurrency.processutils.execute')
|
@mock.patch('oslo_concurrency.processutils.execute')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
def test_update_with_user_and_extra_vars(self, mock_open, mock_execute,
|
def test_update_with_user_and_extra_vars(self, mock_open, mock_execute,
|
||||||
mock_expanduser, update_ansible,
|
mock_expanduser, update_ansible,
|
||||||
mock_run, mock_run_prepare):
|
mock_run, mock_run_prepare):
|
||||||
|
@ -48,7 +48,7 @@ class TestOvercloudExternalUpgradeRun(fakes.TestOvercloudExternalUpgradeRun):
|
|||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('os.path.expanduser')
|
@mock.patch('os.path.expanduser')
|
||||||
@mock.patch('oslo_concurrency.processutils.execute')
|
@mock.patch('oslo_concurrency.processutils.execute')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
def test_upgrade_with_user_and_tags(self, mock_open, mock_execute,
|
def test_upgrade_with_user_and_tags(self, mock_open, mock_execute,
|
||||||
mock_expanduser, update_ansible,
|
mock_expanduser, update_ansible,
|
||||||
mock_run, mock_run_prepare):
|
mock_run, mock_run_prepare):
|
||||||
@ -75,7 +75,7 @@ class TestOvercloudExternalUpgradeRun(fakes.TestOvercloudExternalUpgradeRun):
|
|||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('os.path.expanduser')
|
@mock.patch('os.path.expanduser')
|
||||||
@mock.patch('oslo_concurrency.processutils.execute')
|
@mock.patch('oslo_concurrency.processutils.execute')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
def test_upgrade_with_user_and_extra_vars(self, mock_open, mock_execute,
|
def test_upgrade_with_user_and_extra_vars(self, mock_open, mock_execute,
|
||||||
mock_expanduser, update_ansible,
|
mock_expanduser, update_ansible,
|
||||||
mock_run, mock_run_prepare):
|
mock_run, mock_run_prepare):
|
||||||
|
@ -527,7 +527,7 @@ class TestImportNodeMultiArch(fakes.TestOvercloudNode):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
mock_open = mock.mock_open(read_data=json.dumps(file_return_nodes))
|
mock_open = mock.mock_open(read_data=json.dumps(file_return_nodes))
|
||||||
with mock.patch('six.moves.builtins.open', mock_open):
|
with mock.patch('builtins.open', mock_open):
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
nodes_list = copy.deepcopy(self.nodes_list)
|
nodes_list = copy.deepcopy(self.nodes_list)
|
||||||
|
@ -39,7 +39,7 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
|
|||||||
@mock.patch('tripleoclient.utils.ensure_run_as_normal_user')
|
@mock.patch('tripleoclient.utils.ensure_run_as_normal_user')
|
||||||
@mock.patch('tripleoclient.utils.prompt_user_for_confirmation',
|
@mock.patch('tripleoclient.utils.prompt_user_for_confirmation',
|
||||||
return_value=True)
|
return_value=True)
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('os.path.abspath')
|
@mock.patch('os.path.abspath')
|
||||||
@mock.patch('yaml.safe_load')
|
@mock.patch('yaml.safe_load')
|
||||||
@mock.patch('shutil.copytree', autospec=True)
|
@mock.patch('shutil.copytree', autospec=True)
|
||||||
@ -77,7 +77,7 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
|
|||||||
@mock.patch('os.path.abspath')
|
@mock.patch('os.path.abspath')
|
||||||
@mock.patch('yaml.safe_load')
|
@mock.patch('yaml.safe_load')
|
||||||
@mock.patch('shutil.copytree', autospec=True)
|
@mock.patch('shutil.copytree', autospec=True)
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||||
'take_action', autospec=True)
|
'take_action', autospec=True)
|
||||||
def test_update_out(self, mock_deploy, mock_open, mock_copy, mock_yaml,
|
def test_update_out(self, mock_deploy, mock_open, mock_copy, mock_yaml,
|
||||||
@ -124,7 +124,7 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
|
|||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('os.path.expanduser')
|
@mock.patch('os.path.expanduser')
|
||||||
@mock.patch('oslo_concurrency.processutils.execute')
|
@mock.patch('oslo_concurrency.processutils.execute')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
def test_update_with_no_limit(
|
def test_update_with_no_limit(
|
||||||
self, mock_open, mock_execute, mock_expanduser, update_ansible,
|
self, mock_open, mock_execute, mock_expanduser, update_ansible,
|
||||||
mock_confirm):
|
mock_confirm):
|
||||||
|
@ -51,7 +51,7 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
|||||||
@mock.patch('tripleoclient.v1.overcloud_upgrade.UpgradePrepare.log',
|
@mock.patch('tripleoclient.v1.overcloud_upgrade.UpgradePrepare.log',
|
||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('yaml.safe_load')
|
@mock.patch('yaml.safe_load')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
def test_upgrade_out(self,
|
def test_upgrade_out(self,
|
||||||
mock_open,
|
mock_open,
|
||||||
mock_yaml,
|
mock_yaml,
|
||||||
@ -106,7 +106,7 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
|||||||
@mock.patch('tripleoclient.utils.get_stack',
|
@mock.patch('tripleoclient.utils.get_stack',
|
||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('tripleoclient.utils.prepend_environment', autospec=True)
|
@mock.patch('tripleoclient.utils.prepend_environment', autospec=True)
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('yaml.safe_load')
|
@mock.patch('yaml.safe_load')
|
||||||
def test_upgrade_failed(self, mock_yaml, mock_open,
|
def test_upgrade_failed(self, mock_yaml, mock_open,
|
||||||
add_env, mock_get_stack, mock_overcloud_deploy,
|
add_env, mock_get_stack, mock_overcloud_deploy,
|
||||||
@ -170,7 +170,7 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
|||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('os.path.expanduser')
|
@mock.patch('os.path.expanduser')
|
||||||
@mock.patch('oslo_concurrency.processutils.execute')
|
@mock.patch('oslo_concurrency.processutils.execute')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
def test_upgrade_limit_with_playbook_and_user(
|
def test_upgrade_limit_with_playbook_and_user(
|
||||||
self, mock_open, mock_execute, mock_expanduser, upgrade_ansible,
|
self, mock_open, mock_execute, mock_expanduser, upgrade_ansible,
|
||||||
mock_run, mock_run_prepare, mock_confirm):
|
mock_run, mock_run_prepare, mock_confirm):
|
||||||
@ -201,7 +201,7 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
|||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('os.path.expanduser')
|
@mock.patch('os.path.expanduser')
|
||||||
@mock.patch('oslo_concurrency.processutils.execute')
|
@mock.patch('oslo_concurrency.processutils.execute')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
def test_upgrade_nodes_with_playbook_no_skip_tags(
|
def test_upgrade_nodes_with_playbook_no_skip_tags(
|
||||||
self, mock_open, mock_execute, mock_expanduser, upgrade_ansible,
|
self, mock_open, mock_execute, mock_expanduser, upgrade_ansible,
|
||||||
mock_run, mock_run_prepare, mock_confirm):
|
mock_run, mock_run_prepare, mock_confirm):
|
||||||
@ -220,7 +220,7 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
|
|||||||
autospec=True)
|
autospec=True)
|
||||||
@mock.patch('os.path.expanduser')
|
@mock.patch('os.path.expanduser')
|
||||||
@mock.patch('oslo_concurrency.processutils.execute')
|
@mock.patch('oslo_concurrency.processutils.execute')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
def test_upgrade_with_no_limit(
|
def test_upgrade_with_no_limit(
|
||||||
self, mock_open, mock_execute, mock_expanduser, upgrade_ansible):
|
self, mock_open, mock_execute, mock_expanduser, upgrade_ansible):
|
||||||
mock_expanduser.return_value = '/home/fake/'
|
mock_expanduser.return_value = '/home/fake/'
|
||||||
|
@ -14,18 +14,18 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
|
from io import StringIO
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import shutil
|
import shutil
|
||||||
import six
|
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from urllib import parse
|
||||||
import uuid
|
import uuid
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from osc_lib import exceptions as oscexc
|
from osc_lib import exceptions as oscexc
|
||||||
from six.moves.urllib import parse
|
|
||||||
from tripleo_common.image import image_uploader
|
from tripleo_common.image import image_uploader
|
||||||
from tripleo_common.image import kolla_builder
|
from tripleo_common.image import kolla_builder
|
||||||
from tripleoclient import constants
|
from tripleoclient import constants
|
||||||
@ -901,7 +901,7 @@ class TestTripleoImagePrepareDefault(TestPluginV1):
|
|||||||
self.app.command_options = [
|
self.app.command_options = [
|
||||||
'tripleo', 'container', 'image', 'prepare', 'default'
|
'tripleo', 'container', 'image', 'prepare', 'default'
|
||||||
] + arglist
|
] + arglist
|
||||||
self.cmd.app.stdout = six.StringIO()
|
self.cmd.app.stdout = StringIO()
|
||||||
cmd = container_image.TripleOImagePrepareDefault(self.app, None)
|
cmd = container_image.TripleOImagePrepareDefault(self.app, None)
|
||||||
|
|
||||||
parsed_args = self.check_parser(cmd, arglist, verifylist)
|
parsed_args = self.check_parser(cmd, arglist, verifylist)
|
||||||
@ -971,7 +971,7 @@ class TestContainerImageBuild(TestPluginV1):
|
|||||||
|
|
||||||
# Get the command object to test
|
# Get the command object to test
|
||||||
self.cmd = container_image.BuildImage(self.app, None)
|
self.cmd = container_image.BuildImage(self.app, None)
|
||||||
self.cmd.app.stdout = six.StringIO()
|
self.cmd.app.stdout = StringIO()
|
||||||
self.uuid = str(uuid.uuid4())
|
self.uuid = str(uuid.uuid4())
|
||||||
self.temp_dir = os.path.join(self.useFixture(
|
self.temp_dir = os.path.join(self.useFixture(
|
||||||
fixtures.TempDir()).join())
|
fixtures.TempDir()).join())
|
||||||
|
@ -46,7 +46,7 @@ class TestOvercloudExport(utils.TestCommand):
|
|||||||
mock_exists.return_value = False
|
mock_exists.return_value = False
|
||||||
mock_export_passwords.return_value = {'key': 'value'}
|
mock_export_passwords.return_value = {'key': 'value'}
|
||||||
mock_export_stack.return_value = {'key0': 'value0'}
|
mock_export_stack.return_value = {'key0': 'value0'}
|
||||||
with mock.patch('six.moves.builtins.open', self.mock_open):
|
with mock.patch('builtins.open', self.mock_open):
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
mock_export_passwords.assert_called_once_with(
|
mock_export_passwords.assert_called_once_with(
|
||||||
self.app.client_manager.orchestration,
|
self.app.client_manager.orchestration,
|
||||||
@ -78,7 +78,7 @@ class TestOvercloudExport(utils.TestCommand):
|
|||||||
verifylist = [('stack', 'foo')]
|
verifylist = [('stack', 'foo')]
|
||||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||||
mock_exists.return_value = False
|
mock_exists.return_value = False
|
||||||
with mock.patch('six.moves.builtins.open', self.mock_open):
|
with mock.patch('builtins.open', self.mock_open):
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
mock_export_passwords.assert_called_once_with(
|
mock_export_passwords.assert_called_once_with(
|
||||||
self.app.client_manager.orchestration,
|
self.app.client_manager.orchestration,
|
||||||
@ -106,7 +106,7 @@ class TestOvercloudExport(utils.TestCommand):
|
|||||||
('config_download_dir', '/tmp/bar')]
|
('config_download_dir', '/tmp/bar')]
|
||||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||||
mock_exists.return_value = False
|
mock_exists.return_value = False
|
||||||
with mock.patch('six.moves.builtins.open', self.mock_open):
|
with mock.patch('builtins.open', self.mock_open):
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
mock_export_passwords.assert_called_once_with(
|
mock_export_passwords.assert_called_once_with(
|
||||||
self.app.client_manager.orchestration,
|
self.app.client_manager.orchestration,
|
||||||
@ -132,7 +132,7 @@ class TestOvercloudExport(utils.TestCommand):
|
|||||||
('no_password_excludes', True)]
|
('no_password_excludes', True)]
|
||||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||||
mock_exists.return_value = False
|
mock_exists.return_value = False
|
||||||
with mock.patch('six.moves.builtins.open', self.mock_open):
|
with mock.patch('builtins.open', self.mock_open):
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
mock_export_passwords.assert_called_once_with(
|
mock_export_passwords.assert_called_once_with(
|
||||||
self.app.client_manager.orchestration,
|
self.app.client_manager.orchestration,
|
||||||
|
@ -59,7 +59,7 @@ class TestOvercloudExportCeph(utils.TestCommand):
|
|||||||
data['parameter_defaults']['CephExternalMultiConfig'] = [expected]
|
data['parameter_defaults']['CephExternalMultiConfig'] = [expected]
|
||||||
mock_export_ceph.return_value = expected
|
mock_export_ceph.return_value = expected
|
||||||
|
|
||||||
with mock.patch('six.moves.builtins.open', self.mock_open):
|
with mock.patch('builtins.open', self.mock_open):
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
path = os.path.join(os.environ.get('HOME'),
|
path = os.path.join(os.environ.get('HOME'),
|
||||||
'overcloud-deploy', 'dcn0', 'config-download')
|
'overcloud-deploy', 'dcn0', 'config-download')
|
||||||
|
@ -63,7 +63,7 @@ class TestGenerateFencingParameters(utils.TestCommand):
|
|||||||
|
|
||||||
mock_gen_fence.return_value = '{"result":[]}'
|
mock_gen_fence.return_value = '{"result":[]}'
|
||||||
|
|
||||||
with mock.patch('six.moves.builtins.open', mock_open_context):
|
with mock.patch('builtins.open', mock_open_context):
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
mock_exists.return_value = False
|
mock_exists.return_value = False
|
||||||
|
|
||||||
mock_open_context = mock.mock_open()
|
mock_open_context = mock.mock_open()
|
||||||
with mock.patch('six.moves.builtins.open', mock_open_context):
|
with mock.patch('builtins.open', mock_open_context):
|
||||||
self.cmd._update_passwords_env(self.temp_homedir, 'stack')
|
self.cmd._update_passwords_env(self.temp_homedir, 'stack')
|
||||||
|
|
||||||
mock_open_handle = mock_open_context()
|
mock_open_handle = mock_open_context()
|
||||||
@ -403,7 +403,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
'_setup_heat_environments', autospec=True)
|
'_setup_heat_environments', autospec=True)
|
||||||
@mock.patch('yaml.safe_dump', autospec=True)
|
@mock.patch('yaml.safe_dump', autospec=True)
|
||||||
@mock.patch('yaml.safe_load', autospec=True)
|
@mock.patch('yaml.safe_load', autospec=True)
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tempfile.NamedTemporaryFile', autospec=True)
|
@mock.patch('tempfile.NamedTemporaryFile', autospec=True)
|
||||||
@mock.patch('tripleo_common.image.kolla_builder.'
|
@mock.patch('tripleo_common.image.kolla_builder.'
|
||||||
'container_images_prepare_multi')
|
'container_images_prepare_multi')
|
||||||
@ -520,7 +520,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
@mock.patch('yaml.safe_load', return_value={}, autospec=True)
|
@mock.patch('yaml.safe_load', return_value={}, autospec=True)
|
||||||
@mock.patch('yaml.safe_dump', autospec=True)
|
@mock.patch('yaml.safe_dump', autospec=True)
|
||||||
@mock.patch('os.path.isfile', return_value=True)
|
@mock.patch('os.path.isfile', return_value=True)
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||||
'_process_hieradata_overrides', autospec=True)
|
'_process_hieradata_overrides', autospec=True)
|
||||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||||
@ -722,7 +722,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
# TODO(cjeanner) drop once we have proper oslo.privsep
|
# TODO(cjeanner) drop once we have proper oslo.privsep
|
||||||
@mock.patch('getpass.getuser', return_value='stack')
|
@mock.patch('getpass.getuser', return_value='stack')
|
||||||
@mock.patch('os.mkdir')
|
@mock.patch('os.mkdir')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||||
'_populate_templates_dir')
|
'_populate_templates_dir')
|
||||||
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
||||||
@ -817,7 +817,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
# TODO(cjeanner) drop once we have proper oslo.privsep
|
# TODO(cjeanner) drop once we have proper oslo.privsep
|
||||||
@mock.patch('getpass.getuser', return_value='stack')
|
@mock.patch('getpass.getuser', return_value='stack')
|
||||||
@mock.patch('os.mkdir')
|
@mock.patch('os.mkdir')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||||
'_populate_templates_dir')
|
'_populate_templates_dir')
|
||||||
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
||||||
@ -902,7 +902,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
# TODO(cjeanner) drop once we have proper oslo.privsep
|
# TODO(cjeanner) drop once we have proper oslo.privsep
|
||||||
@mock.patch('getpass.getuser', return_value='stack')
|
@mock.patch('getpass.getuser', return_value='stack')
|
||||||
@mock.patch('os.mkdir')
|
@mock.patch('os.mkdir')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||||
'_populate_templates_dir')
|
'_populate_templates_dir')
|
||||||
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
||||||
@ -1058,7 +1058,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
@mock.patch('os.chmod')
|
@mock.patch('os.chmod')
|
||||||
# TODO(cjeanner) drop once we have proper oslo.privsep
|
# TODO(cjeanner) drop once we have proper oslo.privsep
|
||||||
@mock.patch('os.mkdir')
|
@mock.patch('os.mkdir')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||||
'_populate_templates_dir')
|
'_populate_templates_dir')
|
||||||
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
||||||
@ -1117,7 +1117,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||||||
@mock.patch('os.chmod')
|
@mock.patch('os.chmod')
|
||||||
# TODO(cjeanner) drop once we have proper oslo.privsep
|
# TODO(cjeanner) drop once we have proper oslo.privsep
|
||||||
@mock.patch('os.mkdir')
|
@mock.patch('os.mkdir')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||||
'_populate_templates_dir')
|
'_populate_templates_dir')
|
||||||
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
@mock.patch('tripleoclient.utils.archive_deploy_artifacts',
|
||||||
|
@ -56,7 +56,7 @@ class TestUndercloudInstall(TestPluginV1):
|
|||||||
# TODO(cjeanner) drop once we have proper oslo.privsep
|
# TODO(cjeanner) drop once we have proper oslo.privsep
|
||||||
@mock.patch('os.geteuid', return_value=1001)
|
@mock.patch('os.geteuid', return_value=1001)
|
||||||
@mock.patch('getpass.getuser', return_value='stack')
|
@mock.patch('getpass.getuser', return_value='stack')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('shutil.copy')
|
@mock.patch('shutil.copy')
|
||||||
@mock.patch('os.mkdir')
|
@mock.patch('os.mkdir')
|
||||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||||
@ -397,7 +397,7 @@ class TestUndercloudInstall(TestPluginV1):
|
|||||||
# TODO(cjeanner) drop once we have proper oslo.privsep
|
# TODO(cjeanner) drop once we have proper oslo.privsep
|
||||||
@mock.patch('os.geteuid', return_value=1001)
|
@mock.patch('os.geteuid', return_value=1001)
|
||||||
@mock.patch('getpass.getuser', return_value='stack')
|
@mock.patch('getpass.getuser', return_value='stack')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('shutil.copy')
|
@mock.patch('shutil.copy')
|
||||||
@mock.patch('os.mkdir')
|
@mock.patch('os.mkdir')
|
||||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||||
@ -460,7 +460,7 @@ class TestUndercloudInstall(TestPluginV1):
|
|||||||
# TODO(cjeanner) drop once we have proper oslo.privsep
|
# TODO(cjeanner) drop once we have proper oslo.privsep
|
||||||
@mock.patch('os.geteuid', return_value=1001)
|
@mock.patch('os.geteuid', return_value=1001)
|
||||||
@mock.patch('getpass.getuser', return_value='stack')
|
@mock.patch('getpass.getuser', return_value='stack')
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('builtins.open')
|
||||||
@mock.patch('shutil.copy')
|
@mock.patch('shutil.copy')
|
||||||
@mock.patch('os.mkdir')
|
@mock.patch('os.mkdir')
|
||||||
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
|
||||||
|
@ -77,7 +77,7 @@ class TestContainerImages(deploy_fakes.TestDeployOvercloud):
|
|||||||
mock_isfile.return_value = True
|
mock_isfile.return_value = True
|
||||||
with mock.patch("os.path.isdir", autospec=True) as mock_isdir:
|
with mock.patch("os.path.isdir", autospec=True) as mock_isdir:
|
||||||
mock_isdir.return_value = True
|
mock_isdir.return_value = True
|
||||||
with mock.patch('six.moves.builtins.open', mock_open):
|
with mock.patch('builtins.open', mock_open):
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
"tripleoclient.v2.tripleo_container_image.Build"
|
"tripleoclient.v2.tripleo_container_image.Build"
|
||||||
".find_image",
|
".find_image",
|
||||||
@ -88,7 +88,7 @@ class TestContainerImages(deploy_fakes.TestDeployOvercloud):
|
|||||||
|
|
||||||
def test_find_image(self):
|
def test_find_image(self):
|
||||||
mock_open = mock.mock_open(read_data='---\ntcib_option: "data"')
|
mock_open = mock.mock_open(read_data='---\ntcib_option: "data"')
|
||||||
with mock.patch('six.moves.builtins.open', mock_open):
|
with mock.patch('builtins.open', mock_open):
|
||||||
image = self.cmd.find_image("keystone", "some/path", "base-image")
|
image = self.cmd.find_image("keystone", "some/path", "base-image")
|
||||||
self.assertEqual(image, {"tcib_option": "data"})
|
self.assertEqual(image, {"tcib_option": "data"})
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class TestParameterWorkflows(utils.TestCommand):
|
|||||||
self.app.client_manager.baremetal = mock.Mock()
|
self.app.client_manager.baremetal = mock.Mock()
|
||||||
|
|
||||||
@mock.patch('yaml.safe_load')
|
@mock.patch('yaml.safe_load')
|
||||||
@mock.patch("six.moves.builtins.open")
|
@mock.patch("builtins.open")
|
||||||
@mock.patch('tripleoclient.utils.run_ansible_playbook', autospec=True)
|
@mock.patch('tripleoclient.utils.run_ansible_playbook', autospec=True)
|
||||||
@mock.patch('tripleoclient.utils.get_tripleo_ansible_inventory',
|
@mock.patch('tripleoclient.utils.get_tripleo_ansible_inventory',
|
||||||
autospec=True)
|
autospec=True)
|
||||||
@ -81,7 +81,7 @@ class TestParameterWorkflows(utils.TestCommand):
|
|||||||
mock_playbook.assert_has_calls(calls, any_order=True)
|
mock_playbook.assert_has_calls(calls, any_order=True)
|
||||||
|
|
||||||
@mock.patch('yaml.safe_load')
|
@mock.patch('yaml.safe_load')
|
||||||
@mock.patch("six.moves.builtins.open")
|
@mock.patch("builtins.open")
|
||||||
@mock.patch('tripleoclient.utils.run_ansible_playbook', autospec=True)
|
@mock.patch('tripleoclient.utils.run_ansible_playbook', autospec=True)
|
||||||
@mock.patch('tripleoclient.utils.get_tripleo_ansible_inventory',
|
@mock.patch('tripleoclient.utils.get_tripleo_ansible_inventory',
|
||||||
autospec=True)
|
autospec=True)
|
||||||
|
@ -20,6 +20,7 @@ try:
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
collectionsAbc = collections
|
collectionsAbc = collections
|
||||||
|
|
||||||
|
import configparser
|
||||||
import csv
|
import csv
|
||||||
import datetime
|
import datetime
|
||||||
import errno
|
import errno
|
||||||
@ -38,7 +39,6 @@ import pwd
|
|||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import simplejson
|
import simplejson
|
||||||
import six
|
|
||||||
import socket
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@ -59,12 +59,11 @@ from heatclient.exc import HTTPNotFound
|
|||||||
from osc_lib import exceptions as oscexc
|
from osc_lib import exceptions as oscexc
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
from six.moves import configparser
|
|
||||||
|
|
||||||
from heatclient import exc as hc_exc
|
from heatclient import exc as hc_exc
|
||||||
from six.moves.urllib import error as url_error
|
from urllib import error as url_error
|
||||||
from six.moves.urllib import parse as url_parse
|
from urllib import parse as url_parse
|
||||||
from six.moves.urllib import request
|
from urllib import request
|
||||||
|
|
||||||
from tenacity import retry
|
from tenacity import retry
|
||||||
from tenacity.stop import stop_after_attempt, stop_after_delay
|
from tenacity.stop import stop_after_attempt, stop_after_delay
|
||||||
@ -183,7 +182,7 @@ def _encode_envvars(env):
|
|||||||
:type env: `dict`.
|
:type env: `dict`.
|
||||||
"""
|
"""
|
||||||
for key, value in env.items():
|
for key, value in env.items():
|
||||||
env[key] = six.text_type(value)
|
env[key] = str(value)
|
||||||
else:
|
else:
|
||||||
return env
|
return env
|
||||||
|
|
||||||
@ -362,7 +361,7 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
|
|||||||
|
|
||||||
def _inventory(inventory):
|
def _inventory(inventory):
|
||||||
if inventory:
|
if inventory:
|
||||||
if isinstance(inventory, six.string_types):
|
if isinstance(inventory, str):
|
||||||
# check is file path
|
# check is file path
|
||||||
if os.path.exists(inventory):
|
if os.path.exists(inventory):
|
||||||
return inventory
|
return inventory
|
||||||
@ -739,11 +738,11 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
|
|||||||
|
|
||||||
def convert(data):
|
def convert(data):
|
||||||
"""Recursively converts dictionary keys,values to strings."""
|
"""Recursively converts dictionary keys,values to strings."""
|
||||||
if isinstance(data, six.string_types):
|
if isinstance(data, str):
|
||||||
return str(data)
|
return str(data)
|
||||||
elif isinstance(data, collectionsAbc.Mapping):
|
if isinstance(data, collectionsAbc.Mapping):
|
||||||
return dict(map(convert, six.iteritems(data)))
|
return dict(map(convert, data.items()))
|
||||||
elif isinstance(data, collectionsAbc.Iterable):
|
if isinstance(data, collectionsAbc.Iterable):
|
||||||
return type(data)(map(convert, data))
|
return type(data)(map(convert, data))
|
||||||
else:
|
else:
|
||||||
return data
|
return data
|
||||||
@ -1202,7 +1201,7 @@ def check_stack_network_matches_env_files(stack, environment):
|
|||||||
"""
|
"""
|
||||||
def _get_networks(registry):
|
def _get_networks(registry):
|
||||||
nets = set()
|
nets = set()
|
||||||
for k, v in six.iteritems(registry):
|
for k, v in registry.items():
|
||||||
if (k.startswith('OS::TripleO::Network::')
|
if (k.startswith('OS::TripleO::Network::')
|
||||||
and not k.startswith('OS::TripleO::Network::Port')
|
and not k.startswith('OS::TripleO::Network::Port')
|
||||||
and v != 'OS::Heat::None'):
|
and v != 'OS::Heat::None'):
|
||||||
@ -1589,7 +1588,7 @@ def replace_links_in_template(template_part, link_replacement):
|
|||||||
|
|
||||||
def replaced_dict_value(key, value):
|
def replaced_dict_value(key, value):
|
||||||
if ((key == 'get_file' or key == 'type') and
|
if ((key == 'get_file' or key == 'type') and
|
||||||
isinstance(value, six.string_types)):
|
isinstance(value, str)):
|
||||||
return link_replacement.get(value, value)
|
return link_replacement.get(value, value)
|
||||||
else:
|
else:
|
||||||
return replace_links_in_template(value, link_replacement)
|
return replace_links_in_template(value, link_replacement)
|
||||||
@ -1599,8 +1598,8 @@ def replace_links_in_template(template_part, link_replacement):
|
|||||||
|
|
||||||
if isinstance(template_part, dict):
|
if isinstance(template_part, dict):
|
||||||
return {k: replaced_dict_value(k, v)
|
return {k: replaced_dict_value(k, v)
|
||||||
for k, v in six.iteritems(template_part)}
|
for k, v in template_part.items()}
|
||||||
elif isinstance(template_part, list):
|
if isinstance(template_part, list):
|
||||||
return list(map(replaced_list_value, template_part))
|
return list(map(replaced_list_value, template_part))
|
||||||
else:
|
else:
|
||||||
return template_part
|
return template_part
|
||||||
@ -1615,7 +1614,7 @@ def relative_link_replacement(link_replacement, current_dir):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
return {k: os.path.relpath(v, current_dir)
|
return {k: os.path.relpath(v, current_dir)
|
||||||
for k, v in six.iteritems(link_replacement)}
|
for k, v in link_replacement.items()}
|
||||||
|
|
||||||
|
|
||||||
def load_environment_directories(directories):
|
def load_environment_directories(directories):
|
||||||
@ -1935,14 +1934,14 @@ def process_multiple_environments(created_env_files, tht_root,
|
|||||||
# See bug https://bugs.launchpad.net/tripleo/+bug/1625783
|
# See bug https://bugs.launchpad.net/tripleo/+bug/1625783
|
||||||
# for details on why this is needed (backwards-compatibility)
|
# for details on why this is needed (backwards-compatibility)
|
||||||
log.debug("Error %s processing environment file %s"
|
log.debug("Error %s processing environment file %s"
|
||||||
% (six.text_type(ex), env_path))
|
% (str(ex), env_path))
|
||||||
# Use the temporary path as it's possible the environment
|
# Use the temporary path as it's possible the environment
|
||||||
# itself was rendered via jinja.
|
# itself was rendered via jinja.
|
||||||
with open(env_path, 'r') as f:
|
with open(env_path, 'r') as f:
|
||||||
env_map = yaml.safe_load(f)
|
env_map = yaml.safe_load(f)
|
||||||
env_registry = env_map.get('resource_registry', {})
|
env_registry = env_map.get('resource_registry', {})
|
||||||
env_dirname = os.path.dirname(os.path.abspath(env_path))
|
env_dirname = os.path.dirname(os.path.abspath(env_path))
|
||||||
for rsrc, rsrc_path in six.iteritems(env_registry):
|
for rsrc, rsrc_path in env_registry.items():
|
||||||
# We need to calculate the absolute path relative to
|
# We need to calculate the absolute path relative to
|
||||||
# env_path not cwd (which is what abspath uses).
|
# env_path not cwd (which is what abspath uses).
|
||||||
abs_rsrc_path = os.path.normpath(
|
abs_rsrc_path = os.path.normpath(
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import errno
|
import errno
|
||||||
|
from io import StringIO
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -27,8 +28,7 @@ import uuid
|
|||||||
|
|
||||||
from osc_lib import exceptions as oscexc
|
from osc_lib import exceptions as oscexc
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
import six
|
from urllib import parse
|
||||||
from six.moves.urllib import parse
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from tripleo_common.image.builder import buildah
|
from tripleo_common.image.builder import buildah
|
||||||
@ -45,7 +45,7 @@ from tripleoclient import utils
|
|||||||
|
|
||||||
def build_env_file(params, command_options):
|
def build_env_file(params, command_options):
|
||||||
|
|
||||||
f = six.StringIO()
|
f = StringIO()
|
||||||
f.write('# Generated with the following on %s\n#\n' %
|
f.write('# Generated with the following on %s\n#\n' %
|
||||||
datetime.datetime.now().isoformat())
|
datetime.datetime.now().isoformat())
|
||||||
f.write('# openstack %s\n#\n\n' %
|
f.write('# openstack %s\n#\n\n' %
|
||||||
|
@ -23,8 +23,8 @@ from prettytable import PrettyTable
|
|||||||
from pwd import getpwuid
|
from pwd import getpwuid
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import six
|
|
||||||
import time
|
import time
|
||||||
|
import urllib
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from heatclient.common import template_utils
|
from heatclient.common import template_utils
|
||||||
@ -408,7 +408,7 @@ class DeployOvercloud(command.Command):
|
|||||||
# an FQDN depending on how what it's configured to output in the
|
# an FQDN depending on how what it's configured to output in the
|
||||||
# tripleo-heat-templates. Such a configuration can be done by
|
# tripleo-heat-templates. Such a configuration can be done by
|
||||||
# overriding the EndpointMap through parameter_defaults.
|
# overriding the EndpointMap through parameter_defaults.
|
||||||
overcloud_ip_or_fqdn = six.moves.urllib.parse.urlparse(
|
overcloud_ip_or_fqdn = urllib.parse.urlparse(
|
||||||
overcloud_endpoint).hostname
|
overcloud_endpoint).hostname
|
||||||
|
|
||||||
keystone_admin_ip = utils.get_endpoint('KeystoneAdmin', stack)
|
keystone_admin_ip = utils.get_endpoint('KeystoneAdmin', stack)
|
||||||
|
@ -19,7 +19,6 @@ import os
|
|||||||
|
|
||||||
import ipaddress
|
import ipaddress
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
import six
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from tripleoclient import command
|
from tripleoclient import command
|
||||||
@ -87,7 +86,7 @@ class ValidateOvercloudNetenv(command.Command):
|
|||||||
objs = []
|
objs = []
|
||||||
for x in networks:
|
for x in networks:
|
||||||
try:
|
try:
|
||||||
objs += [ipaddress.ip_network(six.u(x))]
|
objs += [ipaddress.ip_network(str(x))]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.log.error('Invalid address: %s', x)
|
self.log.error('Invalid address: %s', x)
|
||||||
self.error_count += 1
|
self.error_count += 1
|
||||||
@ -108,13 +107,13 @@ class ValidateOvercloudNetenv(command.Command):
|
|||||||
for pool in pooldata:
|
for pool in pooldata:
|
||||||
try:
|
try:
|
||||||
ip_start = ipaddress.ip_address(
|
ip_start = ipaddress.ip_address(
|
||||||
six.u(pool['start']))
|
str(pool['start']))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.log.error('Invalid address: %s' % ip_start)
|
self.log.error('Invalid address: %s' % ip_start)
|
||||||
self.error_count += 1
|
self.error_count += 1
|
||||||
ip_start = None
|
ip_start = None
|
||||||
try:
|
try:
|
||||||
ip_end = ipaddress.ip_address(six.u(pool['end']))
|
ip_end = ipaddress.ip_address(str(pool['end']))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.log.error('Invalid address: %s' % ip_start)
|
self.log.error('Invalid address: %s' % ip_start)
|
||||||
self.error_count += 1
|
self.error_count += 1
|
||||||
@ -132,7 +131,7 @@ class ValidateOvercloudNetenv(command.Command):
|
|||||||
subnet_item = poolitem.split('AllocationPools')[0] + 'NetCidr'
|
subnet_item = poolitem.split('AllocationPools')[0] + 'NetCidr'
|
||||||
try:
|
try:
|
||||||
subnet_obj = ipaddress.ip_network(
|
subnet_obj = ipaddress.ip_network(
|
||||||
six.u(filedata[subnet_item]))
|
str(filedata[subnet_item]))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.log.error('Invalid address: %s', subnet_item)
|
self.log.error('Invalid address: %s', subnet_item)
|
||||||
self.error_count += 1
|
self.error_count += 1
|
||||||
@ -150,7 +149,7 @@ class ValidateOvercloudNetenv(command.Command):
|
|||||||
|
|
||||||
def check_vlan_ids(self, vlans):
|
def check_vlan_ids(self, vlans):
|
||||||
invertdict = {}
|
invertdict = {}
|
||||||
for k, v in six.iteritems(vlans):
|
for k, v in vlans.items():
|
||||||
self.log.info('Checking Vlan ID {}'.format(k))
|
self.log.info('Checking Vlan ID {}'.format(k))
|
||||||
if v not in invertdict:
|
if v not in invertdict:
|
||||||
invertdict[v] = k
|
invertdict[v] = k
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
import collections
|
import collections
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
|
from io import StringIO
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
@ -27,7 +28,6 @@ from openstack import exceptions as openstack_exc
|
|||||||
from osc_lib import exceptions as oscexc
|
from osc_lib import exceptions as oscexc
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
from osc_lib import utils
|
from osc_lib import utils
|
||||||
import six
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from tripleoclient import command
|
from tripleoclient import command
|
||||||
@ -111,7 +111,7 @@ class DeleteNode(command.Command):
|
|||||||
node_hostnames = [i['hostname'] for i in nodes if 'hostname' in i]
|
node_hostnames = [i['hostname'] for i in nodes if 'hostname' in i]
|
||||||
|
|
||||||
formatter = table.TableFormatter()
|
formatter = table.TableFormatter()
|
||||||
output = six.StringIO()
|
output = StringIO()
|
||||||
formatter.emit_list(
|
formatter.emit_list(
|
||||||
column_names=['hostname', 'name', 'id'],
|
column_names=['hostname', 'name', 'id'],
|
||||||
data=nodes_data,
|
data=nodes_data,
|
||||||
@ -637,7 +637,7 @@ class ExtractProvisionedNode(command.Command):
|
|||||||
data.append(role)
|
data.append(role)
|
||||||
|
|
||||||
# Write the file header
|
# Write the file header
|
||||||
file_data = six.StringIO()
|
file_data = StringIO()
|
||||||
file_data.write('# Generated with the following on %s\n#\n' %
|
file_data.write('# Generated with the following on %s\n#\n' %
|
||||||
datetime.datetime.now().isoformat())
|
datetime.datetime.now().isoformat())
|
||||||
file_data.write('# openstack %s\n#\n\n' %
|
file_data.write('# openstack %s\n#\n\n' %
|
||||||
@ -650,7 +650,7 @@ class ExtractProvisionedNode(command.Command):
|
|||||||
if parsed_args.output:
|
if parsed_args.output:
|
||||||
if (os.path.exists(parsed_args.output)
|
if (os.path.exists(parsed_args.output)
|
||||||
and not parsed_args.yes and sys.stdin.isatty()):
|
and not parsed_args.yes and sys.stdin.isatty()):
|
||||||
prompt_response = six.moves.input(
|
prompt_response = input(
|
||||||
('Overwrite existing file %s [y/N]?' % parsed_args.output)
|
('Overwrite existing file %s [y/N]?' % parsed_args.output)
|
||||||
).lower()
|
).lower()
|
||||||
if not prompt_response.startswith('y'):
|
if not prompt_response.startswith('y'):
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import configparser
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import netaddr
|
import netaddr
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
import shutil
|
import shutil
|
||||||
import six
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@ -31,7 +31,6 @@ import yaml
|
|||||||
from cliff import command
|
from cliff import command
|
||||||
from heatclient.common import template_utils
|
from heatclient.common import template_utils
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
from six.moves import configparser
|
|
||||||
|
|
||||||
from tripleoclient import constants
|
from tripleoclient import constants
|
||||||
from tripleoclient import exceptions
|
from tripleoclient import exceptions
|
||||||
@ -1431,9 +1430,9 @@ class Deploy(command.Command):
|
|||||||
try:
|
try:
|
||||||
self._standalone_deploy(parsed_args)
|
self._standalone_deploy(parsed_args)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.log.error("Exception: %s" % six.text_type(ex))
|
self.log.error("Exception: %s" % str(ex))
|
||||||
self.log.error(traceback.print_exc())
|
self.log.error(traceback.print_exc())
|
||||||
raise exceptions.DeploymentError(six.text_type(ex))
|
raise exceptions.DeploymentError(str(ex))
|
||||||
finally:
|
finally:
|
||||||
# Copy clouds.yaml from /etc/openstack so credentials can be
|
# Copy clouds.yaml from /etc/openstack so credentials can be
|
||||||
# read by the deployment user and not only root.
|
# read by the deployment user and not only root.
|
||||||
|
@ -19,8 +19,6 @@ import re
|
|||||||
import uuid
|
import uuid
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from osc_lib.i18n import _
|
from osc_lib.i18n import _
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
@ -387,7 +385,7 @@ class Build(command.Command):
|
|||||||
self.image_paths[key] = os.path.join(work_dir, key)
|
self.image_paths[key] = os.path.join(work_dir, key)
|
||||||
utils.makedirs(dir_path=self.image_paths[key])
|
utils.makedirs(dir_path=self.image_paths[key])
|
||||||
self.make_dir_tree(tree=value, work_dir=self.image_paths[key])
|
self.make_dir_tree(tree=value, work_dir=self.image_paths[key])
|
||||||
elif isinstance(tree, six.string_types):
|
elif isinstance(tree, str):
|
||||||
self.image_paths[tree] = os.path.join(work_dir, tree)
|
self.image_paths[tree] = os.path.join(work_dir, tree)
|
||||||
utils.makedirs(dir_path=self.image_paths[tree])
|
utils.makedirs(dir_path=self.image_paths[tree])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user