Hi Fraser,

On Tue, Sep 29, 2015 at 12:04 PM, Fraser Goffin <goff...@gmail.com> wrote:

> Puppet v 4.2.x
> Platform: Windows
>
> I'm using the Atlassian sonatype_nexus Puppet module. It allows you to
> configure Nexus via its RESTful API using a number of abstractions from the
> module. However, ... there is a requirement for a few additional Ruby gems
> to be installed, the key one being a rest_client gem and a number of its
> dependents. At this time the module doesn't provide installation for these
> but its pretty easy to copy them over to the correct location in Puppet
> using a file resource. Something along these lines :-
>
> class sonatype_nexus::windows::install {
> ...
>   file { 'copy_gems':
>     path    => 'c:/apps/puppet/sys/ruby/lib/',
>     source  => "puppet:///modules/${source_module_name}",
>     recurse => true,
>   }
>
>  where the calling module contains a files folder with an appropriate
> structure to that under puppet ... e.g :-
>
> .../modules/sonatype_nexus/files/ruby/gems/2.1.0/....
>
> OK, so no problem there then ... well actually there is.This file copy is
> (was) happening in an 'install' class and later on in another 'config'
> classI was using the resources that need those gems, say .. something like
> this to define a new Nexus proxied repository :-
>
> class sonatype_nexus::windows::postconfig {
>
>   nexus_repository { 'myrepo':
>     label                   => 'MyRepo',
>     provider_type           => 'maven2',
>     type                    => 'proxy',
>     policy                  => 'release',
>     ...
>    }
>
> Unfortunately, when the catalogue is compiled Puppet spots the fact that
> this resource type needs access to the rest_client gem and since it can't
> find it on the system (this being a fresh VM) it throws an exception even
> though it will be there by the time this be of Puppet code runs because of
> the earlier copy and the dependencies established between the install and
> 'postconfig' classes :-
>
> class sonatype_nexus(
> ...
>   Class["::sonatype_nexus::${::osfamily}::install"] ->
>   Class["::sonatype_nexus::${::osfamily}::preconfig"] ->
>   Class["::sonatype_nexus::${::osfamily}::service"] ->
>   Class["::sonatype_nexus::${::osfamily}::postconfig"]
>
> So, for now, I have had to separate out the copy of the gems and then the
> install and config of Nexus into two separate Puppet runs. It works fine,
> but .... is there a way of getting it to work with just a single run ?
>
> Kind Regards
>
> Fraser.
>
>
> --
> 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 puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/f3006946-5ba9-431b-9ad9-9b9e6c96cae1%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/f3006946-5ba9-431b-9ad9-9b9e6c96cae1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

This issue came up when discussing a puppet PR[1]. It turned out to be a
bug in the nexus_rest module:
https://forge.puppetlabs.com/atlassian/nexus_rest, which looks like they
fixed in 0.4.3[2].

The problem was that previously the providers were not confined and would
try to require the rest_client gem directly. Now, the providers are
confined based on a provider feature, which allows puppet to defer
evaluation of nexus related resources until after the gem is installed, so
that both can occur in the same run.

Josh

[1] https://github.com/puppetlabs/puppet/pull/4220
[2]
https://bitbucket.org/atlassian/puppet-module-nexus_rest/pull-requests/48/issue-4-confine-rest-client-as-a-feature/diff
-- 
Josh Cooper
Developer, Puppet Labs

*PuppetConf 2015 <http://2015.puppetconf.com/>** is right around the
corner! Join us October 5-9 in Portland, OR. **Register now
<https://puppetconf2015.eventbrite.com/>**.*

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2Bu97unQW15xiBiGegxYdHLfsT%3DhOBBjCHJwyO9YN5qfLbVHzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to