Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/puppet/type/logical_volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def insync?(is)
newparam(:stripes) do
desc "The number of stripes to allocate for the new logical volume."
validate do |value|
unless value =~ /^[0-9]+/i
unless value.to_s =~ /^[0-9]+$/i
raise ArgumentError , "#{value} is not a valid stripe count"
end
end
Expand All @@ -108,7 +108,7 @@ def insync?(is)
newparam(:stripesize) do
desc "The stripesize to use for the new logical volume."
validate do |value|
unless value =~ /^[0-9]+/i
unless value.to_s =~ /^[0-9]+$/i
raise ArgumentError , "#{value} is not a valid stripesize"
end
end
Expand All @@ -117,7 +117,7 @@ def insync?(is)
newparam(:readahead) do
desc "The readahead count to use for the new logical volume."
validate do |value|
unless value =~ /^([0-9]+|Auto|None)/i
unless value.to_s =~ /^([0-9]+|Auto|None)/i
raise ArgumentError , "#{value} is not a valid readahead count"
end
end
Expand Down Expand Up @@ -158,7 +158,7 @@ def insync?(is)
newparam(:region_size) do
desc "A mirror is divided into regions of this size (in MB), the mirror log uses this granularity to track which regions are in sync. CAN NOT BE CHANGED on already mirrored volume. Take your mirror size in terabytes and round up that number to the next power of 2, using that number as the -R argument."
validate do |value|
unless value =~ /^[0-9]+/i
unless value.to_s =~ /^[0-9]+$/i
raise ArgumentError , "#{value} is not a valid region size in MB."
end
end
Expand Down
31 changes: 31 additions & 0 deletions spec/unit/type/filesystem_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'spec_helper'

describe Puppet::Type.type(:filesystem) do

it 'raises an ArgumentError when the name is not an absolute path' do
expect {
resource = Puppet::Type.type(:filesystem).new(
{
:name => 'notAnAbsolutePath',
:ensure => :present,
:fs_type => 'ext3',
:options => '-b 4096 -E stride=32,stripe-width=64',
}
)
}.to raise_error(Puppet::ResourceError,
'Parameter name failed on Filesystem[notAnAbsolutePath]: Filesystem names must be fully qualified')
end

it 'does not raise an ArgumentError when the name is an absolute path' do
expect {
resource = Puppet::Type.type(:filesystem).new(
{
:name => '/dev/myvg/mylv',
:ensure => :present,
:fs_type => 'ext3',
:options => '-b 4096 -E stride=32,stripe-width=64',
}
)
}.to_not raise_error
end
end
Loading