This commit is contained in:
Nunzio Andrea Galante 2017-03-02 13:49:01 +00:00
parent 5ae31bfffd
commit 1ec0af6eb3
5 changed files with 30 additions and 5 deletions

View File

@ -243,16 +243,27 @@ public class AnsibleBridge {
if(pkg!=null) { if(pkg!=null) {
roles.addAll(pkg.getRoles(this.getTemplateManager())); roles.addAll(pkg.getRoles(this.getTemplateManager()));
} }
} else if("custom".equalsIgnoreCase(d.getType())) { } else if("custom".equalsIgnoreCase(d.getType())) {
CustomDependencyPackage pkg = new CustomDependencyPackage(d); CustomDependencyPackage pkg = new CustomDependencyPackage(d);
if(pkg!=null) { if(pkg!=null) {
roles.addAll(pkg.getRoles(this.getCustomRoleManager())); roles.addAll(pkg.getRoles(this.getCustomRoleManager()));
} }
} else if("cran".equalsIgnoreCase(d.getType())) { }
else if("github".equalsIgnoreCase(d.getType())) {
CranDependencyPackage pkg = new CranDependencyPackage(d);
if(pkg!=null) {
roles.addAll(pkg.getRoles(this.getTemplateManager()));
}
}
else if("cran".equalsIgnoreCase(d.getType())) {
CranDependencyPackage pkg = new CranDependencyPackage(d); CranDependencyPackage pkg = new CranDependencyPackage(d);
if(pkg!=null) { if(pkg!=null) {
roles.addAll(pkg.getRoles(this.getTemplateManager())); roles.addAll(pkg.getRoles(this.getTemplateManager()));
} }
} }
return roles; return roles;
} }

View File

@ -33,7 +33,7 @@ public class AlgorithmPackage {
String deps = ""; String deps = "";
for(Dependency d:a.getDependencies()) { for(Dependency d:a.getDependencies()) {
deps+=String.format("- { role: %s }\n", d.getType()+"-"+d.getName()); deps+=String.format("- { role: %s }\n", d.getType()+"-"+d.getName().replaceAll("/", "-"));
} }
deps = deps.trim(); deps = deps.trim();
out.put("dependencies", deps); out.put("dependencies", deps);

View File

@ -31,7 +31,7 @@ public class DependencyPackage {
public Collection<Role> getRoles(TemplateManager tm) { public Collection<Role> getRoles(TemplateManager tm) {
Collection<Role> out = new Vector<>(); Collection<Role> out = new Vector<>();
for(String mode:new String[]{"add"}) { // "remove", "update" for(String mode:new String[]{"add"}) { // "remove", "update"
String roleName = this.getDependency().getType()+"-"+this.getDependency().getName()+("add".equals(mode) ? "" : "-"+mode); String roleName = this.getDependency().getType()+"-"+this.getDependency().getName().replaceAll("/", "-")+("add".equals(mode) ? "" : "-"+mode);
try { try {
// find template // find template
Role template = tm.getRoleTemplate(this.getDependency().getType()+"-package-"+mode); Role template = tm.getRoleTemplate(this.getDependency().getType()+"-package-"+mode);

View File

@ -215,6 +215,20 @@ public class AlgorithmPackageParser {
List<String> gitdependencies = extractMultipleValues(metadata, "github");
if (gitdependencies != null) {
for (String pkg : gitdependencies) {
Dependency dep = new Dependency();
//if (pkg.startsWith("os:")){
dep.setName(pkg);
dep.setType("github");
out.addDependency(dep);
}
}
List<String> cdependencies = extractMultipleValues(metadata, "custom"); List<String> cdependencies = extractMultipleValues(metadata, "custom");
if (cdependencies != null) { if (cdependencies != null) {
for (String pkg : cdependencies) { for (String pkg : cdependencies) {

View File

@ -97,7 +97,7 @@ public class RestPoolManager implements PoolManager {
ScopeProvider.instance.set("/gcube/devNext/NextNext"); ScopeProvider.instance.set("/gcube/devNext/NextNext");
a.addAlgorithmToVRE( a.addAlgorithmToVRE(
"http://data.d4science.org/cXhJV0s4b3dUN05jZk9qTytQTndqdmVUdURLOTRHeHpHbWJQNStIS0N6Yz0", "http://data.d4science.org/S2h1RHZGd0JpWnBjZk9qTytQTndqcDRLVHNrQUt6QjhHbWJQNStIS0N6Yz0",
"/gcube/devNext/NextNext", "/gcube/devNext/NextNext",
null, null, "test", "transducerers", "N"); null, null, "test", "transducerers", "N");