[Puppet Users] Mcollective puppet-agent doesn't execute commands from custom facts

2014-08-02 Thread Maxim Nikolaev
Hello

I met following issue with mcollective puppet agent.

I have custom fact that read tags from AWS cli and transform them to facts.

Facter.add(role) do
  setcode do
  iregion = Facter.value(ec2_region)
  Facter::Util::Resolution.exec(ec2-describe-tags --region #{iregion} -O 
KEY -W SEC_KEY --filter \resource-id=$(ec2-metadata -i | cut -d \ \ 
-f2)\ --filter \key=Role\ | cut -f5 -)
  end
end


When I run facter from instance aor puppet agent from instance itself - 
everything working fine.

When I run pupper runnonce from mcollective server - it doesn't read this 
fact and apply only common manifest.

I checked several times and found, that if I set static file with role and 
use external fact like:

#!/bin/bash
role=`grep Role /etc/server_facts | awk '{print $NF}'`
echo role=$role

Mcollective works fine. If Itry to use AWS cli command in script - again 
fact doesn't wrk.

Have someone met such problem with mcollective? Can someone advise?

Puppet 3.6.2
Mcollective 2.5.3

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/85a8940b-0a4f-4de4-a568-050af439cb00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Mcollective puppet-agent doesn't execute commands from custom facts

2014-08-02 Thread José Luis Ledesma
Hi

Probably mco is not loading you environment variables ( like PATH) and this
produces this behavior.

If the ec2-describe-tags commands is not in the usual path, try exec it
with the full path in the fact.

Also you can check if the ec2_region fact  is get correctly from mco.

Hth
El 02/08/2014 20:57, Maxim Nikolaev m...@maximnik.com escribió:

 Hello

 I met following issue with mcollective puppet agent.

 I have custom fact that read tags from AWS cli and transform them to facts.

 Facter.add(role) do
   setcode do
   iregion = Facter.value(ec2_region)
   Facter::Util::Resolution.exec(ec2-describe-tags --region #{iregion} -O
 KEY -W SEC_KEY --filter \resource-id=$(ec2-metadata -i | cut -d \ \
 -f2)\ --filter \key=Role\ | cut -f5 -)
   end
 end


 When I run facter from instance aor puppet agent from instance itself -
 everything working fine.

 When I run pupper runnonce from mcollective server - it doesn't read this
 fact and apply only common manifest.

 I checked several times and found, that if I set static file with role and
 use external fact like:

 #!/bin/bash
 role=`grep Role /etc/server_facts | awk '{print $NF}'`
 echo role=$role

 Mcollective works fine. If Itry to use AWS cli command in script - again
 fact doesn't wrk.

 Have someone met such problem with mcollective? Can someone advise?

 Puppet 3.6.2
 Mcollective 2.5.3

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/85a8940b-0a4f-4de4-a568-050af439cb00%40googlegroups.com
 https://groups.google.com/d/msgid/puppet-users/85a8940b-0a4f-4de4-a568-050af439cb00%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAF_B3ddAA%3DeyqXSjvh1S7ptXOVXpJXcor6FgNP%3DCwde8RS1Yxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Mcollective puppet-agent doesn't execute commands from custom facts

2014-08-02 Thread Maxim Nikolaev
Tried also full path with ec2-region hardcoded

/opt/aws/bin/ec2-describe-tags --region us-east-1 -O KEY -W SEC_KEY 
--filter \resource-id=$(ec2-metadata -i | cut -d \ \ -f2)\ --filter 
\key=Role\ | cut -f5 -)

Created also sh script in /etc/facter/facts.d with same string: when run 
locally - it's works, when run with mcollective - it's failed.

I also checked with mcollective-facter-facts plugin - it can see these 
facts.

