crayfishx / puppet-db2

Puppet module to automate DB2 Server installation
Apache License 2.0
6 stars 8 forks source link

error when extracting the IBM_DB2_9.7.0.4_LU_LINUX_64BIT_ML.tar.gz file #8

Open kharibob opened 8 years ago

kharibob commented 8 years ago

Hi,

I am coming across an error when using the module as below - Error when extracting the IBM_DB2_9.7.0.4_LU_LINUX_64BIT_ML.tar.gz file. Puppet (err): Could not set 'present' on ensure: No space left on device - write at 51:<>/puppet/modules/db2/manifests/install.pp

It looks like, the module trying to unzip to /tmp location by default which in my case is small to hold the untar contents. Is there a way to override the /tmp to a different location to overcome the above error. Please suggest.

Thanks, Hari

crayfishx commented 8 years ago

It doesn't extract to /tmp by default but I think thats where the curl provider of puppet/archive will do the download while it's "in progress"- afaik this is more the behaviour of curl than either module - but given the size of DB2 installation files this is something that should be solved, I'll look into this more tomorrow...

kharibob commented 8 years ago

Thank you craig for looking at this. In my case i do not download from internet. i download from local nexus repo and point the tar.gz file to my archive puppet resource at around line 51 of db2/manisfest/install.pp. Please see where we refer to /tmp so that this path can be overridden.

crayfishx commented 8 years ago

@kharibob I thought I'd seen this before, and I have... The problem is with the archive module, it uses the ruby Tempfile library and copies the source archive to the OS's temp dir prior to moving it in place... see this section of the ruby provider....

https://github.com/voxpupuli/puppet-archive/blob/master/lib/puppet/provider/archive/ruby.rb#L120-L129 The first and last lines being the most relevant.

I believe it does it this way so it can verify the checksum before putting the file in place. An elegant solution would be to allow for the archive module to set an optional temp directory, as Tempfile.new accepts an optional second argument of a directory, I will try and put a PR in for this to the archive module.

This doesn't quickly solve your issue though, if you already have the file on local disk as you have said then you can just untar it there without performing this step, to do this just omit the source attribute.....

class { 'db2':
  installations => {
    '11.1' => {
      'installer_root' => '/path/to/my/targz',
      'product' => 'RUNTIME_CLIENT',
      'components' => [ 'JAVA_SUPPORT', 'LDAP_EXPLOITATION', 'BASE_CLIENT' ],
      'configure_license' => false,
    }
  },
}

This will untar the installation archive in /path/to/my/targz and run the installer from there - since it never copies the source archive (you don't specify the source attribute) then /tmp should never be touched.

If you cannot untar the archive in place and need to move it to a work folder (eg: /var/puppet_db2) then you could do this with a little bit of scaffolding in your profile class;

file { '/var/puppet_db2': ensure => directory }
file { '/var/puppet_db2/ibm_data_server_runtime_client_linuxx64_v11.1.tar.gz':
  ensure => file,
  source => '/vagrant/ibm_data_server_runtime_client_linuxx64_v11.1.tar.gz',
}-> Db2::Install <||>

class { 'db2':
  installations => {
    '11.1' => {
      'product' => 'RUNTIME_CLIENT',
      'components' => [ 'JAVA_SUPPORT', 'LDAP_EXPLOITATION', 'BASE_CLIENT' ],
      'configure_license' => false,
    }
  },
}

Hope this helps

crayfishx commented 8 years ago

@kharibob An update on this - a change to the archive module to allow you to override the tmp dir location has been merged. (https://github.com/voxpupuli/puppet-archive/pull/239) Once this is released you could upgrade puppet/archive which will give you the ability to do this....

Archive {
  'temp_dir' => '/somewhere/else'
}

include ::db2

When it's released I'll add this as an option to the db2 module, but we need to make sure we don't break the module for people running earlier versions of archive.... I'll leave this ticket open until we can achieve this in-module.