Release 1.5.1 with a fix for os deployment create from env

**rally deployment create* --fromenv* creates wrong spec for
rally-openstack<=1.4.0

Closes-Bug: #1829030
Change-Id: I61588eaa070b10b780c92d54d1b9439e8fd3f6b6
This commit is contained in:
Andrey Kurilin 2019-05-14 18:06:57 -07:00
parent 21630956e4
commit 14a8b0f931
6 changed files with 67 additions and 7 deletions

View File

@ -17,6 +17,18 @@ Changelog
.. Release notes for existing releases are MUTABLE! If there is something that
was missed or can be improved, feel free to change it!
[1.5.1] - 2019-05-15
--------------------
Fixed
~~~~~
**rally deployment create --fromenv** creates wrong spec for
rally-openstack<=1.4.0 which doesn't pass **rally deployment check**.
`Launchpad-bug #1829030 <https://launchpad.net/bugs/1829030>`_
[1.5.0] - 2019-05-08
--------------------

View File

@ -17,7 +17,7 @@ additional plugins:
# for rally user is used.
#
# Tags of the image are the same as releases of xRally/Rally
FROM xrally/xrally:1.5.0
FROM xrally/xrally:1.5.1
# "rally" user (which is selected by-default) is owner of "/rally" directory,
# so there is no need to call chown or switch the user
@ -39,8 +39,8 @@ details)
First of all, you need to pull the container. We suggest to use the last
tagged version:
# pull the 1.5.0 image (the latest release at the point of writing the note)
$ docker pull xrally/xrally:1.5.0
# pull the 1.5.1 image (the latest release at the point of writing the note)
$ docker pull xrally/xrally:1.5.1
**WARNING: never attach folders and volumes to `/rally` inside the container. It can break everything.**
@ -56,7 +56,7 @@ docker volumes or mount the directory.
* use docker volumes. It is the easiest way. You just need to do something like:
$ docker volume create --name rally_volume
$ docker run -v rally_volume:/home/rally/.rally xrally/xrally:1.5.0 env create --name "foo"
$ docker run -v rally_volume:/home/rally/.rally xrally/xrally:1.5.1 env create --name "foo"
* mount outer directory inside the container

View File

@ -85,6 +85,22 @@ class DeploymentCommands(object):
if fromenv:
result = env_mgr.EnvManager.create_spec_from_sys_environ()
config = result["spec"]
if "existing@openstack" in config:
# NOTE(andreykurilin): if we are are here it means that
# rally-openstack package is installed
import rally_openstack
if rally_openstack.__version_tuple__ <= (1, 4, 0):
print(rally_openstack.__version_tuple__)
if config["existing@openstack"]["https_key"]:
print("WARNING: OS_KEY is ignored due to old version "
"of rally-openstack package.")
# NOTE(andreykurilin): To support rally-openstack <=1.4.0
# we need to remove https_key, since OpenStackCredentials
# object doesn't support it.
# Latest rally-openstack fixed this issue with
# https://github.com/openstack/rally-openstack/commit/c7483386e6b59474c83e3ecd0c7ee0e77ff50c02
config["existing@openstack"].pop("https_key")
else:
if not filename:
config = {}

View File

@ -54,13 +54,44 @@ class DeploymentCommandsTestCase(test.TestCase):
@mock.patch("rally.env.env_mgr.EnvManager.create_spec_from_sys_environ",
return_value={"spec": {"auth_url": "http://fake"}})
def test_createfromenv(self, mock_create_spec_from_sys_environ):
def test_create_fromenv(self, mock_create_spec_from_sys_environ):
self.deployment.create(self.fake_api, "from_env", True)
self.fake_api.deployment.create.assert_called_once_with(
config={"auth_url": "http://fake"},
name="from_env"
)
@mock.patch("rally.env.env_mgr.EnvManager.create_spec_from_sys_environ")
def test_create_fromenv_openstack(self, mock_create_spec_from_sys_environ):
mock_create_spec_from_sys_environ.side_effect = lambda: {
"spec": {
"existing@openstack": {
"https_key": "some key",
"another_key": "another"
}
}
}
mock_rally_os = mock.Mock()
mock_rally_os.__version_tuple__ = (1, 4, 0)
with mock.patch.dict("sys.modules",
{"rally_openstack": mock_rally_os}):
self.deployment.create(self.fake_api, "from_env", True)
self.fake_api.deployment.create.assert_called_once_with(
config={"existing@openstack": {"another_key": "another"}},
name="from_env"
)
self.fake_api.deployment.create.reset_mock()
mock_rally_os.__version_tuple__ = (1, 5, 0)
self.deployment.create(self.fake_api, "from_env", True)
self.fake_api.deployment.create.assert_called_once_with(
config={"existing@openstack": {"another_key": "another",
"https_key": "some key"}},
name="from_env"
)
@mock.patch("rally.cli.commands.deployment.DeploymentCommands.list")
@mock.patch("rally.cli.commands.deployment.DeploymentCommands.use")
@mock.patch("rally.cli.commands.deployment.open",

View File

@ -27,7 +27,7 @@ DOCKER_DIR = os.path.join(ROOT_DIR, "etc", "docker")
class DockerReadmeTestCase(test.TestCase):
RE_RELEASE = re.compile(r"\[(?P<version>[0-9]+\.[0-9]+.[0.9]+)\]")
RE_RELEASE = re.compile(r"\[(?P<version>[0-9]+\.[0-9]+.[0-9]+)\]")
def get_rally_releases(self):
full_path = os.path.join(ROOT_DIR, "CHANGELOG.rst")
@ -58,7 +58,7 @@ class DockerReadmeTestCase(test.TestCase):
rally_releases = self.get_rally_releases()
latest_release = rally_releases[0]
previous_release = rally_releases[1]
print(rally_releases)
print("All discovered releases: %s" % ",".join(rally_releases))
found = False
for i, line in enumerate(readme.split("\n"), 1):

View File

@ -39,6 +39,7 @@ prettytable==0.7.2
pyasn1==0.4.2
pycparser==2.18
pyinotify==0.9.6
Pygments==2.3.1;python_version=='3.4'
PyNaCl==1.2.1
pyOpenSSL==18.0.0
pyparsing==2.2.0