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

archive has stopped working for us #505

Open
djmills64 opened this issue Sep 7, 2023 · 4 comments
Open

archive has stopped working for us #505

djmills64 opened this issue Sep 7, 2023 · 4 comments

Comments

@djmills64
Copy link

djmills64 commented Sep 7, 2023

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.26.0
  • Ruby:
  • Distribution: Community
  • Module version: 7.0.0

How to reproduce (e.g Puppet code you use)

node default {
  archive { '/hdd/Backup/pylon_7.1.0.25066_x86_64.tar.gz':
    extract      => true,
    extract_path => '/tmp/pylon7',
    cleanup      => false,
    require      => File['/tmp/pylon7'],
  }

  file { '/tmp/pylon7':
    ensure => directory,
    owner  => 'root',
    mode   => '0755',
  }
}

What are you seeing

Creates the folder /tmp/pylon7, but fails to "tar zxf" into it

What behaviour did you expect instead

We should see /tmp/pylon7 with foles/folders in it.

Output log

Notice: Compiled catalog for acusensus-davidmills in environment production in 0.02 seconds
Notice: /Stage[main]/Main/Node[default]/File[/tmp/pylon7]/ensure: created
Notice: Applied catalog in 0.74 seconds

No mention of the archive resource.

Any additional information you'd like to impart

This was working for us fairly recently.

@djmills64
Copy link
Author

I might have just figured it out. It seems that you need a "source" parameter and that it has to differ from the "path" parameter. Given the file already exists in the "path" location, can it not simply be extracted from there? Why do we need to make a copy elsewhere first? e.g. changing to

  archive { '/hdd/Backup/pylon_7.1.0.25066_x86_64.tar.gz':
    path         => "/hdd/Backup/pylon_7.1.0.25066_x86_64.tar.gz",
    source       => '/tmp/pylon_7.1.0.25066_x86_64.tar.gz',
    extract      => true,
    extract_path => '/tmp/pylon7',
    cleanup      => false,
    require      => File['/tmp/pylon7'],
  }

works but having source as "/hdd/Backup/pylon_7.1.0.25066_x86_64.tar.gz" does not. Why not?

@djmills64
Copy link
Author

I ran the above code once and it worked. But then when I remove the extract_path folder and contents and run again, it creates the folder but doesn't populate. Why would that be?

@djmills64
Copy link
Author

If I turn on debug I don't get much information in relation to the archive resource. Just

...
Debug: Loaded state in 0.45 seconds
Info: Applying configuration version '1694058315'
Debug: /Stage[main]/Main/Node[default]/Archive[pylon_7.1.0.25066_x86_64.tar.gz]/require: require to File[/opt/pylon7]
Debug: Finishing transaction 12600
Debug: Storing state
...

The one time it worked the output showed:

root@acusensus-davidmills:~# /opt/puppetlabs/bin/puppet apply     --hiera_config=/work/code/puppet-runtime/hiera.yaml     --modulepath=/etc/puppetlabs/code/environments/production/modules:/work/code/puppet-runtime     /work/code/puppet-runtime/manifests/site-test.pp --detailed-exitcodes
Notice: Compiled catalog for acusensus-davidmills in environment production in 0.02 seconds
Notice: /Stage[main]/Main/Node[default]/Archive[/hdd/Backup/pylon_7.1.0.25066_x86_64.tar.gz]/ensure: download archive from /hdd/Backup/pylon_7.1.0.25066_x86_64.tar.gz to /tmp/pylon_7.1.0.25066_x86_64.tar.gz and extracted in /tmp/pylon7 without cleanup
Notice: Applied catalog in 5.22 seconds

after which /tmp/pylon7 had the files/folders it is meant to.

@djmills64
Copy link
Author

Actually having a creates parameter seems to force the issue and remove the need for a source parameter.

node default {
  $archive = 'pylon_7.1.0.25066.tar.gz'
  $software_install_path = '/opt/pylon7'
  archive { "/hdd/Backup/${archive}":
    path         => "/hdd/Backup/${archive}",
    extract      => true,
    extract_path => $software_install_path,
    cleanup      => false,
    require      => File[$software_install_path],
    creates      => "${software_install_path}/bin/pylonviewer",
  }

 file { $software_install_path:
    ensure => directory,
    owner  => 'root',
    mode   => '0755',
  }
}

works.

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

No branches or pull requests

1 participant