diff options
-rw-r--r-- | lib/puppet/provider/augeas/augeas.rb | 10 | ||||
-rw-r--r-- | lib/puppet/type/augeas.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/augeas/augeas.rb | 8 |
3 files changed, 11 insertions, 11 deletions
diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index 8e5d63030..de52c1292 100644 --- a/lib/puppet/provider/augeas/augeas.rb +++ b/lib/puppet/provider/augeas/augeas.rb @@ -39,8 +39,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do "match" => [ :path, :glob ], "size" => [:comparator, :int], "include" => [:string], - "eq" => [:glob], - "noteq" => [:glob] + "==" => [:glob], + "!=" => [:glob] } COMMANDS["ins"] = COMMANDS["insert"] @@ -68,7 +68,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do data.each do |line| argline = [] sc = StringScanner.new(line) - cmd = sc.scan(/\w+/) + cmd = sc.scan(/\w+|==|!=/) formals = COMMANDS[cmd] fail("Unknown command #{cmd}") unless formals argline << cmd @@ -203,7 +203,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do when "include" arg = clause_array.shift return_value = result.include?(arg) - when "eq" + when "==" begin arg = clause_array.shift new_array = eval arg @@ -211,7 +211,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do rescue fail("Invalid array in command: #{cmd_array.join(" ")}") end - when "noteq" + when "!=" begin arg = clause_array.shift new_array = eval arg diff --git a/lib/puppet/type/augeas.rb b/lib/puppet/type/augeas.rb index c4ed88df5..4ae3f06e1 100644 --- a/lib/puppet/type/augeas.rb +++ b/lib/puppet/type/augeas.rb @@ -71,8 +71,8 @@ Puppet::Type.newtype(:augeas) do get [AUGEAS_PATH] [COMPARATOR] [STRING] match [MATCH_PATH] size [COMPARATOR] [INT] match [MATCH_PATH] include [STRING] - match [MATCH_PATH] eq [AN_ARRAY] - match [MATCH_PATH] noteq [AN_ARRAY] + match [MATCH_PATH] == [AN_ARRAY] + match [MATCH_PATH] != [AN_ARRAY] where:: diff --git a/spec/unit/provider/augeas/augeas.rb b/spec/unit/provider/augeas/augeas.rb index 1bec3a45f..c8b370f12 100644 --- a/spec/unit/provider/augeas/augeas.rb +++ b/spec/unit/provider/augeas/augeas.rb @@ -178,22 +178,22 @@ describe provider_class do end it "should return true for an array match" do - command = ["match", "fake value", "eq ['set', 'of', 'values']"] + command = ["match", "fake value", "== ['set', 'of', 'values']"] @provider.process_match(command).should == true end it "should return false for an array non match" do - command = ["match", "fake value", "eq ['this', 'should', 'not', 'match']"] + command = ["match", "fake value", "== ['this', 'should', 'not', 'match']"] @provider.process_match(command).should == false end it "should return false for an array match with noteq" do - command = ["match", "fake value", "noteq ['set', 'of', 'values']"] + command = ["match", "fake value", "!= ['set', 'of', 'values']"] @provider.process_match(command).should == false end it "should return true for an array non match with noteq" do - command = ["match", "fake value", "noteq ['this', 'should', 'not', 'match']"] + command = ["match", "fake value", "!= ['this', 'should', 'not', 'match']"] @provider.process_match(command).should == true end end |