On Saturday, August 2, 2014 10:48:52 PM UTC+3, Jose Luis Ledesma wrote:

 Hi

 Probably mco is not loading you environment variables ( like PATH) and 
 this produces this behavior.

 If the ec2-describe-tags commands is not in the usual path, try exec it 
 with the full path in the fact.

 Also you can check if the ec2_region fact  is get correctly from mco.

 Hth
 El 02/08/2014 20:57, Maxim Nikolaev m...@maximnik.com javascript: 
 escribió:

 Hello

 I met following issue with mcollective puppet agent.

 I have custom fact that read tags from AWS cli and transform them to 
 facts.

 Facter.add(role) do
   setcode do
   iregion = Facter.value(ec2_region)
   Facter::Util::Resolution.exec(ec2-describe-tags --region #{iregion} -O 
 KEY -W SEC_KEY --filter \resource-id=$(ec2-metadata -i | cut -d \ \ 
 -f2)\ --filter \key=Role\ | cut -f5 -)
   end
 end


 When I run facter from instance aor puppet agent from instance itself - 
 everything working fine.

 When I run pupper runnonce from mcollective server - it doesn't read this 
 fact and apply only common manifest.

 I checked several times and found, that if I set static file with role 
 and use external fact like:

 #!/bin/bash
 role=`grep Role /etc/server_facts | awk '{print $NF}'`
 echo role=$role

 Mcollective works fine. If Itry to use AWS cli command in script - again 
 fact doesn't wrk.

 Have someone met such problem with mcollective? Can someone advise?

 Puppet 3.6.2
 Mcollective 2.5.3

  -- 
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to puppet-users...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/85a8940b-0a4f-4de4-a568-050af439cb00%40googlegroups.com
  
 https://groups.google.com/d/msgid/puppet-users/85a8940b-0a4f-4de4-a568-050af439cb00%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/73fe7b9d-8161-45e6-aa1a-1ec381ef9093%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Mcollective puppet-agent doesn't execute commands from custom facts

2014-08-02 Thread José Luis Ledesma
And setting full path for ec2-metadata too?
El 02/08/2014 22:02, Maxim Nikolaev m...@maximnik.com escribió:

Tried also full path with ec2-region hardcoded

/opt/aws/bin/ec2-describe-tags --region us-east-1 -O KEY -W SEC_KEY
--filter \resource-id=$(ec2-metadata -i | cut -d \ \ -f2)\ --filter
\key=Role\ | cut -f5 -)

Created also sh script in /etc/facter/facts.d with same string: when run
locally - it's works, when run with mcollective - it's failed.

I also checked with mcollective-facter-facts plugin - it can see these
facts.


On Saturday, August 2, 2014 10:48:52 PM UTC+3, Jose Luis Ledesma wrote:

 Hi

 Probably mco is not loading you environment variables ( like PATH) and
 this produces this behavior.

 If the ec2-describe-tags commands is not in the usual path, try exec it
 with the full path in the fact.

 Also you can check if the ec2_region fact  is get correctly from mco.

 Hth
 El 02/08/2014 20:57, Maxim Nikolaev m...@maximnik.com escribió:

 Hello

 I met following issue with mcollective puppet agent.

 I have custom fact that read tags from AWS cli and transform them to
 facts.

 Facter.add(role) do
   setcode do
   iregion = Facter.value(ec2_region)
   Facter::Util::Resolution.exec(ec2-describe-tags --region #{iregion}
 -O KEY -W SEC_KEY --filter \resource-id=$(ec2-metadata -i | cut -d \ \
 -f2)\ --filter \key=Role\ | cut -f5 -)
   end
 end


 When I run facter from instance aor puppet agent from instance itself -
 everything working fine.

 When I run pupper runnonce from mcollective server - it doesn't read this
 fact and apply only common manifest.

 I checked several times and found, that if I set static file with role
 and use external fact like:

 #!/bin/bash
 role=`grep Role /etc/server_facts | awk '{print $NF}'`
 echo role=$role

 Mcollective works fine. If Itry to use AWS cli command in script - again
 fact doesn't wrk.

 Have someone met such problem with mcollective? Can someone advise?

 Puppet 3.6.2
 Mcollective 2.5.3

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users...@googlegroups.com.

 To view this discussion on the web visit https://groups.google.com/d/
 msgid/puppet-users/85a8940b-0a4f-4de4-a568-050af439cb00%
 40googlegroups.com
 https://groups.google.com/d/msgid/puppet-users/85a8940b-0a4f-4de4-a568-050af439cb00%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.

  --
You received this message because you are subscribed to the Google Groups
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an
email to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/73fe7b9d-8161-45e6-aa1a-1ec381ef9093%40googlegroups.com
https://groups.google.com/d/msgid/puppet-users/73fe7b9d-8161-45e6-aa1a-1ec381ef9093%40googlegroups.com?utm_medium=emailutm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAF_B3ddkpq9VGmNbZ82fcOqEjkft8L83a0WPARku_0LE_CCf2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.