Here is the function. Some identifying characters were removed but I think 
overall it's fine. The library file (ops/vault) has a lot of proprietary 
stuff in it and let me just say it works perfectly fine so I really don't 
think that's the problem. The call in the puppet manifest looks like 
this: $monitoring_snmp_user = vault("global_snmp_user")

require 'ops/vault'
require 'json'

module Puppet::Parser::Functions
  newfunction(:vault, :type => :rvalue) do |args|
    auth = nil
    value = nil
    nv = nil
    tmp_json = lookupvar("ec2_userdata")
    user_data = JSON.parse(tmp_json)
    domain = user_data["tier_public_domain"]
    begin
      if args[0]
        nv = Vault.new(:tier_public_domain => domain)
        tmp = nv.get(args[0])
        if tmp.to_s != ""
          value = tmp
        end
      end
    rescue Exception => e
      value = ""
    end
    return value
  end
end







On Thursday, May 29, 2014 7:05:07 AM UTC-7, jcbollinger wrote:
>
>
>
> On Tuesday, May 27, 2014 2:26:51 PM UTC-5, mhoey wrote:
>>
>> I recently installed a puppet 3.4.3 puppetmaster. I am working on a 
>> project to convert all of our manifests over from 2.7 to 3.4.3. While 
>> trying to run a master/agent setup on the puppetmaster itself, I am getting 
>> the following error:
>>
>> "Error: Could not retrieve catalog from remote server: Error 400 on 
>> SERVER: no implicit conversion of String into Integer."
>>
>> The line in question is a  call to a custom function. The problem seems 
>> to go back to the "ec2_userdata" facter fact. If I alter the line 
>> "userdata.split" to just "userdata" in 
>> /usr/lib/ruby/vendor_ruby/facter/ec2.rb everything starts to work. What's 
>> interesting is that when I alter my function to not even use this variable 
>> (for debug purposes) it still throws the error. This leads me to believe 
>> that this fact is getting loaded no matter what and ultimately causing the 
>> problem.
>>
>>
>
> The custom function is probably the issue.  Puppet 2 accepts sloppier 
> custom function definitions; somewhere in the Puppet 3 series puppet 
> started enforcing the rules more rigorously (as I understand it, the rules 
> themselves did not change).
>
> Anyway, we really need to see some code to confirm that diagnosis or offer 
> a different one.  The custom function (at least its first few lines), the 
> section of the manifest where it is invoked, and the argument values being 
> passed should be sufficient.
>
>  
>
>> I saw in the Facter 2.0.1 documentation that arrays are now accepted but 
>> puppet does not have them turned on by default. I set stringify_facts to 
>> false in both main and master sections of puppet.conf but the problem still 
>> persists.
>>
>>
>
> I'm sure that's not your issue.  Facter's default behavior is the 
> traditional one, so if your code worked Puppet 2 / Facter 1 then it should 
> not be necessary to enable the new structured facts support to make it work 
> in Puppet 3 / Facter 2.
>
>
> John
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3f9e6637-dfac-4ed8-a5c1-639951e38801%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to