Ask Your Question

exec command, tar reports success but not found?

asked 2014-11-20 10:19:28 -0600

elimtaft gravatar image


I'm not sure what I'm doing wrong here. I'm trying to extract a tarball that creates a directory. The next command requires that directory to exist. Puppet reports that the extrac exec is successful, but the next command fails, saying the directory doesn't exist.

exec { 'extract':                                                            
  command => 'tar -xzf /tmp/samhain-3.1.3.tar.gz -C /tmp/samhain-3.1.3',
  creates => '/tmp/samhain-3.1.3',
  require => File['/tmp/samhain-3.1.3.tar.gz']

Puppet reports: Debug: Execextract: Executing 'tar xzf /tmp/samhain-3.1.3.tar.gz'
Debug: Executing 'tar xzf /tmp/samhain-3.1.3.tar.gz'
Notice: /Stage[main]/Shared/Exec[extract]/returns: executed successfully

Next command:

exec { "configure_sh":
  cwd     => '/tmp/samhain-3.1.3',
  command => 'bash configure',
  require => File['/tmp/samhain-3.1.3'],

Puppet reports:

Error: Working directory '/tmp/samhain-3.1.3' does not exist
Error: /Stage[main]/Yule/Exec[configuresh]/returns: change from notrun to 0 failed: Working directory '/tmp/samhain-3.1.3' does not exist
Notice: /Stage[main]/Yule/Exec[make
installsh]: Dependency Exec[configuresh] has failures: true

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-20 10:34:15 -0600

elimtaft gravatar image

This was due to the contents of the tarball not containing what I expected. I expected it to contain a directory when it, in facts, contained two separate files instead. However, I would have thought that "creates" would error if the resulting command didn't create what was expected?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-11-20 10:19:28 -0600

Seen: 686 times

Last updated: Nov 20 '14