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

Description updated


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

Author: Trevor Vaughan
Status: Unreviewed
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