From 1d64a678d31829051444e1bf29d86f800e13de39 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 22 Aug 2022 10:15:46 -0400
Subject: [PATCH] virt-install: Reuse cli.fail_conflicting

For the --unattended + --cloud-init conflict

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 tests/test_cli.py       | 2 +-
 virtinst/virtinstall.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/test_cli.py b/tests/test_cli.py
index cbeebd46..9d4e5ae3 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1116,7 +1116,7 @@ c.add_invalid("--disk none --boot network --machine foobar", grep="domain type N
 c.add_invalid("--nodisks --boot network --arch mips --virt-type kvm", grep="any virtualization options for architecture 'mips'")
 c.add_invalid("--nodisks --boot network --paravirt --arch mips", grep=" 'xen' for architecture 'mips'")
 c.add_invalid("--osinfo generic --launchSecurity sev --connect " + utils.URIs.kvm_amd_sev, grep="SEV launch security requires a Q35 UEFI machine")
-c.add_invalid("--disk none --cloud-init --unattended --install fedora30", grep="--unattended and --cloud-init can not")
+c.add_invalid("--disk none --cloud-init --unattended --install fedora30", grep="Cannot use --unattended and --cloud-init at the same time")
 
 
 
diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py
index 8260628d..8fcc8ce1 100644
--- a/virtinst/virtinstall.py
+++ b/virtinst/virtinstall.py
@@ -412,7 +412,7 @@ def build_installer(options, guest, installdata):
             extra_args = [installdata.kernel_args]
 
     if options.unattended and options.cloud_init:
-        fail("--unattended and --cloud-init can not be specified together.")
+        cli.fail_conflicting("--unattended", "--cloud-init")
 
     if options.unattended:
         unattended_data = cli.parse_unattended(options.unattended)
-- 
2.37.2.windows.2

