Execute resource and sudo


#1

I’ve run into a problem where I’m using the execute resource and using the
’user’ attribute. But the command exits with a 1 (not much other information
is given).

However, if I instead append ‘sudo su - user’ to the command in the command
attribute and do not use the attribute it works fine…

Tristan


#2

Tristan, do you have debug logs? (Run the chef-client with --log-level debug)

Also, are you running the client as root?

Adam

On Fri, Mar 11, 2011 at 1:35 PM, Tristan Sloughter
tristan.sloughter@gmail.com wrote:

I’ve run into a problem where I’m using the execute resource and using the
’user’ attribute. But the command exits with a 1 (not much other information
is given).
However, if I instead append ‘sudo su - user’ to the command in the command
attribute and do not use the attribute it works fine…
Tristan


Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: adam@opscode.com


#3

To be exact I run the client by ‘sudo chef-client’.

I’ll get the logs shortly.

Tristan

On Fri, Mar 11, 2011 at 3:46 PM, Adam Jacob adam@opscode.com wrote:

Tristan, do you have debug logs? (Run the chef-client with --log-level
debug)

Also, are you running the client as root?

Adam

On Fri, Mar 11, 2011 at 1:35 PM, Tristan Sloughter
tristan.sloughter@gmail.com wrote:

I’ve run into a problem where I’m using the execute resource and using
the
’user’ attribute. But the command exits with a 1 (not much other
information
is given).
However, if I instead append ‘sudo su - user’ to the command in the
command
attribute and do not use the attribute it works fine…
Tristan


Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: adam@opscode.com


#4

So it appears to be a cwd problem actually. I didn’t expect the commands to
rely on that.

Thanks for the debug_level suggestion :). I will hopefully no longer forget
to use that first when I run into a problem.

=ERROR REPORT==== 11-Mar-2011::15:58:53 ===
file:path_eval([".","/home/tsloughter"],".erlang"): permission denied

=ERROR REPORT==== 11-Mar-2011::15:58:53 ===
ERROR: {error,
“Error when reading
/home/tsloughter/.erlang.cookie: eacces”} - []
epmd was not running, attempting to start it…
=ERROR REPORT==== 11-Mar-2011::15:58:54 ===
ERROR: {error,
“Error when reading
/home/tsloughter/.erlang.cookie: eacces”} - []
ERROR: net_kernel start failure: {error,
{shutdown,
{child,undefined,net_sup_dynamic,
{erl_distribution,start_link,
[[’__admin_7502’,longnames]]},
permanent,1000,supervisor,
[erl_distribution]}}}STDERR:

On Fri, Mar 11, 2011 at 3:57 PM, Tristan Sloughter <
tristan.sloughter@gmail.com> wrote:

To be exact I run the client by ‘sudo chef-client’.

I’ll get the logs shortly.

Tristan

On Fri, Mar 11, 2011 at 3:46 PM, Adam Jacob adam@opscode.com wrote:

Tristan, do you have debug logs? (Run the chef-client with --log-level
debug)

Also, are you running the client as root?

Adam

On Fri, Mar 11, 2011 at 1:35 PM, Tristan Sloughter
tristan.sloughter@gmail.com wrote:

I’ve run into a problem where I’m using the execute resource and using
the
’user’ attribute. But the command exits with a 1 (not much other
information
is given).
However, if I instead append ‘sudo su - user’ to the command in the
command
attribute and do not use the attribute it works fine…
Tristan


Opscode, Inc.
Adam Jacob, Chief Product Officer
T: <%28206%29%20619-7151>(206) 619-7151 E: adam@opscode.com