protected Providers getImageProviders(String version, String deploymentName) { Providers providers; try (InputStream is = profileRegistry.readProfile(getArtifact().getName(), version, "images.yml")) { Object obj = yamlParser.load(is); providers = objectMapper.convertValue(obj, Providers.class); } catch (IOException e) { throw new HalException(Problem.Severity.FATAL, "Unable to read images.yml for rosco: " + e.getMessage(), e); } File f = halconfigDirectoryStructure.getUserProfilePath(deploymentName).resolve("images-local.yml").toFile(); Providers localProviders = null; if (f.exists()) { // Need just the $PROVIDER.bakeryDefaults.baseImages list items to merge in with the content from rosco/halconfig/images.yml. try (FileInputStream fis = new FileInputStream(f)) { Object localObj = yamlParser.load(fis); localProviders = objectMapper.convertValue(localObj, Providers.class); } catch (IOException e) { throw new HalException(Problem.Severity.FATAL, "Unable to read images-local.yml for rosco: " + e.getMessage(), e); } } if (localProviders != null) { augmentProvidersBaseImages(providers, localProviders); } return providers; }
protected Providers getImageProviders(String version, String deploymentName) { Providers providers; try (InputStream is = profileRegistry.readProfile(getArtifact().getName(), version, "images.yml")) { Object obj = yamlParser.load(is); providers = objectMapper.convertValue(obj, Providers.class); } catch (IOException e) { throw new HalException(Problem.Severity.FATAL, "Unable to read images.yml for rosco: " + e.getMessage(), e); } File f = halconfigDirectoryStructure.getUserProfilePath(deploymentName).resolve("images-local.yml").toFile(); Providers localProviders = null; if (f.exists()) { // Need just the $PROVIDER.bakeryDefaults.baseImages list items to merge in with the content from rosco/halconfig/images.yml. try (FileInputStream fis = new FileInputStream(f)) { Object localObj = yamlParser.load(fis); localProviders = objectMapper.convertValue(localObj, Providers.class); } catch (IOException e) { throw new HalException(Problem.Severity.FATAL, "Unable to read images-local.yml for rosco: " + e.getMessage(), e); } } if (localProviders != null) { augmentProvidersBaseImages(providers, localProviders); } return providers; }
@Override protected Profile getBaseProfile(String name, String version, String outputFile) { try { return new Profile(name, version, outputFile, IOUtils.toString(profileRegistry.readProfile(getArtifact().getName(), version, name)) ); } catch (RetrofitError | IOException e) { throw new HalException( new ConfigProblemBuilder(FATAL, "Unable to retrieve profile \"" + name + "\": " + e.getMessage()) .build(), e ); } } }
@Override protected Profile getBaseProfile(String name, String version, String outputFile) { try { return new Profile(name, version, outputFile, IOUtils.toString(profileRegistry.readProfile(getArtifact().getName(), version, name)) ); } catch (RetrofitError | IOException e) { throw new HalException( new ConfigProblemBuilder(FATAL, "Unable to retrieve profile \"" + name + "\": " + e.getMessage()) .build(), e ); } } }