private KojiRepairResult . RepairResult doRepair ( String packageType , RemoteRepository repository , KojiBuildInfo buildInfo , String user , boolean isDryRun ) throws KojiRepairException { StoreKey storeKey ; if ( repository != null ) { storeKey = repository . getKey ( ) ; } else { String name = kojiUtils . getRepositoryName ( buildInfo ) ; storeKey = new StoreKey ( packageType , StoreType . remote , name ) ; try { repository = ( RemoteRepository ) storeManager . getArtifactStore ( storeKey ) ; } catch ( IndyDataException e ) { throw new KojiRepairException ( "Cannot get store: %s. Reason: %s" , e , storeKey , e . getMessage ( ) ) ; } } KojiRepairResult . RepairResult repairResult = new KojiRepairResult . RepairResult ( storeKey ) ; String url = repository . getUrl ( ) ; String newUrl ; try { newUrl = kojiUtils . formatStorageUrl ( config . getStorageRootUrl ( ) , buildInfo ) ; // volume is involved } catch ( MalformedURLException e ) { throw new KojiRepairException ( "Failed to format storage Url: %s. Reason: %s" , e , storeKey , e . getMessage ( ) ) ; } boolean changed = ! url . equals ( newUrl ) ; if ( changed ) { repairResult . withPropertyChange ( "url" , url , newUrl ) ; if ( ! isDryRun ) { ChangeSummary changeSummary = new ChangeSummary ( user , "Repair " + storeKey + " url with volume: " + buildInfo . getVolumeName ( ) ) ; repository . setUrl ( newUrl ) ; repository . setMetadata ( METADATA_KOJI_BUILD_ID , Integer . toString ( buildInfo . getId ( ) ) ) ; boolean fireEvents = false ; boolean skipIfExists = false ; try { storeManager . storeArtifactStore ( repository , changeSummary , skipIfExists , fireEvents , new EventMetadata ( ) ) ; } catch ( IndyDataException e ) { throw new KojiRepairException ( "Failed to repair store: %s. Reason: %s" , e , storeKey , e . getMessage ( ) ) ; } } } return repairResult ; }
Repair one remote repository .