# Copyright (c) 2009-2012 VMware, Inc.

module Bosh::Cli
  class DeploymentManifestCompiler
    attr_accessor :properties

    def initialize(raw_manifest)
      @raw_manifest = raw_manifest
      @properties = {}
    end

    def property(name)
      @properties[name] || raise(UndefinedProperty,
                                 "Cannot resolve deployment property `#{name}'")
    end

    def result
      ERB.new(@raw_manifest, 4).result(binding.taint)
    rescue SyntaxError => e
      raise MalformedManifest,
            "Deployment manifest contains a syntax error\n" + e.to_s
    end
  end

end

# Copyright (c) 2009-2012 VMware, Inc.

module Bosh::Cli
  class DeploymentManifestCompiler
    attr_accessor :properties

    def initialize(raw_manifest)
      @raw_manifest = raw_manifest
      @properties = {}
    end

    def property(name)
      @properties[name] || raise(UndefinedProperty,
                                 "Cannot resolve deployment property `#{name}'")
    end

    def result
      ERB.new(@raw_manifest).result(binding.taint)
    rescue SyntaxError => e
      raise MalformedManifest,
            "Deployment manifest contains a syntax error\n" + e.to_s
    end
  end

end

Remove $SAFE level for ERB parsing
Remove $SAFE level for ERB parsing

$SAFE=4 level was removed from ruby 2.1.1. In general, this SAFE level
does not provide enough security.

Signed-off-by: Maria Shaldibina <a39f51a90bfcf8ca23756ef12127e1cf20796cba@pivotallabs.com>
