Permalink
Browse files

allow yaml aliases when loading yaml files

  • Loading branch information...
1 parent 5ed9261 commit 0bfe1501957426bc9d5d428d76fc21aa4154b617 David Sabeti and Dmitriy Kalinin committed Mar 29, 2013
Showing with 24 additions and 0 deletions.
  1. +3 −0 bosh_cli/lib/cli/yaml_helper.rb
  2. +21 −0 bosh_cli/spec/unit/yaml_helper_spec.rb
@@ -11,6 +11,9 @@ def process_object(o)
when Psych::Nodes::Sequence
process_sequence(o)
when Psych::Nodes::Scalar
+ # noop
+ when Psych::Nodes::Alias
+ # noop
else
err("Unhandled class #{o.class}, fix yaml duplicate check")
end
@@ -0,0 +1,21 @@
+# Copyright (c) 2009-2012 VMware, Inc.
+
+require "spec_helper"
+
+describe Bosh::Cli::YamlHelper do
+ subject { Bosh::Cli::YamlHelper }
+
+ describe "#check_duplicate_keys" do
+ context "when yaml contains anchors" do
+ it "does not raise an error" do
+ subject.check_duplicate_keys("key1: &key1")
+ end
+ end
+
+ context "when yaml contains aliases" do
+ it "does not raise an error" do
+ subject.check_duplicate_keys("key1: *key1")
+ end
+ end
+ end
+end

0 comments on commit 0bfe150

Please sign in to comment.