Search in sources :

Example 1 with ConfigurePackage

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);
}
Also used : ConfigurePackage(org.platformlayer.images.model.ConfigurePackage)

Example 2 with 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());
        }
    });
}
Also used : ConfigurePackage(org.platformlayer.images.model.ConfigurePackage) Repository(org.platformlayer.images.model.Repository) DiskImageRecipe(org.platformlayer.images.model.DiskImageRecipe) RepositoryKey(org.platformlayer.images.model.RepositoryKey)

Example 3 with ConfigurePackage

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);
}
Also used : ConfigurePackage(org.platformlayer.images.model.ConfigurePackage)

Example 4 with ConfigurePackage

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));
}
Also used : ConfigurePackage(org.platformlayer.images.model.ConfigurePackage) File(java.io.File)

Example 5 with ConfigurePackage

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);
}
Also used : ConfigurePackage(org.platformlayer.images.model.ConfigurePackage)

Aggregations

ConfigurePackage (org.platformlayer.images.model.ConfigurePackage)5 File (java.io.File)1 DiskImageRecipe (org.platformlayer.images.model.DiskImageRecipe)1 Repository (org.platformlayer.images.model.Repository)1 RepositoryKey (org.platformlayer.images.model.RepositoryKey)1