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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to