Search in sources :

Example 1 with ParseConfigException

use of com.netflix.spinnaker.halyard.config.error.v1.ParseConfigException in project halyard by spinnaker.

the class HalconfigParser method getHalconfig.

/**
 * Returns the current halconfig stored at the halconfigPath.
 *
 * @return the fully parsed halconfig.
 * @see Halconfig
 */
public Halconfig getHalconfig() {
    Halconfig local = (Halconfig) DaemonTaskHandler.getContext();
    if (local == null) {
        try {
            InputStream is = getHalconfigStream();
            local = parseHalconfig(is);
        } catch (FileNotFoundException ignored) {
        // leave res as `null`
        } catch (ParserException e) {
            throw new ParseConfigException(e);
        } catch (ScannerException e) {
            throw new ParseConfigException(e);
        } catch (IllegalArgumentException e) {
            throw new ParseConfigException(e);
        }
    }
    local = transformHalconfig(local);
    DaemonTaskHandler.setContext(local);
    return local;
}
Also used : ScannerException(org.yaml.snakeyaml.scanner.ScannerException) ParserException(org.yaml.snakeyaml.parser.ParserException) ParseConfigException(com.netflix.spinnaker.halyard.config.error.v1.ParseConfigException) Halconfig(com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig) ByteArrayInputStream(java.io.ByteArrayInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

ParseConfigException (com.netflix.spinnaker.halyard.config.error.v1.ParseConfigException)1 Halconfig (com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 ParserException (org.yaml.snakeyaml.parser.ParserException)1 ScannerException (org.yaml.snakeyaml.scanner.ScannerException)1