forked from rpms/leapp-repository
		
	
		
			
				
	
	
		
			56 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From e10968202016575ed4431f67a09ab7a3aef8dfcc Mon Sep 17 00:00:00 2001
 | |
| From: Petr Stodulka <pstodulk@redhat.com>
 | |
| Date: Wed, 18 Sep 2024 00:40:25 +0200
 | |
| Subject: [PATCH 45/53] fix(pes_events_scanner): ensure output contains no
 | |
|  duplicates
 | |
| 
 | |
| RpmTransactionTasks messages have higher priority than instructions
 | |
| based on PES data. Previously, if multiple such messages existed
 | |
| with duplicate instructions, this could lead to the crash of
 | |
| the actor - especially in case when an existing package has been
 | |
| asked to be removed several times. Ensure the occurance of each
 | |
| instruction is unique (list -> set).
 | |
| 
 | |
| jira: RHEL-50076
 | |
| ---
 | |
|  .../libraries/pes_events_scanner.py             | 17 ++++++++++-------
 | |
|  1 file changed, 10 insertions(+), 7 deletions(-)
 | |
| 
 | |
| diff --git a/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py b/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py
 | |
| index f5cb2613..a798017f 100644
 | |
| --- a/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py
 | |
| +++ b/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py
 | |
| @@ -78,19 +78,22 @@ def get_installed_pkgs():
 | |
|  
 | |
|  def get_transaction_configuration():
 | |
|      """
 | |
| -    Get pkgs to install, keep and remove from the user configuration files in /etc/leapp/transaction/.
 | |
| +    Get pkgs to install, keep and remove from RpmTransactionTasks messages.
 | |
|  
 | |
| -    These configuration files have higher priority than PES data.
 | |
| -    :return: RpmTransactionTasks model instance
 | |
| +    Note these messages reflects inputs from various actors and configuration
 | |
| +    files in /etc/leapp/transaction/. As these are explicit instruction, they
 | |
| +    have higher priority than instructions from PES data.
 | |
| +
 | |
| +    :return: TransactionConfiguration
 | |
|      """
 | |
| -    transaction_configuration = TransactionConfiguration(to_install=[], to_remove=[], to_keep=[])
 | |
| +    transaction_configuration = TransactionConfiguration(to_install=set(), to_remove=set(), to_keep=set())
 | |
|  
 | |
|      _Pkg = partial(Package, repository=None, modulestream=None)
 | |
|  
 | |
|      for tasks in api.consume(RpmTransactionTasks):
 | |
| -        transaction_configuration.to_install.extend(_Pkg(name=pkg_name) for pkg_name in tasks.to_install)
 | |
| -        transaction_configuration.to_remove.extend(_Pkg(name=pkg_name) for pkg_name in tasks.to_remove)
 | |
| -        transaction_configuration.to_keep.extend(_Pkg(name=pkg_name) for pkg_name in tasks.to_keep)
 | |
| +        transaction_configuration.to_install.update(_Pkg(name=pkg_name) for pkg_name in tasks.to_install)
 | |
| +        transaction_configuration.to_remove.update(_Pkg(name=pkg_name) for pkg_name in tasks.to_remove)
 | |
| +        transaction_configuration.to_keep.update(_Pkg(name=pkg_name) for pkg_name in tasks.to_keep)
 | |
|      return transaction_configuration
 | |
|  
 | |
|  
 | |
| -- 
 | |
| 2.47.1
 | |
| 
 |