Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need a good example for extracting a tgz #335

Closed
bostrowski13 opened this issue May 24, 2018 · 2 comments
Closed

need a good example for extracting a tgz #335

bostrowski13 opened this issue May 24, 2018 · 2 comments
Labels
docs Improvements or additions to documentation

Comments

@bostrowski13
Copy link

I've tried to figure this out and look through the examples, but I just cant get through this without the error below.

I'm trying to extract a tgz file that will extract the "wso2esb-4.9.0" directory contained in the tgz package to /opt/wso2.

It gets to the archive resource, then errors out with the following...

# puppet agent -t --debug
Error: /Stage[main]/Wso2::Install/Archive[app_package_zip]/creates: change from 'archive not extracted' to extracting in /opt/wso2 to create /opt/wso2wso2esb-4.9.0 failed: Unknown filetype: /tmp/wso2esb-4.9.0
Error: Could not run: Unknown filetype: /tmp/wso2esb-4.9.0

code is:

  $install_path        = '/opt/wso2'
  $package_name        = 'wso2esb'
  $package_ensure      = '4.9.0'
  $repository_url      = 'http://company.com/repository/wso2'
  $wso2_package_source = "${repository_url}/${package_name}-${package_ensure}.tgz"

  group { $username:
    ensure => present
  }
  user { $username:
    ensure     => 'present',
    provider   => 'useradd',
    shell      => $user_shell,
    groups     => $username,
    password   => $password,
    managehome => true,
    expiry     => 'absent',
    require    => Group[$username]
  }

  if $package_manage {
    file { 'wso2_appdir':
      ensure  => 'directory',
      path    => $install_path,
      owner   => $username,
      group   => $username,
      recurse => true,
      mode    => '0755',
      require => User[$username]
    }
    archive { 'app_package_zip':
      path         => "/tmp/${package_name}-${package_ensure}",
      source       => $wso2_package_source,
      extract      => true,
      extract_path => $install_path,
      creates      => "${install_path}${package_name}-${package_ensure}",
      cleanup      => true,
      require      => File['wso2_appdir']
    }
    file { "${install_path}/app":
      ensure  => link,
      target  => "${install_path}/${package_name}-${package_ensure}",
      require => Archive['app_package_zip']
    }
  }

@bostrowski13 bostrowski13 changed the title not a good example for extracting a tgz need a good example for extracting a tgz May 24, 2018
@juniorsysadmin juniorsysadmin added the docs Improvements or additions to documentation label May 30, 2018
@sukumart
Copy link

I am also hitting upon the same issue for .tar.gz file with "extract_flags => {'tar' => 'xzf'}"

@bostrowski13
Copy link
Author

Finally got this to work. Heres the archive section.

$install_path        = '/opt/wso2'
$package_name        = 'wso2esb'
$package_ensure      = '4.9.0'
$repository_url      = 'http://company.com/repository/wso2'
$wso2_package_source = "${repository_url}/${package_name}-${package_ensure}.tgz"
$archive_name = "${package_name}-${package_ensure}.tgz"

archive { 'app_package_zip':
  path         => "/tmp/${archive_name}",
  source       => $wso2_package_source,
  extract      => true,
  extract_path => $install_path,
  creates      => "${install_path}/${package_name}-${package_ensure}",
  cleanup      => true,
  require      => File['wso2_appdir'],
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants