Issue #972 has been updated by James Turnbull.

Assigned to deleted (Puppet Community)


----------------------------------------
Feature #972: More useful information (error handling) from Exec via system()
http://projects.reductivelabs.com/issues/972

Author: Alex Howells
Status: Accepted
Priority: Normal
Assigned to: 
Category: exec
Target version: 
Complexity: Easy
Patch: None
Affected version: 0.24.4
Keywords: 


I've been managing my /home directories using Puppet lately, and pushing around 
a "skeleton" containing all the useful files like .ssh/config you want on *all* 
hosts -- gives the whole network a consistent look and feel because prompts are 
the same, aliases are the same, really makes for a nicer system administration 
experience.

I ran into an error just recently, with:

<pre>
        exec { "update-home":
            command     => "tar -xvf $homedir/.skeleton/$name.tar -C $homedir",
            user        => "$name",
            path        => [[usrbin" "usrsbin]],
            subscribe   => File[[$homedirskeleton$nametar]],
            logoutput   => true,
            refreshonly => true
        }
</pre>

The file is copied over correctly. Directory permissions and file permissions 
are correct. Altering the tarball such that the MD5 changes will make Puppet go 
"Hey! That changed" and copy the new one before trying to execute update-home; 
in every case it fails with:

<pre>
err: //default/accounts/account[ahowells]/Exec[update-home]: Failed to call 
refresh on Exec[update-home]: tar -xvf /home/ahowells/.skeleton/ahowells.tar 
returned 1 instead of 0 at 
/etc/puppet/manifests/modules/user-management/definitions/account:158
</pre>

I am doing a one-time invocation of Puppet on the client node with @puppetd 
--test --debug --verbose@ and expecting useful output to help me debug ;)  That 
output wasn't useful enough.

<pre>
19:43 < lak> that kind of thing is really difficult to detect, actually
19:43 < lak> i call system(), it pukes, i try to give an exception that helps, 
but...
19:43 < lak> it's all up to whether system() pukes usefully, and it doesn't
19:43 < astinus> yah, not blaming you really :)  It was user error on my part.  
Just coulda fixed it in ~10s rather than 
                 ~10 minutes if system() puked more usefully
19:44 < lak> yeah, i know
19:45 < lak> good error handling is clearly critical
19:45 < lak> feel free to file it as an enhancement request; i don't know that 
i've specifically attacked that one, so 
             maybe it's not that hard
</pre>

The problem was actually that Ubuntu "Gutsy Gibbon" has that package kicking 
about in /bin/tar and I'd expected /usr/bin/tar ;)   Thus the fix is:

<pre>
        exec { "update-home":
            command     => "tar -xvf $homedir/.skeleton/$name.tar -C $homedir",
            user        => "$name",
            path        => [[bin" "usrbin" "usrsbin]],
            subscribe   => File[[$homedirskeleton$nametar]],
            logoutput   => true,
            refreshonly => true
        }
</pre>

I'm filing this as an enhancement request because I think it should have taken 
10 seconds to fix with better error handling, not 10 minutes to play the system 
administration equivalent of Whack-a-Mole.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to