From 3311ac84af5cd57a54d71fdd275b00c9cee3040f Mon Sep 17 00:00:00 2001 From: Ilya Kharin Date: Thu, 15 Sep 2016 20:16:42 +0300 Subject: [PATCH] Allow to use manageonly releases for preupgrades The Liberty releases are marked as manageonly but they have to be applied for compute nodes. Change-Id: I81c3b87522b6c6463a54be2ca6fca8d91847eb4d Related-Bug: #1624041 --- octane/commands/preupgrade_compute.py | 5 +++-- octane/tests/test_preupgrade_compute.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/octane/commands/preupgrade_compute.py b/octane/commands/preupgrade_compute.py index 84df50ec..19e1a0df 100644 --- a/octane/commands/preupgrade_compute.py +++ b/octane/commands/preupgrade_compute.py @@ -25,9 +25,10 @@ LOG = logging.getLogger(__name__) def check_sanity(nodes, release): - if release.data['state'] != 'available': + if release.data['state'] not in ('available', 'manageonly'): raise Exception( - "Release with id {0} is not available.".format(release.id) + "Release with id {0} is not available (at least manageonly)." + .format(release.id) ) env_id = nodes[0].env.id diff --git a/octane/tests/test_preupgrade_compute.py b/octane/tests/test_preupgrade_compute.py index 2821368b..3168175a 100644 --- a/octane/tests/test_preupgrade_compute.py +++ b/octane/tests/test_preupgrade_compute.py @@ -81,6 +81,7 @@ def test_preupgrade_compute(mocker, release_id, node_ids, env_id, version): @pytest.mark.parametrize("release_id,node_ids,env_ids,roles,state,err", [ (1, [1, 2], [1, 1], ["compute", "compute"], "available", None), + (1, [1, 2], [1, 1], ["compute", "compute"], "manageonly", None), (1, [1, 3], [1, 1], ["compute", "compute"], "unavailable", Exception), (1, [1, 2], [1, 2], ["compute", "compute"], "available", Exception), (1, [1, 2], [1, 1], ["compute", "controller"], "available", Exception), @@ -102,8 +103,8 @@ def test_check_sanity(release_id, node_ids, env_ids, roles, state, err): with pytest.raises(err) as exc_info: preupgrade_compute.check_sanity(node_list, release) if state != "available": - assert "Release with id {0} is not available.".format(release_id)\ - in exc_info.value.args[0] + assert "Release with id {0} is not available (at least " \ + "manageonly).".format(release_id) in exc_info.value.args[0] elif env_ids[0] != env_ids[1]: assert "Nodes have different clusters." in exc_info.value.args[0] else: