Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perhaps support alternative "puppet:///" paths for gem sources? #150

Open
abaddononion opened this issue Jan 30, 2020 · 3 comments
Open

Comments

@abaddononion
Copy link

abaddononion commented Jan 30, 2020

Or some other static deployment method. We ran into an issue in our environment where certain systems (usually assembly floor gear) does not have internet access, but still needs puppet installed. This is problematic because choria currently wants to download a few rubygems directly from the internet. You can disable this functionality, but it doesn't solve the problem.

Others have fixed this by using Nexus or Artifactory, but those are both non-trivial in a geographically distributed multi-site environment. For our purposes, it didn't make sense to pay for a whole other project for 3 rubygems, when we are not a ruby shop.

I've worked around this issue by implementing the following code on my side. I believe something similar could be done in puppet-choria's puppet modules (and in fact, have seen this model used before by the logstash::plugins module here: https://github.com/elastic/puppet-logstash/blob/master/manifests/plugin.pp)

As a workaround for anyone else who comes across this issue, here's the code I used to solve it for myself:

     file {
      "${tmpdir}/systemu-2.6.5.gem":
        mode   => "644",
        source => "puppet:///binaries/mcollective/systemu-2.6.5.gem",
        before => Package['systemu'];
      "${tmpdir}/choria-mcorpc-support-2.21.0.gem":
        mode   => "644",
        source => "puppet:///binaries/mcollective/choria-mcorpc-support-2.21.0.gem",
        before => Package['choria-mcorpc-support'];
      "${tmpdir}/nats-pure-0.6.2.gem":
        mode   => "644",
        source => "puppet:///binaries/mcollective/nats-pure-0.6.2.gem",
        before => Package['nats-pure'];
    }

    package {
      'systemu':
        ensure          => 'installed',
        install_options => ['--clear-sources', '--no-document', '--local'],
        provider        => puppet_gem,
        source          => "${tmpdir}/systemu-2.6.5.gem";
      'nats-pure':
        ensure          => 'installed',
        install_options => ['--clear-sources', '--no-document', '--local'],
        provider        => puppet_gem,
        source          => "${tmpdir}/nats-pure-0.6.2.gem",
        require         => Package['systemu'];
      'choria-mcorpc-support':
        ensure          => 'installed',
        install_options => ['--clear-sources', '--no-document', '--local'],
        provider        => puppet_gem,
        source          => "${tmpdir}/choria-mcorpc-support-2.21.0.gem",
        require         => Package['nats-pure'];
    }

    Package['choria-mcorpc-support'] -> Mcollective::Module_plugin <| |>
@ripienaar
Copy link
Member

This is beyond what I am likely to support in these modules, I'll support things Puppet supports using native Package{} resources, but not this whole pattern.

For example, today it supports already the package code you show basically - I might for example add a option to pass install_options. But the file bit has to be a action for the reader I am afraid.

@abaddononion
Copy link
Author

abaddononion commented Jan 30, 2020

Understood. Just spitballing... install_options would help, but you would also need something else... because right now it's possible to override the package_source on a global basis, but that only works in the case where you have an in-house rubygem mirror.

So perhaps there could be some other option, something like, "gemfile_source", that defaults to undef, but then if it's set, it functions as my $tmpdir here, and overrides the "source" lines for the rubygem installation blocks already in the module?

That would still leave it as an exercise to the user to at least get those files in place on the local system, but it would reduce the complexity here at least by half. Just a thought.

Edit: I guess that might have other issues.... because you'd have to come up with very specific rules for what they name each gem, with or without version number... might still be more problems than it's worth

@ripienaar
Copy link
Member

you can set $mcollective::gem_source to a local gem mirror :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants