summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Kearney <bkearney@redhat.com>2010-02-01 12:24:01 -0500
committerBryan Kearney <bkearney@redhat.com>2010-02-01 12:24:01 -0500
commit2ae7516d77c57c2c26c7afca1e8b825f307887c1 (patch)
tree91d8738a428801d8e30768fd9de021f3082ea684
parent55f6239d8efeb08e5a3d99c70257f9979432c16d (diff)
downloadpuppet-2ae7516d77c57c2c26c7afca1e8b825f307887c1.tar.gz
puppet-2ae7516d77c57c2c26c7afca1e8b825f307887c1.tar.xz
puppet-2ae7516d77c57c2c26c7afca1e8b825f307887c1.zip
2047: Add a not_include into match
-rw-r--r--lib/puppet/provider/augeas/augeas.rb4
-rw-r--r--lib/puppet/type/augeas.rb1
-rw-r--r--spec/unit/provider/augeas/augeas.rb10
3 files changed, 15 insertions, 0 deletions
diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb
index 8dccb4e9d..ac11bbf28 100644
--- a/lib/puppet/provider/augeas/augeas.rb
+++ b/lib/puppet/provider/augeas/augeas.rb
@@ -39,6 +39,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do
"match" => [ :path, :glob ],
"size" => [:comparator, :int],
"include" => [:string],
+ "not_include" => [:string],
"==" => [:glob],
"!=" => [:glob]
}
@@ -206,6 +207,9 @@ Puppet::Type.type(:augeas).provide(:augeas) do
when "include"
arg = clause_array.shift
return_value = result.include?(arg)
+ when "not_include"
+ arg = clause_array.shift
+ return_value = !result.include?(arg)
when "=="
begin
arg = clause_array.shift
diff --git a/lib/puppet/type/augeas.rb b/lib/puppet/type/augeas.rb
index 4ae3f06e1..cfd1da55b 100644
--- a/lib/puppet/type/augeas.rb
+++ b/lib/puppet/type/augeas.rb
@@ -71,6 +71,7 @@ Puppet::Type.newtype(:augeas) do
get [AUGEAS_PATH] [COMPARATOR] [STRING]
match [MATCH_PATH] size [COMPARATOR] [INT]
match [MATCH_PATH] include [STRING]
+ match [MATCH_PATH] not_include [STRING]
match [MATCH_PATH] == [AN_ARRAY]
match [MATCH_PATH] != [AN_ARRAY]
diff --git a/spec/unit/provider/augeas/augeas.rb b/spec/unit/provider/augeas/augeas.rb
index 3b9bd2c95..89d3f503b 100644
--- a/spec/unit/provider/augeas/augeas.rb
+++ b/spec/unit/provider/augeas/augeas.rb
@@ -204,6 +204,16 @@ describe provider_class do
@provider.process_match(command).should == false
end
+ it "should return true for includes match" do
+ command = ["match", "fake value", "not_include JarJar"]
+ @provider.process_match(command).should == true
+ end
+
+ it "should return false for includes non match" do
+ command = ["match", "fake value", "not_include values"]
+ @provider.process_match(command).should == false
+ end
+
it "should return true for an array match" do
command = ["match", "fake value", "== ['set', 'of', 'values']"]
@provider.process_match(command).should == true