summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-08 17:35:18 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-03-08 17:35:18 +0000
commit6ad8998a7edb1027eca7913f2d7bfdf66f81cbf4 (patch)
tree7f222581ad8cd039424bfa15a28f724eb1571726
parent3489bd85669dd06ad0ec06430556aaeb4ba14e5d (diff)
downloadpuppet-6ad8998a7edb1027eca7913f2d7bfdf66f81cbf4.tar.gz
puppet-6ad8998a7edb1027eca7913f2d7bfdf66f81cbf4.tar.xz
puppet-6ad8998a7edb1027eca7913f2d7bfdf66f81cbf4.zip
Adding a bit more testing to the config stuff
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2273 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xlib/puppet/type/pfile/mode.rb5
-rwxr-xr-xtest/util/config.rb13
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/puppet/type/pfile/mode.rb b/lib/puppet/type/pfile/mode.rb
index 96e29aabb..e29e74235 100755
--- a/lib/puppet/type/pfile/mode.rb
+++ b/lib/puppet/type/pfile/mode.rb
@@ -39,7 +39,7 @@ module Puppet
# octal, yet the number can only be specified as a string right now
value = should
if value.is_a?(String)
- unless value =~ /^[0-9]+$/
+ unless value =~ /^\d+$/
raise Puppet::Error, "File modes can only be numbers, not %s" %
value.inspect
end
@@ -47,11 +47,12 @@ module Puppet
unless value =~ /^0/
value = "0" + value
end
+ old = value
begin
value = Integer(value)
rescue ArgumentError => detail
raise Puppet::DevError, "Could not convert %s to integer" %
- value.inspect
+ old.inspect
end
end
diff --git a/test/util/config.rb b/test/util/config.rb
index 742b15b7b..924d73709 100755
--- a/test/util/config.rb
+++ b/test/util/config.rb
@@ -1037,7 +1037,7 @@ inttest = 27
:default => "/some/file"})
File.open(config, "w") { |f| f.puts "[#{Puppet[:name]}]
- mode = 750
+ mode = 755
group = foo
ssldir = #{file}
"}
@@ -1055,7 +1055,16 @@ inttest = 27
# Now make them valid params
@config.setdefaults(Puppet[:name], :group => ["blah", "yay"])
- @config.setdefaults(Puppet[:name], :mode => ["755", "yay"])
+ @config.setdefaults(Puppet[:name], :mode => ["750", "yay"])
+
+ assert_nothing_raised do
+ @config.parse(config)
+ end
+
+ assert_equal("foo", @config[:group],
+ "Did not store group when it is a valid config")
+ assert_equal("755", @config[:mode],
+ "Did not store mode when it is a valid config")
end
end