Patch nailgun serializer on cluster upgrade handlers
CopyKeys task won't be yielded if get_uids returns empty list. Change-Id: Ifd4589b6a0e9a8e8636fea9a36afa091b230ab11 Closes-bug: 1584658 Closes-bug: 1584041 Related-bug: 1541256
This commit is contained in:
parent
b1fc22b69f
commit
fdafa2666d
|
@ -10,6 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import contextlib
|
||||
import logging
|
||||
import os.path
|
||||
|
||||
|
@ -72,8 +73,11 @@ def upgrade_node(env_id, node_ids, isolated=False, network_template=None,
|
|||
|
||||
call_handlers = upgrade_handlers.get_nodes_handlers(
|
||||
nodes, env, isolated, live_migration)
|
||||
with patch.applied_patch(
|
||||
magic_consts.PUPPET_DIR, *magic_consts.UPGRADE_NODE_PATCHES):
|
||||
with contextlib.nested(
|
||||
docker.patch_container_service(
|
||||
*magic_consts.NAILGUN_SERVICE_PATCHES),
|
||||
patch.applied_patch(
|
||||
magic_consts.PUPPET_DIR, *magic_consts.UPGRADE_NODE_PATCHES)):
|
||||
call_handlers('preupgrade')
|
||||
call_handlers('prepare')
|
||||
env_util.move_nodes(env, nodes, provision, roles)
|
||||
|
|
|
@ -83,3 +83,9 @@ NOVA_PATCH_PREFIX_DIR = '/usr/lib/python2.7/dist-packages/'
|
|||
NOVA_PATCHES = [
|
||||
os.path.join(CWD, "patches/nova.patch"),
|
||||
]
|
||||
NAILGUN_SERVICE_PATCHES = (
|
||||
"nailgun",
|
||||
"nailgun",
|
||||
"/usr/lib/python2.7/site-packages/nailgun/orchestrator/",
|
||||
os.path.join(CWD, "patches/nailgun_serializer.patch")
|
||||
)
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
diff --git a/tasks_serializer.py b/tasks_serializer.py
|
||||
index cee16fa..d90e91d 100644
|
||||
--- a/tasks_serializer.py
|
||||
+++ b/tasks_serializer.py
|
||||
@@ -225,9 +225,7 @@ class CopyKeys(GenericRolesHook):
|
||||
for file_path in self.task['parameters']['files']:
|
||||
file_path['src'] = file_path['src'].format(
|
||||
CLUSTER_ID=self.cluster.id)
|
||||
- uids = self.get_uids()
|
||||
- yield templates.make_generic_task(
|
||||
- uids, self.task)
|
||||
+ return super(CopyKeys, self).serialize()
|
|
@ -15,6 +15,7 @@ import pytest
|
|||
import yaml
|
||||
|
||||
from octane.commands import upgrade_node
|
||||
from octane import magic_consts
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cmd,env,nodes,provision,roles', [
|
||||
|
@ -78,12 +79,16 @@ def test_upgrade_node(mocker, node_ids, isolated, network_template,
|
|||
"octane.commands.upgrade_node.load_network_template")
|
||||
mock_deploy_nodes = mocker.patch("octane.util.env.deploy_nodes")
|
||||
mock_deploy_changes = mocker.patch("octane.util.env.deploy_changes")
|
||||
mock_docker_patch = mocker.patch(
|
||||
"octane.util.docker.patch_container_service")
|
||||
upgrade_node.upgrade_node(test_env_id, node_ids)
|
||||
|
||||
mock_copy_patches.assert_called_once_with()
|
||||
mock_copy_vips.assert_called_once_with(mock_env)
|
||||
mock_move_nodes.assert_called_once_with(mock_env, mock_nodes_list,
|
||||
True, None)
|
||||
mock_docker_patch.assert_called_once_with(
|
||||
*magic_consts.NAILGUN_SERVICE_PATCHES)
|
||||
assert mock_handlers.call_args_list == [
|
||||
mock.call('preupgrade'), mock.call('prepare'),
|
||||
mock.call('predeploy'), mock.call('postdeploy')]
|
||||
|
|
Loading…
Reference in New Issue