Re: [Puppet Users] Dependent Ruby Gems - One run or Two

2015-10-01 Thread Fraser Goffin
Hey Josh,

Thanks for the heads up. You are right, version 0.4.3 does propose a solution 
to this but unfortunately in my testing it doesn't quite work. I have raised a 
couple of additional issues so with any luck Atlassian will sort it out 
sometime soon. So still using the 2 run work-around for now.

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/617bff3e-40d6-45d5-9ccf-d408354a6fb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Dependent Ruby Gems - One run or Two

2015-10-01 Thread Josh Cooper
On Thu, Oct 1, 2015 at 10:35 AM, Fraser Goffin  wrote:

> Hey Josh,
>
> Thanks for the heads up. You are right, version 0.4.3 does propose a
> solution to this but unfortunately in my testing it doesn't quite work. I
> have raised a couple of additional issues so with any luck Atlassian will
> sort it out sometime soon. So still using the 2 run work-around for now.
>

Also you mentioned you're deploying on Windows, and it's possible you're
running into a second issue PUP-3502, specifically see this comment[1].
It's possible clearing the gem path[2] on windows is not working as
expected, so puppet still sees the old gem path from prior to the
rest_client gem being installed.


> 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/617bff3e-40d6-45d5-9ccf-d408354a6fb3%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

Josh

[1]
https://tickets.puppetlabs.com/browse/PUP-3502?focusedCommentId=133316=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-133316
[2]
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/feature.rb#L85

-- 
Josh Cooper
Developer, Puppet Labs

*PuppetConf 2015 ** is right around the
corner! Join us October 5-9 in Portland, OR. **Register now
**.*

-- 
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%2Bu97umbh_pH93y3YoUm8e-CghqamVxcbM0Frf%2BoxA%2BFh6yGMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Dependent Ruby Gems - One run or Two

2015-09-30 Thread Josh Cooper
Hi Fraser,

On Tue, Sep 29, 2015 at 12:04 PM, Fraser Goffin  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
> 
> .
> 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 ** is right around the
corner! Join us October 5-9 in Portland, OR. **Register now
**.*

-- 
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.


[Puppet Users] Dependent Ruby Gems - One run or Two

2015-09-29 Thread Fraser Goffin
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.