puppet resource (ral) calls validate on custom (network_device) type

42 views
Skip to first unread message

Taylan Develioglu

unread,
May 13, 2014, 9:05:55 AM5/13/14
to puppet...@googlegroups.com
Hi everyone,

I am writing a custom network device type and ran into some behavior I'm not sure how to work around.

When running puppet resource to get all instances of a network_device type, validate is called.

(Note: this is not the same resource type from the puppetlabs-f5 module.)

I get the following:

________________________________________

root@traveler:~# FACTER_url='https://username:pass...@loadbalancer.example.com/'; puppet resource f5_node

Error: Could not run: Validation of F5_node[/Common/TestNode2000] failed: ipaddress is required when ensure is present
Wrapped exception:
ipaddress is required when ensure is present

_________________________________________
Parameter ipaddress is correctly prefetched / set.

Also, modifying a resource (or creating) silently does nothing:

_________________________________________

root@traveler:~/Downloads# FACTER_url='https://username:pass...@loadbalancer.example.com/'; puppet resource f5_node '/TestPartition2000/TestNode2000' ensure=present ipaddress='1.2.3.5'

f5_node { '/TestPartition2000/TestNode2000':
ensure => 'present',
connection_limit => '1',
dynamic_ratio => '1',
ipaddress => '1.1.1.97',
rate_limit => '1',
ratio => '1',
}

_________________________________________

My question is, is this expected behavior ? Why is validate failing ?

Why doesn't resource create not work ?

Any pointers would be appreciated, thanks!

Taylan Develioglu

unread,
May 13, 2014, 9:15:50 AM5/13/14
to puppet...@googlegroups.com
Attached type and provider.
f5_node_provider.rb
f5_node_type.rb

David Schmitt

unread,
May 13, 2014, 9:53:59 AM5/13/14
to puppet...@googlegroups.com
On 2014-05-13 15:05, Taylan Develioglu wrote:
> root@traveler:~#
> FACTER_url='https://username:pass...@loadbalancer.example.com/';
> puppet resource f5_node

> FACTER_url='https://username:pass...@loadbalancer.example.com/';
> puppet resource f5_node '/TestPartition2000/TestNode2000'
> ensure=present ipaddress='1.2.3.5'

Remove the semicolon (;) between the variable and the puppet call, or
put "export" in front, else you're defining a shell variable, and not an
environment variable, causing it to NOT be seen by puppet.

> f5_node { '/TestPartition2000/TestNode2000':
> ensure => 'present',
> connection_limit => '1',
> dynamic_ratio => '1',
> ipaddress => '1.1.1.97',
> rate_limit => '1',
> ratio => '1',
> }
>
> _________________________________________
>
> My question is, is this expected behavior ? Why is validate failing ?
>
> Why doesn't resource create not work ?
>
> Any pointers would be appreciated, thanks!



Regards, David

Taylan Develioglu

unread,
May 13, 2014, 11:45:16 AM5/13/14
to puppet...@googlegroups.com
Ah the semicolon is a copypaste that snuck in, please ignore it.




--
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/q-K_LRWHd6A/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/0c2f59cd6b71089af636fc1d2f898d2c%40hosting.edv-bus.at.

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

Felix Frank

unread,
May 26, 2014, 9:38:44 AM5/26/14
to puppet...@googlegroups.com
Have you tried just

puppet apply -e 'f5_node { "/TestPartition2000/TestNode2000": ensure =>
present, ipaddress => "1.1.1.97" }'

Note that just because the resource can be prefetched with a correctly
defined IP address, your validate hook tells puppet to reject any
resource declaration that fails to define a should-value for ipaddress
if ensure is not 'absent' (also note that this is not necessarily saying
the same as 'ensure is present').

HTH,
Felix
Reply all
Reply to author
Forward
0 new messages