Skip to content

Commit

Permalink
fix setting megaraid device options via device_opts => { 'megaraid' =…
Browse files Browse the repository at this point in the history
…> ... }
  • Loading branch information
Joshua Hoblitt committed Jun 7, 2013
1 parent d487c9a commit d4ab6d6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
32 changes: 32 additions & 0 deletions spec/classes/smartd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,36 @@
END
end
end

context 'without params + megaraid facts' do
let(:facts) do
{
:osfamily=> 'RedHat', :lsbmajordistrelease => 6,
:megaraid_adapters => '1',
:megaraid_virtual_drives => '/dev/sdb,/dev/sda',
:megaraid_physical_drives => '2,1',
}
end

let(:params) do
{
:device_opts => { 'megaraid' => '-I 194'},
}
end

it do
should include_class('smartd')
should include_class('smartd::params')
should contain_package('smartmontools')
should contain_service('smartd')
should contain_file('/etc/smartd.conf')\
.with_content(<<-END.gsub(/^\s+/, ""))
# Managed by Puppet -- do not edit!
DEFAULT -m root -M daily
/dev/sda -d sat+megaraid,1 -I 194
/dev/sda -d sat+megaraid,2 -I 194
DEVICESCAN
END
end
end
end
6 changes: 2 additions & 4 deletions templates/smartd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ end
if megaraid_device and megaraid_device != '' and
@megaraid_adapters and @megaraid_adapters.to_i > 0
@megaraid_physical_drives.split(/,/).sort.each do |drive| -%>
<%= megaraid_device %> -d sat+megaraid,<%= drive.to_i %>
<% if @device_opts.has_key?('megaraid') -%>
<%= @device_opts['megaraid'] -%>
<% end #newline here, please %>
<%= megaraid_device %> -d sat+megaraid,<%= drive.to_i -%>
<% if @device_opts.has_key?('megaraid') %> <%= @device_opts['megaraid'] %><% end %>
<% end -%>
<% end -%>
<% if @devicescan -%>
Expand Down

0 comments on commit d4ab6d6

Please sign in to comment.