From d4903676349b08c881a8785f92c2c24dede89e58 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Thu, 25 Aug 2022 10:23:41 +0100
Subject: [PATCH] Fix IP allocation limit in overcloud inventory discover

After generating an inventory file in 'kayobe overcloud inventory
discover', the IP allocation playbook runs to allocate IP addresses for
the new hosts. Currently this runs without a limit, meaning it targets
all hosts. This change fixes it to use a limit of overcloud.

TrivialFix

Change-Id: Ic3a98fb9e741a2dea792b2e6cf6a6ff802d099a2
---
 kayobe/cli/commands.py                 | 3 ++-
 kayobe/tests/unit/cli/test_commands.py | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/kayobe/cli/commands.py b/kayobe/cli/commands.py
index a0007d88..315c787b 100644
--- a/kayobe/cli/commands.py
+++ b/kayobe/cli/commands.py
@@ -993,7 +993,8 @@ class OvercloudInventoryDiscover(KayobeAnsibleMixin, VaultMixin, Command):
                                      "overcloud-inventory-discover"))
         # If necessary, allocate IP addresses for the discovered hosts.
         self.run_kayobe_playbook(parsed_args,
-                                 _get_playbook_path("ip-allocation"))
+                                 _get_playbook_path("ip-allocation"),
+                                 limit="overcloud")
         # Now populate the Kolla Ansible inventory.
         self.generate_kolla_ansible_config(parsed_args, service_config=False)
 
diff --git a/kayobe/tests/unit/cli/test_commands.py b/kayobe/tests/unit/cli/test_commands.py
index 76c43343..d4b5ba0e 100644
--- a/kayobe/tests/unit/cli/test_commands.py
+++ b/kayobe/tests/unit/cli/test_commands.py
@@ -1170,6 +1170,7 @@ class TestCase(unittest.TestCase):
             mock.call(
                 mock.ANY,
                 utils.get_data_files_path("ansible", "ip-allocation.yml"),
+                limit="overcloud",
             ),
         ]
         self.assertEqual(expected_calls, mock_run_one.call_args_list)
-- 
GitLab