FAQ
I'm a noob. I'm wondering if I'm doing something fundamentally wrong and
am looking for some debugging advise.

I get an error that the exec command failed because it returned 1 instead
of 0 but when I copy the command puppet outputs as an error, and paste that
into a shell it works perfectly. The command's syntax is this:

/usr/bin/mysql -uroot -ppass < /path/to/sqlfile.sql # obviously not exactly
the same

an exit code of 1 is "Operation not permitted"

I have temporarily disabled selinux. puppet can create files owned by root
in directories that only root can create them, so it shouldn't be a
permissions problem.

Any ideas are very welcome.


Marc

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/b96tqPryPG4J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Hohum at May 28, 2012 at 1:02 am
    solved:

    cat /path/to/sqlfile.sql | /usr/bin/mysql -uroot -ppass

    works. Obviously some issue with the redirection.
    On Monday, 28 May 2012 06:18:45 UTC+10, hohum wrote:

    I'm a noob. I'm wondering if I'm doing something fundamentally wrong and
    am looking for some debugging advise.

    I get an error that the exec command failed because it returned 1 instead
    of 0 but when I copy the command puppet outputs as an error, and paste that
    into a shell it works perfectly. The command's syntax is this:

    /usr/bin/mysql -uroot -ppass < /path/to/sqlfile.sql # obviously not
    exactly the same

    an exit code of 1 is "Operation not permitted"

    I have temporarily disabled selinux. puppet can create files owned by
    root in directories that only root can create them, so it shouldn't be a
    permissions problem.

    Any ideas are very welcome.


    Marc
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/cNEYG1bNJbMJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Ryan Coleman at May 30, 2012 at 9:01 pm

    On Sun, May 27, 2012 at 1:18 PM, hohum wrote:
    I get an error that the exec command failed because it returned 1 instead of
    0 but when I copy the command puppet outputs as an error, and paste that
    into a shell it works perfectly.  The command's syntax is this:
    Hi,

    After you run your command in your shell, try running the following
    command: echo $?

    This will echo back the return code of the previous command, which I
    suspect will be 1. Just because a command doesn't return any output
    doesn't mean it exited 0.

    If it turns out that the exit code of 1 (or whatever) is what you'd
    like to consider success, you can tell Puppet what return code should
    indicate success with the returns parameter:
    http://docs.puppetlabs.com/references/stable/type.html#exec

    HTH!

    --Ryan

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Gary Larizza at May 30, 2012 at 9:07 pm

    On Wed, May 30, 2012 at 2:00 PM, Ryan Coleman wrote:
    On Sun, May 27, 2012 at 1:18 PM, hohum wrote:
    I get an error that the exec command failed because it returned 1
    instead of
    0 but when I copy the command puppet outputs as an error, and paste that
    into a shell it works perfectly. The command's syntax is this:
    Hi,

    After you run your command in your shell, try running the following
    command: echo $?

    This will echo back the return code of the previous command, which I
    suspect will be 1. Just because a command doesn't return any output
    doesn't mean it exited 0.

    If it turns out that the exit code of 1 (or whatever) is what you'd
    like to consider success, you can tell Puppet what return code should
    indicate success with the returns parameter:
    http://docs.puppetlabs.com/references/stable/type.html#exec

    HTH!

    --Ryan
    If Ryan's solution doesn't work, can you paste the Puppet code you're using
    for the exec? It might also be that the redirection you're trying to do
    requires that "provider => shell" be set.

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to
    puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/puppet-users?hl=en.

    --

    Gary Larizza
    Professional Services Engineer
    Puppet Labs

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMay 27, '12 at 8:19p
activeMay 30, '12 at 9:07p
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase