Make ostree_installer check if buildinstall is skipped correctly
The _skipped attribute is only set after the buildinstall phase is started. Fixes: #909 Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
		
							parent
							
								
									420b744193
								
							
						
					
					
						commit
						288d9ecc90
					
				| @ -48,12 +48,16 @@ class BuildinstallPhase(PhaseBase): | |||||||
|         self.buildinstall_method = self.compose.conf.get("buildinstall_method") |         self.buildinstall_method = self.compose.conf.get("buildinstall_method") | ||||||
|         self.used_lorax = self.buildinstall_method == 'lorax' |         self.used_lorax = self.buildinstall_method == 'lorax' | ||||||
| 
 | 
 | ||||||
|  |         self.warned_skipped = False | ||||||
|  | 
 | ||||||
|     def skip(self): |     def skip(self): | ||||||
|         if PhaseBase.skip(self): |         if PhaseBase.skip(self): | ||||||
|             return True |             return True | ||||||
|         if not self.compose.conf.get("bootable"): |         if not self.compose.conf.get("bootable"): | ||||||
|  |             if not self.warned_skipped: | ||||||
|                 msg = "Not a bootable product. Skipping buildinstall." |                 msg = "Not a bootable product. Skipping buildinstall." | ||||||
|                 self.compose.log_debug(msg) |                 self.compose.log_debug(msg) | ||||||
|  |                 self.warned_skipped = True | ||||||
|             return True |             return True | ||||||
|         return False |         return False | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ class OstreeInstallerPhase(PhaseLoggerMixin, ConfigGuardedPhase): | |||||||
|     def validate(self): |     def validate(self): | ||||||
|         errors = [] |         errors = [] | ||||||
| 
 | 
 | ||||||
|         if not self.compose.conf['ostree_installer_overwrite'] and not self.bi._skipped: |         if not self.compose.conf['ostree_installer_overwrite'] and not self.bi.skip(): | ||||||
|             for variant in self.compose.get_variants(): |             for variant in self.compose.get_variants(): | ||||||
|                 for arch in variant.arches: |                 for arch in variant.arches: | ||||||
|                     conf = util.get_arch_variant_data(self.compose.conf, self.name, |                     conf = util.get_arch_variant_data(self.compose.conf, self.name, | ||||||
|  | |||||||
| @ -55,7 +55,9 @@ class OstreeInstallerPhaseTest(helpers.PungiTestCase): | |||||||
|             ], |             ], | ||||||
|         }) |         }) | ||||||
| 
 | 
 | ||||||
|         phase = ostree.OstreeInstallerPhase(compose, mock.Mock(_skipped=False)) |         skipmock = mock.Mock() | ||||||
|  |         skipmock.skip.return_value = False | ||||||
|  |         phase = ostree.OstreeInstallerPhase(compose, skipmock) | ||||||
|         with self.assertRaises(ValueError) as ctx: |         with self.assertRaises(ValueError) as ctx: | ||||||
|             phase.validate() |             phase.validate() | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user