diff --git a/.gitignore b/.gitignore index e5b31be..38827fb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /spec/fixtures/modules/sudo /spec/fixtures/modules/tsm /pkg/ +.project diff --git a/.project b/.project new file mode 100644 index 0000000..615d690 --- /dev/null +++ b/.project @@ -0,0 +1,18 @@ + + + puppet-tsm + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + + com.puppetlabs.geppetto.pp.dsl.ui.puppetNature + org.eclipse.xtext.ui.shared.xtextNature + + diff --git a/README.md b/README.md index a3d4f10..dde5078 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Storage Manager (TSM) client on the following operating systems: * Oracle Linux 5/6 * Scientific Linux 5/6 * Solaris 10/11 +* Debian 7 ##Setup @@ -47,6 +48,19 @@ These usually are * gskcrypt64-8.0.14.26.linux.x86_64.rpm * TIVsm-BA.x86_64.rpm +For Debian you need an apt repository that contains the deb packages. +IBM only provides rpms so you might need to use alien to convert the +rpms IBM provides in the TSM installation tar.gz. +For info on converting rpms to debs consult: +http://www.planetcobalt.net/sdb/tsm_debian.shtml + +These usually are + +* TIVsm-API64.deb +* TIVsm-BA.deb +* gskcrypt64.deb +* gskssl64.deb + For Solaris 10 and 11 you need a HTTP server that provides the following packages for downloading: @@ -136,6 +150,7 @@ The module has been tested on: * RedHat Enterprise Linux 5/6 * Solaris 10 i386/sparc * Solaris 11 i386/sparc +* Debian 7 ##Development diff --git a/files/InclExcl.debian b/files/InclExcl.debian new file mode 100644 index 0000000..c20960b --- /dev/null +++ b/files/InclExcl.debian @@ -0,0 +1,15 @@ +exclude /var/cache/.../* +exclude /var/crash/.../* +exclude /var/lib/slocate/* +exclude /var/lock/.../* +exclude /var/log/.../* +exclude /var/run/.../* +exclude /var/spool/.../* +exclude /.../core +exclude /.../lost+found +exclude /.../tmp/.../* +exclude.dir /mnt +exclude.dir /proc +exclude.dir /sys +exclude.fs /dev/shm +exclude.fs /dev/pts \ No newline at end of file diff --git a/files/dsmsched.debian b/files/dsmsched.debian new file mode 100644 index 0000000..7d5bfbd --- /dev/null +++ b/files/dsmsched.debian @@ -0,0 +1,61 @@ +#!/bin/bash +# +### BEGIN INIT INFO +# Provides: dsmcsched +# Required-Start: $local_fs $remote_fs $syslog networking +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: dsmc scheduler +# Description: IBM Tivoli Backup Client +### END INIT INFO +# + +# PATH=${PATH}:/usr/adsm:/usr/local/sbin +# export PATH +export LANG=is_IS +DSM_DIR=/opt/tivoli/tsm/client/ba/bin +DSM_CONFIG=/opt/tivoli/tsm/client/ba/bin/dsm.opt +export DSM_DIR DSM_CONFIG +linke=`ls -d /opt/tivoli/tsm/client/ba/bin/is_IS` +if test "$linke" +then + sleep 0 +else + ln -s /opt/tivoli/tsm/client/ba/bin/en_US /opt/tivoli/tsm/client/ba/bin/is_IS +fi +# See how we were called. +case "$1" in + start) + echo -n "Starting dsmc. " + dsmc sch -RunAsService > /dev/null 2>&1 & + echo + ;; + stop) + echo -n "Stopping dsmc: " + pid=`/bin/ps ax | /bin/grep -w dsmc | /bin/grep -v grep | /bin/grep -v dsmcsched | /usr/bin/awk '{print $1}'` + if test "$pid" + then + kill $pid + echo + fi + ;; + restart) + $0 stop + $0 start + ;; + status) + pid=`/bin/ps ax | /bin/grep -w dsmc | /bin/grep -v grep | /bin/grep -v dsmcsched | /usr/bin/awk '{print $1}'` + if test "$pid" + then + echo "dsmc is running with PID: "$pid + else + echo "dsmc is not running " + fi + ;; + *) + echo "Usage: dsmcsched {start|stop|restart|status}" + exit 1 +esac + +exit 0 \ No newline at end of file diff --git a/manifests/init.pp b/manifests/init.pp index e4f6990..b52f0b2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -27,7 +27,8 @@ # List of tsm package to be installed # packages - optional # Default: -# Linux: ['TIVsm-BA'] +# Redhat: ['TIVsm-BA'] +# Debian: ['TIVsm-API64', 'TIVsm-BA', 'gskcrypt64', 'gskssl64'] # Solaris i386: ['gsk8cry32','gsk8cry64','gsk8ssl32','gsk8ssl64','TIVsmCapi', 'TIVsmCba'] # Solaris sparc: ['gsk8cry64','gsk8ssl64','TIVsmCapi', 'TIVsmCba'] # @@ -79,7 +80,8 @@ # Where to find the tsm service script for deployment # service_script_source - optional # Default: -# Linux: puppet://modules/tsm/dsmsched.redhat +# Redhat: puppet://modules/tsm/dsmsched.redhat +# Debian: puppet://modules/tsm/dsmsched.debian # Solaris: puppet://modules/tsm/tsmsched.solaris # # [*tsm_pwd*] @@ -131,7 +133,8 @@ # Where to find a default include/exclude file # inclexcl_source - optional # Default: -# Linux: puppet://modules/tsm/InclExcl.redhat +# Redhat: puppet://modules/tsm/InclExcl.redhat +# Debian: puppet://modules/tsm/InclExcl.debian # Solaris: puppet://modules/tsm/InclExcl.solaris # # [*config_hash*] diff --git a/manifests/install.pp b/manifests/install.pp index 6086936..c99c229 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -5,6 +5,7 @@ # === Authors # # Toni Schmidbauer +# David Orn Johannsson # # === Copyright # diff --git a/manifests/params.pp b/manifests/params.pp index bf7e453..aeeea07 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -46,6 +46,13 @@ $service_script_source = 'puppet:///modules/tsm/dsmsched.redhat' $inclexcl_source = 'puppet:///modules/tsm/InclExcl.redhat' } + debian: { + $packages = ['tivsm-api64', 'tivsm-ba', 'gskcrypt64', 'gskssl64'] + $service_name = 'dsmsched' + $service_script = '/etc/init.d/dsmsched' + $service_script_source = 'puppet:///modules/tsm/dsmsched.debian' + $inclexcl_source = 'puppet:///modules/tsm/InclExcl.debian' + } solaris: { case $::hardwareisa { i386: { diff --git a/manifests/service.pp b/manifests/service.pp index 157ce73..04739f5 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -30,6 +30,9 @@ redhat: { include tsm::service::redhat } + debian: { + include tsm::service::debian + } solaris: { include tsm::service::solaris } diff --git a/manifests/service/debian.pp b/manifests/service/debian.pp new file mode 100644 index 0000000..1e20c77 --- /dev/null +++ b/manifests/service/debian.pp @@ -0,0 +1,32 @@ +# == Class: tsm::service::debian +# +# Manage tsm service on debian +# +# === Authors +# +# Toni Schmidbauer +# David Orn Johannsson +# +# === Copyright +# +# Copyright 2014 Toni Schmidbauer +# +class tsm::service::debian { + + file { $::tsm::service_script: + ensure => file, + owner => 'root', + group => 'root', + mode => '0755', + source => $::tsm::service_script_source, + } + + service { $::tsm::service_name: + ensure => $::tsm::service_ensure, + enable => $::tsm::service_enable, + hasstatus => true, + hasrestart => true, + } + + File[$::tsm::service_script] -> Service[$::tsm::service_name] +} diff --git a/spec/classes/tsm_spec.rb b/spec/classes/tsm_spec.rb index 73b2acf..e654b83 100644 --- a/spec/classes/tsm_spec.rb +++ b/spec/classes/tsm_spec.rb @@ -2,7 +2,7 @@ describe 'tsm' do - ['RedHat', 'Solaris'].each do |system| + ['RedHat', 'Solaris', 'Debian'].each do |system| let :facts do { @@ -139,6 +139,28 @@ }) end end + + context 'on Debian 7' do + let :facts do + { + :osfamily => 'Debian', + :operatingsystemmajrelease => '7', + :architecure => 'amd64', + :concat_basedir => '/dne', + } + end + + it do + should contain_file('/opt/tivoli/tsm/client/ba/bin/InclExcl').with({ + 'ensure' => 'file', + 'replace' => 'false', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => 'puppet:///modules/tsm/InclExcl.debian' + }) + end + end context 'on Solaris' do let :facts do @@ -278,6 +300,105 @@ end end + + context 'tsm::install on Debian 7' do + let :facts do + { + :osfamily => 'Debian', + :operatingsystemmajrelease => '7', + :architecure => 'amd64', + :concat_basedir => '/dne', + + } + end + + describe 'when tsm::service_manage is false' do + it { should_not contain_class('tsm::service::debian')} + end + + describe 'should install tsm packages ' do + let(:params) do + { + :tcp_server_address => 'tsm', + } + end + + it { should contain_tsm__installpkg('tivsm-ba').with_ensure('installed') } + it { should contain_tsm__installpkg('tivsm-api64').with_ensure('installed') } + it { should contain_tsm__installpkg('gskcrypt64').with_ensure('installed') } + it { should contain_tsm__installpkg('gskssl64').with_ensure('installed') } + end + + describe 'should allow package_ensure to be overridden'do + let(:params) do { + :tcp_server_address => 'tsm', + :package_ensure => 'latest' + } + end + + it do + should contain_tsm__installpkg('tivsm-api64').with({ + :ensure => 'latest', + }) + end + end + + describe 'should allow package_name to be overridden'do + let(:params) {{ + :tcp_server_address => 'tsm', + :packages => ['deadbeaf'] + }} + + it { should contain_tsm__installpkg("deadbeaf").with_ensure('installed') } + end + end + + context 'tsm::service on Debian 7' do + let :facts do + { + :osfamily => 'Debian', + :operatingsystemmajrelease => '7', + :architecure => 'amd64', + :concat_basedir => '/dne', + } + end + + describe 'when tsm::service_manage is false' do + it { should_not contain_class('tsm::service::debian')} + end + + describe 'when tsm::service_manage is true' do + let(:params) do + { + :tcp_server_address => 'tsm', + :service_manage => true, + } + end + + it { should contain_class('tsm::service::debian')} + + it do + should contain_file('/etc/init.d/dsmsched').with({ + 'ensure' => 'file', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0755', + 'source' => 'puppet:///modules/tsm/dsmsched.debian' + }) + end + + it do + should contain_service('dsmsched').with({ + 'ensure' => 'running', + 'enable' => 'true', + 'hasstatus' => 'true', + 'hasrestart' => 'true', + }) + end + + it { should contain_service('dsmsched').that_requires('File[/etc/init.d/dsmsched]') } + end + end context 'tsm::install on Solaris 10 i386' do let :facts do diff --git a/spec/defines/installpkg_spec.rb b/spec/defines/installpkg_spec.rb index 46dd39c..2396e4c 100644 --- a/spec/defines/installpkg_spec.rb +++ b/spec/defines/installpkg_spec.rb @@ -12,6 +12,18 @@ it { should contain_package('TIVsm-BA').with_ensure('installed') } end + + context 'on Debian' do + let(:title) { 'tivsm-ba'} + + let :facts do + { + :osfamily => 'Debian' + } + end + + it { should contain_package('tivsm-ba').with_ensure('installed') } + end context 'on Solaris' do let :facts do