package org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.template; import java.util.Collection; import java.util.NoSuchElementException; import java.util.Vector; import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency; ***REMOVED*** public class CustomDependencyPackage extends DependencyPackage { ***REMOVED*** public CustomDependencyPackage(Dependency dependency) { super(dependency); ***REMOVED*** ***REMOVED*** private String getCustomRepositoryLocation(String ansibleRoot) { ***REMOVED*** return ansibleRoot+"/custom"; ***REMOVED*** ***REMOVED*** /* public void serializeTo(String ansibleRoot) { for(String mode:new String[]{"add", "remove", "update"***REMOVED***) { ***REMOVED*** look for roles in the 'custom' repository try { ***REMOVED*** role name String roleName = this.getDependency().getType()+"-"+this.getDependency().getName()+("add".equals(mode) ? "" : "-"+mode); ***REMOVED*** look for the custom role File src = new File(this.getCustomRepositoryLocation(ansibleRoot)+"/"+roleName); System.out.println("** CUSTOM ** " + src); if(src.exists()) { ***REMOVED*** do copy System.out.println("copying CUSTOM role"); File dest = new File(ansibleRoot+"/work/"+roleName); FileUtils.copyDirectory(src, dest); ***REMOVED*** ***REMOVED*** catch(IOException e) { e.printStackTrace(); ***REMOVED*** ***REMOVED*** ***REMOVED*** */ public Collection getRoles(CustomRoleManager crm) { Collection out = new Vector<>(); ***REMOVED*** for(String mode:new String[]{"add", "remove", "update"***REMOVED***) { for(String mode:new String[]{"add"***REMOVED***) { ***REMOVED*** "remove", "update" ***REMOVED*** role name String roleName = this.getDependency().getType()+"-"+this.getDependency().getName()+("add".equals(mode) ? "" : "-"+mode); try { ***REMOVED*** look for custom role Role role = crm.getRole(roleName); if(role!=null) { out.add(role); ***REMOVED*** ***REMOVED*** catch (NoSuchElementException e) { ***REMOVED*** e.printStackTrace(); this.logger.warn("WARNING: no custom role found for " + roleName); ***REMOVED*** ***REMOVED*** return out; ***REMOVED*** ***REMOVED***