> On 15 Feb 2018, at 15:04, John Baird <[email protected]> wrote:
> 
> Do you have any recommendations for validating a custom top-scope fact?  
> Meaning, it's not a module scope, how can I verify a top-scope variable if I 
> can't put that in the class params?

unless $facts[“whatever”] =~ Stdlib::Compat::Ipv4 {
  fail(“meh”)
}

Though I would say your class should have a ip parameter and callers should 
supply the value and you should if but perhaps default so the fact this will 
help with tests etc

class whatever(Stdlib::Compat::Ipv4 $ip = $facts[“whatever”]) { }

This will help with tests too 


> 
>> On Thursday, February 15, 2018 at 8:01:57 AM UTC-6, R.I. Pienaar wrote:
>> 
>> 
>> On Thu, 15 Feb 2018, at 14:50, John Baird wrote: 
>> > R.I, 
>> > 
>> > Can you point me to some docs on exactly how to use those?  I have looked 
>> > and I only see references to using them, but not how to actually use them 
>> > within a manifest for validation.  Any places you can point me to would be 
>> > much appreciated! 
>> 
>> class thing( 
>>   Stdlib::Compat::Ipv4 $ipaddress 
>> ) { 
>> 
>> } 
>> 
>> this is how you tell it the class param has to be a ipv4, any attempt to 
>> pass anything else is a compile error 
>> 
>> https://puppet.com/docs/puppet/5.3/lang_data_type.html 
>> 
>> > 
>> > Also, thanks for all of the useful modules you have written over the 
>> > years, 
>> > I recognized your name instantly!  Thanks for getting back to me! 
>> > 
>> > John Baird 
>> > 
>> > On Thursday, February 15, 2018 at 12:19:30 AM UTC-6, R.I. Pienaar wrote: 
>> > > 
>> > > Use the Stdlib::Compat::Ipv4, ::Ipv6 and ::Ip_address data types 
>> > > 
>> > > --- 
>> > > R.I.Pienaar 
>> > > 
>> > > On 15 Feb 2018, at 01:41, John Baird <[email protected] <javascript:>> 
>> > > wrote: 
>> > > 
>> > > 
>> > > According to the stdlib docs, "is_ip_address" is deprecated.  There is 
>> > > no 
>> > > mention of how to replace it without using "validate_legacy" which 
>> > > itself 
>> > > will ultimately be deprecated. 
>> > > 
>> > > Is there a better/proper approach to validating IPv4 and/or IPv6 syntax 
>> > > with Puppet 5 ? 
>> > > ` 
>> > > is_ip_address 
>> > > 
>> > > *Deprecated. Will be removed in a future version of stdlib. 
>> > > See validate_legacy 
>> > > <https://forge.puppet.com/puppetlabs/stdlib#validate_legacy>.* 
>> > > 
>> > > Returns true if the string passed to this function is a valid IP 
>> > > address. 
>> > > 
>> > > *Type*: rvalue. 
>> > > 
>> > > ` 
>> > > 
>> > > -- 
>> > > 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] <javascript:>. 
>> > > To view this discussion on the web visit  
>> > > https://groups.google.com/d/msgid/puppet-users/3275659c-d7c0-487f-979b-8e62da5a3cd1%40googlegroups.com
>> > >  
>> > > <https://groups.google.com/d/msgid/puppet-users/3275659c-d7c0-487f-979b-8e62da5a3cd1%40googlegroups.com?utm_medium=email&utm_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 [email protected]. 
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/puppet-users/273e4a69-f25a-4261-8bfd-25ff8cc74d6e%40googlegroups.com.
>> >  
>> > For more options, visit https://groups.google.com/d/optout. 
>> 
>> 
>> -- 
>> R.I.Pienaar / www.devco.net / @ripienaar 
> 
> -- 
> 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/76c27569-da23-48cb-b05f-81929f144425%40googlegroups.com.
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/0C3BE96D-360D-4BF5-A55B-C489F2077BB1%40devco.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to