Facter resolved to an invalid value

687 views
Skip to first unread message

Viktor Jevdokimov

unread,
May 13, 2014, 10:34:18 AM5/13/14
to puppet...@googlegroups.com
On some CentOS servers we started to receive an error:

Fact resolution fact='env', resolution='<anonymous>' resolved to an invalid value: Expected prod to be one of [Integer, Float, TrueClass, FalseClass, NilClass, String, Array, Hash], but was Symbol

Custom fact script:

Facter.add('env') do
  setcode do
    case Facter.value(:ipaddress)
    when /^172.22.1.*$/
      :dev
    when /^10.1.2.*$/
      :prod
    else
      :default
    end
  end
end


Happened after IP address was changed on the server, machine was restarted.

Have not idea what to fix.


Best regards,

Viktor

David Schmitt

unread,
May 13, 2014, 10:49:16 AM5/13/14
to puppet...@googlegroups.com
On 2014-05-13 16:34, Viktor Jevdokimov wrote:
> On some CentOS servers we started to receive an error:
>
> Fact resolution fact='env', resolution='<anonymous>' resolved to an
> invalid value: Expected prod to be one of [Integer, Float, TrueClass,
> FalseClass, NilClass, String, Array, Hash], but was Symbol

Welcome to facter 2.0

> Custom fact script:
>
> Facter.add('env') do
> setcode do
> case Facter.value(:ipaddress)
> when /^172.22.1.*$/
> :dev
> when /^10.1.2.*$/
>
> :prod
> else
>
> :default
> end
> end
> end


change all :XXXX to "XXXX"


Regards, David

Andreas Ntaflos

unread,
May 13, 2014, 10:50:55 AM5/13/14
to puppet...@googlegroups.com
On 2014-05-13 16:34, Viktor Jevdokimov wrote:
> On some CentOS servers we started to receive an error:
>
> Fact resolution fact='env', resolution='<anonymous>' resolved to an
> invalid value: Expected prod to be one of [Integer, Float, TrueClass,
> FalseClass, NilClass, String, Array, Hash], but was Symbol

The error message is fairly self-explanatory, no? Facter needs facts to
return strings, booleans, arrays or hashes. Your fact returns Ruby
symbols, which Facter doesn't like. Change :dev, :prod and :default to
"dev", "prod" and "default" and it should work.

HTH Andreas

signature.asc

Viktor Jevdokimov

unread,
May 13, 2014, 11:12:44 AM5/13/14
to puppet...@googlegroups.com
Thanks!




--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/YwcTswIb1Us/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/eed613ba03f0563d641f92386f19c33e%40hosting.edv-bus.at.

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

Vipul Kakad

unread,
Dec 22, 2017, 10:34:49 AM12/22/17
to Puppet Users
Team could you please share the script path for changing the value.
Thanks!


To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages