Issue #9632 has been updated by R.I. Pienaar.

Status changed from Unreviewed to Needs More Information

If the client just sit there waiting it probably means something happened on 
the server that was unhandled, pretty rare so would be interested to know what 
so we can improve that.  But check the server logs see what it says.  The 
client only appears to hang, what its doing is waiting for the remote end to 
complete but it never hears from the remote end and eventually timesout.

I'd guess its a simple syntax issue - you are missing an end to the if right 
after the 'run' call, this would be more obvious if you indented the code 
properly.

As an aside, you probably should use reply.fail!("foo") and not just 
reply.fail("foo") the first one stops execution immediately and return to the 
user while the 2nd one goes on with the action.

----------------------------------------
Bug #9632: Strange issue when creating an MCollective Agent.
https://projects.puppetlabs.com/issues/9632

Author: Trevor Vaughan
Status: Needs More Information
Priority: Normal
Assignee: 
Category: 
Target version: 
Keywords: bug, agent, hang
Branch: 
Affected mCollective version: 1.2.1


While making a sample Git agent, I ran across a curios situation.

The following code works:

<code>

module MCollective
  module Agent
    class Git<RPC::Agent

      action 'lastcommit' do
        if !File.directory?(request[:dir]) then
          reply.fail "Directory #{request[:dir]} does not exist"
        else
        validate :dir, :shellsafe
        run("/usr/bin/git rev-parse HEAD",
              :stdout => :out, 
              :stderr => :err, 
              :cwd => request[:dir]
        )
        end
      end

      action 'branch' do
        #if !File.directory?(request[:dir]) then
        #  reply.fail "Directory #{request[:dir]} does not exist"
        #else
        validate :dir, :shellsafe
        validate :sha1, /$[a-z][A-Z][0-9]$/
        validate :brname, :string

        run("/usr/bin/git branch #{request[:brname]} #{request[:hash]}",
              :stdout => :out, 
              :stderr => :err, 
              :cwd => request[:dir], 
              :environment => {"PATH" => '/bin:/usr/bin'}
          )
      end
    end
  end
 end

</code>

While this code does not:

<code>

module MCollective
  module Agent
    class Git<RPC::Agent

      action 'lastcommit' do
        if !File.directory?(request[:dir]) then
          reply.fail "Directory #{request[:dir]} does not exist"
        else
        validate :dir, :shellsafe
        run("/usr/bin/git rev-parse HEAD",
              :stdout => :out, 
              :stderr => :err, 
              :cwd => request[:dir]
        )
        end
      end

      action 'branch' do
        # The following three lines have been uncommented.
        if !File.directory?(request[:dir]) then
          reply.fail "Directory #{request[:dir]} does not exist"
        else
        validate :dir, :shellsafe
        validate :sha1, /$[a-z][A-Z][0-9]$/
        validate :brname, :string

        run("/usr/bin/git branch #{request[:brname]} #{request[:hash]}",
              :stdout => :out, 
              :stderr => :err, 
              :cwd => request[:dir], 
              :environment => {"PATH" => '/bin:/usr/bin'}
          )
      end
    end
  end
 end


</code>

The symptom is that, when the second version is activated on a client, the 
client will simply stop responding to mcollective when called with the 
'lastcommit' action.

The call is being executed with:

<pre>
mco rpc --agent git --action lastcommit --arg 'dir=/tmp/git' 
</pre>

I've been tinkering with MCollective for a total of two days now, so forgive me 
if this isn't as complete as it should be.


-- 
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://projects.puppetlabs.com/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