From c0bc73fdc0dd943e2c43d8f3d0c1e949f2d6b3f9 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Aug 28 2023 10:56:49 +0000
Subject: [PATCH 1/2] disable use_bootstrap_image if not requested


Related: https://pagure.io/koji/issue/3872

---

diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py
index 69b262d..bbcab1f 100644
--- a/cli/koji_cli/commands.py
+++ b/cli/koji_cli/commands.py
@@ -1174,6 +1174,8 @@ def anon_handle_mock_config(goptions, session, args):
     if 'mock.bootstrap_image' in buildcfg['extra']:
         opts['use_bootstrap_image'] = True
         opts['bootstrap_image'] = buildcfg['extra']['mock.bootstrap_image']
+    else:
+        opts['use_bootstrap_image'] = False
     if 'mock.use_bootstrap' in buildcfg['extra']:
         opts['use_bootstrap'] = buildcfg['extra']['mock.use_bootstrap']
     if 'mock.module_setup_commands' in buildcfg['extra']:
diff --git a/koji/__init__.py b/koji/__init__.py
index 37fb428..cd8f91f 100644
--- a/koji/__init__.py
+++ b/koji/__init__.py
@@ -1815,6 +1815,8 @@ def genMockConfig(name, arch, managed=False, repoid=None, tag_name=None, **opts)
     if opts.get('bootstrap_image'):
         config_opts['use_bootstrap_image'] = True
         config_opts['bootstrap_image'] = opts['bootstrap_image']
+    else:
+        config_opts['use_bootstrap_image'] = False
     if 'use_bootstrap' in opts:
         config_opts['use_bootstrap'] = bool(opts['use_bootstrap'])
     if 'module_setup_commands' in opts:

From 1f06c98fdaf11dd8ca11af1686d394c90e75f697 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Aug 28 2023 11:04:50 +0000
Subject: [PATCH 2/2] fix tests


---

diff --git a/tests/test_cli/test_mock_config.py b/tests/test_cli/test_mock_config.py
index 60db69c..a70a431 100644
--- a/tests/test_cli/test_mock_config.py
+++ b/tests/test_cli/test_mock_config.py
@@ -98,6 +98,7 @@ config_opts['macros']['%distribution'] = 'Koji Testing'
             'repoid': buildroot_info['repo_id'],
             'tag_name': buildroot_info['tag_name'],
             'tag_macros': {},
+            'use_bootstrap_image': False,
         })
         del opts['topurl']
         anon_handle_mock_config(self.options, self.session, arguments)
@@ -178,6 +179,7 @@ config_opts['macros']['%distribution'] = 'Koji Testing'
             'repoid': 'latest',
             'tag_name': multi_broots[0]['tag_name'],
             'tag_macros': {},
+            'use_bootstrap_image': False,
         })
         del opts['topurl']
         arguments = self.common_args + ['--task', str(task_id),
@@ -391,6 +393,7 @@ config_opts['macros']['%distribution'] = 'Koji Testing'
             'repoid': 101,
             'tag_name': target['build_tag_name'],
             'tag_macros': {},
+            'use_bootstrap_image': False,
         })
         del opts['topdir']
         self.session.getRepo.return_value = {'id': 101}
diff --git a/tests/test_lib/data/mock/internaldev.out b/tests/test_lib/data/mock/internaldev.out
index e9718a1..e3126f1 100644
--- a/tests/test_lib/data/mock/internaldev.out
+++ b/tests/test_lib/data/mock/internaldev.out
@@ -9,6 +9,7 @@ config_opts['root'] = 'ROOTNAME'
 config_opts['rpmbuild_networking'] = False
 config_opts['rpmbuild_timeout'] = 86400
 config_opts['target_arch'] = 'x86_64'
+config_opts['use_bootstrap_image'] = False
 config_opts['use_host_resolv'] = False
 config_opts['yum.conf'] = '[main]\ncachedir=/var/cache/yum\ndebuglevel=1\nlogfile=/var/log/yum.log\nreposdir=/dev/null\nretries=20\nobsoletes=1\ngpgcheck=0\nassumeyes=1\nkeepcache=1\ninstall_weak_deps=0\nstrict=1\n\n# repos\n\n[build]\nname=build\nbaseurl=file:///mnt/koji/repos/TAG/99/x86_64\n'
 
diff --git a/tests/test_lib/data/mock/internaldev2.out b/tests/test_lib/data/mock/internaldev2.out
index 4fd8a07..318d3e8 100644
--- a/tests/test_lib/data/mock/internaldev2.out
+++ b/tests/test_lib/data/mock/internaldev2.out
@@ -9,6 +9,7 @@ config_opts['root'] = 'ROOTNAME'
 config_opts['rpmbuild_networking'] = False
 config_opts['rpmbuild_timeout'] = 86400
 config_opts['target_arch'] = 'x86_64'
+config_opts['use_bootstrap_image'] = False
 config_opts['use_host_resolv'] = False
 config_opts['yum.conf'] = '[main]\ncachedir=/var/cache/yum\ndebuglevel=1\nlogfile=/var/log/yum.log\nreposdir=/dev/null\nretries=20\nobsoletes=1\ngpgcheck=0\nassumeyes=1\nkeepcache=1\ninstall_weak_deps=0\nstrict=1\n\n# repos\n\n[build]\nname=build\nbaseurl=file:///mnt/koji/repos/TAG/99/x86_64\n'
 
diff --git a/tests/test_lib/data/mock/simple.out b/tests/test_lib/data/mock/simple.out
index 1a1587b..b5bb7fd 100644
--- a/tests/test_lib/data/mock/simple.out
+++ b/tests/test_lib/data/mock/simple.out
@@ -8,6 +8,7 @@ config_opts['root'] = 'ROOTNAME'
 config_opts['rpmbuild_networking'] = False
 config_opts['rpmbuild_timeout'] = 86400
 config_opts['target_arch'] = 'x86_64'
+config_opts['use_bootstrap_image'] = False
 config_opts['use_host_resolv'] = False
 config_opts['yum.conf'] = '[main]\ncachedir=/var/cache/yum\ndebuglevel=1\nlogfile=/var/log/yum.log\nreposdir=/dev/null\nretries=20\nobsoletes=1\ngpgcheck=0\nassumeyes=1\nkeepcache=1\ninstall_weak_deps=0\nstrict=1\n\n# repos\n\n[build]\nname=build\nbaseurl=file:///mnt/koji/repos/TAG/99/x86_64\n'
 

