Issues with 'confine' on Netwrok Device provider

73 views
Skip to first unread message

Gavin Williams

unread,
Jun 2, 2014, 5:42:20 PM6/2/14
to puppe...@googlegroups.com
Hey all,

I'm trying to use 'confine' on a network device provider to restrict based on fact gathered from the network device.

However for the life of me, I just cant get it to work...
The code looks like [1].

As you can see, I'm trying to confine on the 'clustered' fact, which you can see is set in [2].

The logs of a puppet device run show 'Could not find a suitable provider for netapp_volume' - full run is [3].

I'm currently using Puppet 3.5.1, with webrick. Though not sure if that should make a difference.

So, should confine based on network device facts work?!

Cheers
Gavin

[1] https://gist.github.com/fatmcgav/7a3ed3192a6076e678fb#file-cmode-rb
[2] https://gist.github.com/fatmcgav/7a3ed3192a6076e678fb#file-facts-yaml
[3] https://gist.github.com/fatmcgav/7a3ed3192a6076e678fb#file-logs

Brice Figureau

unread,
Jun 3, 2014, 4:12:03 AM6/3/14
to puppe...@googlegroups.com
Hi,

On Mon, 2014-06-02 at 14:42 -0700, Gavin Williams wrote:
> Hey all,
>
> I'm trying to use 'confine' on a network device provider to restrict
> based on fact gathered from the network device.
>
> However for the life of me, I just cant get it to work...
> The code looks like [1].
>
> As you can see, I'm trying to confine on the 'clustered' fact, which
> you can see is set in [2].
>
> The logs of a puppet device run show 'Could not find a suitable
> provider for netapp_volume' - full run is [3].
>
> I'm currently using Puppet 3.5.1, with webrick. Though not sure if
> that should make a difference.
>
> So, should confine based on network device facts work?!

I don't think this can work, because the confiner uses Facter directly
instead of delegating to the fact terminus. Thus it looks into the hosts
facts instead of asking the network devices facts.

Unfortunately beside modifying the confiner system, I don't see any
workarounds.
Can you open a ticket, I'll see if I can come with a solution to this
issue.

Thanks!

--
Brice Figureau
My Blog: http://www.masterzen.fr/

Gavin Williams

unread,
Jun 3, 2014, 4:29:39 AM6/3/14
to puppe...@googlegroups.com, brice-...@daysofwonder.com
Brice

Damn, I had a feeling that might be the case :(

Have raised PUP-2717 [1]. Let me know if you need any further info...

Cheers
Gavin
[1] https://tickets.puppetlabs.com/browse/PUP-2717

Eric Sorenson

unread,
Jun 4, 2014, 5:19:59 PM6/4/14
to puppe...@googlegroups.com, brice-...@daysofwonder.com
That's going to be a scary thing to change.

Gavin can you use two providers for the same type, and just not set a default, so the user (or a top-level class you inherit from) sets a resource default for the 'provider' metaparameter? If there is code to share between the providers you can use the 'parent' mechanism in the provider api, like the way 'up2date' and 'yum' both use 'rpm' as their parent.

--eric0

Gavin Williams

unread,
Jun 5, 2014, 4:40:11 AM6/5/14
to puppe...@googlegroups.com, brice-...@daysofwonder.com
Eric

Cheers for the response. That's a shame that it's a big change to support, as the missing functionality kinda makes Network Device support feel a bit 2nd class citizen... :(

Will take a look at the yum/up2date > rpm relationship and see if I can work something from there...

Cheers
Gavin

Hunter Haugen

unread,
Jun 6, 2014, 4:53:09 PM6/6/14
to puppe...@googlegroups.com, brice-...@daysofwonder.com
Another option might be to call the facts indirector with the network_device terminus from the confine block itself... Something like

  confine :true => begin
      a = Puppet::Node::Facts.indirection
      a.terminus_class = :network_device
      a.find(Puppet::Indirector::Request.new(:facts, :find, "clustered", nil))
    rescue
      :false
    end

I haven't tested this, but maybe it'll get you down the road before this is fixed.

fatmcgav

unread,
Jun 8, 2014, 6:45:03 AM6/8/14
to puppe...@googlegroups.com, brice-...@daysofwonder.com
Hunter

Have given it a quick test, and that seems to have worked :D

Cheers for the pointer...

Gav


--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-dev/_DXOY8UrDXs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/3fb4b98f-fa20-4a03-9fd6-7cd617006cb3%40googlegroups.com.

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

Reply all
Reply to author
Forward
0 new messages