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
15 changes: 9 additions & 6 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@
mode => '0644',
}

file { $::tsm::config_opt:
ensure => file,
replace => $::tsm::config_replace,
owner => 'root',
group => 'root',
mode => '0644',
if $::tsm::config_opt_hash {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the pull request, just one thing: does the tsm client work without dsm.opt? if config_opt_hash is undef in your pull request we do not create dsm.opt (if i'm right). afaik the client needs dsm.opt even if it's empty. maybe we should move the old dsm.opt resource into an else part of the if statement...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!

To be honest I don't know, in our setup we need the dsm.opt file with some options in it. Some months ago this module did not provided that file at all, now it's emtpy file, so I assumed not to create it, when we do not have a content for it.

But id you think we need it, let us remove the if statement ...

file { $::tsm::config_opt:
ensure => file,
replace => $::tsm::config_replace,
owner => 'root',
group => 'root',
mode => '0644',
content => template($::tsm::config_opt_template),
}
}
}
6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@
# keys => value
# Default: {}
#
# [*config_opt_hash*]
# config_opt_hash - hash with opt parameters
# keys => value
# Default: undef
#
# [*tcp_server_address*]
# TSM server used for this client
# tcp_server_address - obligatory
Expand Down Expand Up @@ -184,6 +189,7 @@
$inclexcl_replace = $::tsm::params::inclexcl_replace,
$inclexcl_source = $::tsm::params::inclexcl_source,
$config_hash = {},
$config_opt_hash = undef,
$tcp_server_address,
) inherits tsm::params {

Expand Down
19 changes: 10 additions & 9 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
$set_initial_password = true

# default parameters fot dsm.sys
$comm_method = 'TCPip'
$tcp_port = '1500'
$comm_method = 'TCPip'
$tcp_port = '1500'

$config = '/opt/tivoli/tsm/client/ba/bin/dsm.sys'
$config_opt = '/opt/tivoli/tsm/client/ba/bin/dsm.opt'
$config_template = 'tsm/dsm.sys.erb'
$config_replace = false
$config = '/opt/tivoli/tsm/client/ba/bin/dsm.sys'
$config_opt = '/opt/tivoli/tsm/client/ba/bin/dsm.opt'
$config_template = 'tsm/dsm.sys.erb'
$config_opt_template = 'tsm/dsm.opt.erb'
$config_replace = false

$inclexcl = '/opt/tivoli/tsm/client/ba/bin/InclExcl'
$inclexcl_local = '/opt/tivoli/tsm/client/ba/bin/InclExcl.local'
$inclexcl_replace = false
$inclexcl = '/opt/tivoli/tsm/client/ba/bin/InclExcl'
$inclexcl_local = '/opt/tivoli/tsm/client/ba/bin/InclExcl.local'
$inclexcl_replace = false

case $::osfamily {
redhat: {
Expand Down
29 changes: 28 additions & 1 deletion spec/classes/tsm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
end

it do
should contain_file('/opt/tivoli/tsm/client/ba/bin/dsm.opt').with({
should_not contain_file('/opt/tivoli/tsm/client/ba/bin/dsm.opt').with({
'ensure' => 'file',
'replace' => 'false',
'owner' => 'root',
Expand All @@ -89,7 +89,34 @@
})
end

context 'tsm::config with dsm.opt file' do

config_opt_hash ={
'key1' => 'val1',
'key2' => 'val2',
'key3' => 'val3',
}

describe 'should install tsm packages ' do
let(:params) {{
:tcp_server_address => 'tsm',
:config_opt_hash => config_opt_hash,
}}

it do
should contain_file('/opt/tivoli/tsm/client/ba/bin/dsm.opt').with({
'owner' => 'root',
'group' => 'root',
'mode' => '0644'
})

config_opt_hash.each do |k,v|
should contain_file('/opt/tivoli/tsm/client/ba/bin/dsm.opt').with_content(/#{k}( +)#{v}/)
end

end
end
end

context 'on Redhat 6' do
let :facts do
Expand Down
16 changes: 16 additions & 0 deletions templates/dsm.opt.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

************************************************************************
* *
* Managed by Puppet *
* *
* Tivoli Storage Manager *
* *
************************************************************************

<%- if ! @config_opt_hash.nil? -%>
<%- config_opt_hash.keys.sort.each do |config_key| -%>
<%- config_value = @config_opt_hash[config_key] -%>
<%- line = "%-21s %s" % [config_key, config_value] -%>
<%= line %>
<%- end -%>
<%- end -%>