use of org.platformlayer.images.model.ConfigurePackage in project platformlayer by platformlayer.
the class DiskImageRecipeBuilder method addPreconfigure.
public static void addPreconfigure(DiskImageRecipe recipe, String packageName, String key, String type, String value) {
ConfigurePackage configurePackage = new ConfigurePackage();
configurePackage.setPackageName(packageName);
configurePackage.setKey(key);
configurePackage.setType(type);
configurePackage.setValue(value);
recipe.getConfigurePackage().add(configurePackage);
}
use of org.platformlayer.images.model.ConfigurePackage in project platformlayer by platformlayer.
the class DiskImageRecipeBuilder method removeDetails.
protected void removeDetails() {
DiskImageRecipe recipe = getRecipe();
final Set<String> whitelistPackages = Sets.newHashSet();
final Set<String> whitelistRepos = Sets.newHashSet();
final Set<String> whitelistRepositoryKeys = Sets.newHashSet();
// whitelistPackages.add("openjdk-7-jre");
Iterables.removeIf(recipe.getAddPackage(), new Predicate<String>() {
@Override
public boolean apply(String input) {
return !whitelistPackages.contains(input);
}
});
Iterables.removeIf(recipe.getRepositoryKey(), new Predicate<RepositoryKey>() {
@Override
public boolean apply(RepositoryKey input) {
return !whitelistRepositoryKeys.contains(input.getUrl());
}
});
Iterables.removeIf(recipe.getRepository(), new Predicate<Repository>() {
@Override
public boolean apply(Repository input) {
return !whitelistRepos.contains(input.getKey());
}
});
Iterables.removeIf(recipe.getConfigurePackage(), new Predicate<ConfigurePackage>() {
@Override
public boolean apply(ConfigurePackage input) {
return !whitelistPackages.contains(input.getPackageName());
}
});
}
use of org.platformlayer.images.model.ConfigurePackage in project platformlayer by platformlayer.
the class DiskImageController method preconfigurePackages.
private void preconfigurePackages(OpsTarget target, List<ConfigurePackage> configurePackages) throws OpsException, IOException {
if (configurePackages == null || configurePackages.isEmpty()) {
return;
}
List<ConfigurePackage> list = Lists.newArrayList();
for (ConfigurePackage configurePackage : configurePackages) {
ConfigurePackage model = new ConfigurePackage();
model.setPackageName(configurePackage.packageName);
model.setType(configurePackage.type);
model.setKey(configurePackage.key);
model.setValue(configurePackage.value);
list.add(model);
}
apt.preconfigurePackages(target, list);
}
use of org.platformlayer.images.model.ConfigurePackage in project platformlayer by platformlayer.
the class AptPackageManager method preconfigurePackages.
public void preconfigurePackages(OpsTarget target, List<ConfigurePackage> settings) throws OpsException {
File preseedTmpDir = target.createTempDir();
StringBuilder sb = new StringBuilder();
for (ConfigurePackage conf : settings) {
String confType = conf.getType();
if (confType == null) {
confType = "string";
}
String line = conf.getPackageName() + "\t" + conf.getKey() + "\t" + conf.getType() + "\t" + conf.getValue() + "\n";
sb.append(line);
}
File preseedFile = new File(preseedTmpDir, "misc.preseed");
FileUpload.upload(target, preseedFile, sb.toString());
target.executeCommand(Command.build("cat {0} | debconf-set-selections", preseedFile));
}
use of org.platformlayer.images.model.ConfigurePackage in project platformlayer by platformlayer.
the class PackageDependency method addConfiguration.
public void addConfiguration(String packageName, String key, String type, String value) {
if (configuration == null) {
configuration = Lists.newArrayList();
}
ConfigurePackage conf = new ConfigurePackage();
conf.setKey(key);
conf.setValue(value);
conf.setType(type);
conf.setPackageName(packageName);
configuration.add(conf);
}
Aggregations