
    eo                     N    d dl Z d dlmZ d dlmZ d dlmZ  G d de          ZdS )    N)errors)SubCommandBase)
bool_inputc                   (    e Zd ZdZd Z	 ddZd ZdS )BulkActionCommandNc           	      <   | j         j        D ]}	 |j        r9|                     |j        | j         j        |j        |j        |j        |           n|j	        r4|                     |j        | j         j        |j        |j        |           nP|j
        r.|                     |j        | j         j        |j        |           n| j                            d|           # t          j        $ r- | j         j        r| j                            dd           Y 
 w xY wd S )N)specz!Invalid package specification: %s T)exc_info)argsspecs	_filenameexec_bulk_actionchannelfamilypackageversionfilename_version_packagelogerrorr   NotFoundforcewarning)selfr	   s     =lib/python3.11/site-packages/repo_cli/commands/bulk_action.pymainzBulkActionCommand.main   s[   IO 	 	D> N))	(    ] N))	(! *     ] N))di&64 *     HNN#FMMM?   9? H$$R$$777H5	 	s   CC7DDc           	      >   ||d}d}t          | j        d          r| j        j        }	|	s	 |	rd|	z  }g }
|s|r| j                            |||||          \  }}|s| j                            d|z             d S g }|D ]Q}|                     dj        di |           t          |          }|d         |d<   |
                    |           Rd
                    |          }d	| j        d
|d|d|d	}nd| j        d|d}|g}
t          | j        dd          }|st          |d          rG| j                            || j        |
|	           | j                            d| j        z             d S | j                            d| j        z             d S )N)namer   r
   destinationzto channel %s z6No files matches were found for the provided spec: %s
zFPACKAGE: {name}:{version}-{ckey}; PLATFORM: {platform}; FILENAME: {fn}ckey
zAre you sure you want to z the package release  z%? The following will be affected: 

 z


Confirm?zConform action z	 on spec z ? (and all data with it?)r   F)target_channelz%s action successful
z%s action not executed
 )hasattrr   r!   apiget_channel_artifacts_filesr   r   appendformatdictjoinr    getattrr   channel_artifacts_bulk_actionsinfo)r   r   r   artifactr   r   r	   	base_itemtarget_descriptionr%   itemspackagestotal_countfiles_descrfilepitemaffected_filesmsgr   s                      r   r   z"BulkActionCommand.exec_bulk_action.   sK    
 
	
  49m,, 	G!Y2N!  G%5%F" "	 h "	 $(H$H$H7H% %!Hk    MQUV   K! # #""c\c     
 I$V}VT""""!YY{33NN
 999000$$$H C1"	 > 			C KE	7E22 	BJsE** 	BH33E. 4    HMM2TY>?????HMM4ty@AAAAA    c                     t           )N)NotImplementedError)r   
subparserss     r   
add_parserzBulkActionCommand.add_parserk   s    !!r<   )NNN)__name__
__module____qualname__r    r   r   r@   r&   r<   r   r   r      sX        D! ! !H LP;B ;B ;B ;Bz" " " " "r<   r   )sysrepo_clir   repo_cli.commands.baser   repo_cli.utilsr   r   r&   r<   r   <module>rH      s    



       1 1 1 1 1 1 % % % % % %d" d" d" d" d" d" d" d" d" d"r<   