Git Product home page Git Product logo

puppet-generate-puppetfile's Introduction

Build Status Gem Version

Tired of searching for dependencies on the forge and hoping you got everything? Have an existing Puppetfile that's getting long in the tooth? Use generate-puppetfile to generate a list of modules and their dependencies, at the latest version, in Puppetfile format for use with r10k or librarian-puppet.

Installation

gem install generate-puppetfile

Usage

Run generate-puppetfile with a list of modules and/or an existing Puppetfile. Each module name will be validated to be of the proper format (author/name). Any existing Puppetfile will be scanned for forge modules. Non-forge module entries will be preserved. All forge modules will be tracked at the latest version, along with their dependencies. The resulting Puppetfile will contain all the forge modules along with any preserved non-forge module statements.

Forge Modules Only

$ generate-puppetfile echocat/nfs rnelson0/certs

Installing modules. This may take a few minutes.


Your Puppetfile has been generated. Copy and paste between the markers:

=======================================================================
forge 'https://forge.puppet.com'

# Modules discovered by generate-puppetfile
mod 'echocat/nfs', '1.7.1'
mod 'herculesteam/augeasproviders_core', '2.1.2'
mod 'herculesteam/augeasproviders_shellvar', '2.2.0'
mod 'puppetlabs/concat', '1.2.4'
mod 'puppetlabs/stdlib', '4.9.0'
mod 'rnelson0/certs', '0.6.2'
# Discovered elements from existing Puppetfile
# Modules from github
mod 'lab_config',
  :git => '[email protected]:puppetinabox/lab_config.git'
=======================================================================

Using an existing Puppetfile

$ generate-puppetfile -p git/puppetinabox/controlrepo/Puppetfile

Installing modules. This may take a few minutes.


Your Puppetfile has been generated. Copy and paste between the markers:

=======================================================================
forge 'https://forge.puppet.com'

# Modules discovered by generate-puppetfile
mod 'ajjahn/dhcp', '0.2.0'
mod 'croddy/make', '0.0.5'
mod 'garethr/erlang', '0.3.0'
mod 'gentoo/portage', '2.3.0'
mod 'golja/gnupg', '1.2.1'
mod 'maestrodev/rvm', '1.12.1'
mod 'nanliu/staging', '1.0.3'
mod 'palli/createrepo', '1.1.0'
mod 'puppetlabs/activemq', '0.4.0'
mod 'puppetlabs/apache', '1.6.0'
mod 'puppetlabs/apt', '2.2.0'
mod 'puppetlabs/concat', '1.2.4'
mod 'puppetlabs/firewall', '1.7.1'
mod 'puppetlabs/gcc', '0.3.0'
mod 'puppetlabs/git', '0.4.0'
mod 'puppetlabs/inifile', '1.4.2'
mod 'puppetlabs/java', '1.4.2'
mod 'puppetlabs/java_ks', '1.3.1'
mod 'puppetlabs/lvm', '0.5.0'
mod 'puppetlabs/mcollective', '99.99.99'
mod 'puppetlabs/mysql', '3.6.1'
mod 'puppetlabs/ntp', '4.1.0'
mod 'puppetlabs/pe_gem', '0.1.1'
mod 'puppetlabs/postgresql', '4.6.0'
mod 'puppetlabs/puppetdb', '5.0.0'
mod 'puppetlabs/rabbitmq', '5.3.1'
mod 'puppetlabs/ruby', '0.4.0'
mod 'puppetlabs/stdlib', '4.9.0'
mod 'puppetlabs/tftp', '0.2.3'
mod 'puppetlabs/vcsrepo', '1.3.1'
mod 'puppetlabs/xinetd', '1.5.0'
mod 'richardc/datacat', '0.5.0'
mod 'rnelson0/certs', '0.6.2'
mod 'rnelson0/local_user', '1.0.1'
mod 'saz/ssh', '2.8.1'
mod 'saz/sudo', '3.1.0'
mod 'stahnma/epel', '1.1.1'
mod 'stephenrjohnson/puppet', '1.3.1'
mod 'thias/bind', '0.5.1'
mod 'yguenane/augeas', '0.1.1'
mod 'yguenane/ygrpms', '0.1.0'
mod 'zack/r10k', '3.1.1'
# Discovered elements from existing Puppetfile
# Modules from the Puppet Forge
# Modules from Github
mod 'lab_config',
  :git => '[email protected]:puppetinabox/lab_config.git'
=======================================================================

extending puppet modules & bolt projects

Due to the nature of the generate-puppetfile gem it makes an excellent tool for developing the Puppetfile for bolt projects. Seeing the simplest way to create a Bolt project is with the Puppet PDK this approach extends that use case. Add the following to your .sync.yml in a pdk managed module and run pdk update.zd

Gemfile:
  optional:
    ':development':
      - gem: 'generate-puppetfile'
        version: '~> 1.0

Add the following to /rakelib/generate_puppetfile.rake to create a rake target for the experimental pdk bundle feature. You can then use pdk bundle exec rake generate_puppetfile to generate the puppetfile based on the modules metadata.

require 'json'

desc 'generate puppetfile'
task :generate_puppetfile, [:mod] do |t, args| 
    args.with_defaults(:mod => JSON.parse(File.read('metadata.json'))['name'])
    sh "generate-puppetfile -c  #{args.mod}"
end

Add the following to /rakelib/generate_fixturesfile.rake to create a rake target for the experimental pdk bundle feature. You can then use pdk bundle exec rake generate_fixturesfile to generate the .fixtures.yaml based on the module metadata to aid in testing with the pdk test feature.

desc 'generate fixtures'
task :generate_fixturesfile do |t| 
    mod = JSON.parse(File.read('metadata.json'))['name']
    sh "generate-puppetfile -f -p ./Puppetfile #{mod} --fixtures-only -m #{mod}"
end

Limitations

  • There is no defined standard for a Puppetfile's contents. generate-puppetfile knows about some of the most common types of module references and attempts to treat them as references instead of strings. Any unknown references will be appended as raw content following the known references.
  • Verify that no ordering errors are introduced before using the new file.

Contributing

All issues and PRs are welcome!

puppet-generate-puppetfile's People

Contributors

abuxton avatar bartb avatar binford2k avatar nabertrand avatar rnelson0 avatar tomylobo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-generate-puppetfile's Issues

Versions with dashes fail to get parsed

mod 'dsc-securitypolicydsc', '2.10.0-0-5'

This version format does not get parsed by puppet-generate-puppetfile. When I remove the -0-5 part then it does get parsed by the regex, but then the command puppet module install ... fails because it cannot find the (short) version. It needs the -0-5 part.

Generate .fixtures.yml at the same time

See if there's a way to build a .fixtures.yml from the data. Build the file in parallel with the Puppetfile.

Optional: CLI argument that builds a .fixtures.yml from an existing Puppetfile.

mishandling Uppercase authors modules

seems version 1.0.0 mishandling modules with uppercase author name

Here is an example of the input file generated by version 0.11.0

forge 'http://forge.puppetlabs.com'

mod 'WhatsARanjit/node_manager', '0.6.0'
mod 'puppetlabs/inifile', '2.1.1'
mod 'puppetlabs/lvm', '1.0.0'
mod 'puppetlabs/ntp', '7.0.0'
mod 'puppetlabs/stdlib', '4.24.0'

version 1.0.0

mod 'puppetlabs/inifile', '2.1.1'
mod 'puppetlabs/lvm',     '1.0.0'
mod 'puppetlabs/ntp',     '7.0.0'
mod 'puppetlabs/stdlib',  '4.24.0'
mod 'WhatsARanjit/node_manager', '0.6.0'

nodemanager put in the bottom, instead of the top, and version number is misaligned

Feature: Check for puppet binary

Check that puppet is installed on the system and throw a graceful error.

ubuntu@dev:~/haproxy$ generate-puppetfile arioch/keepalived -d

Processing modules from the command line...


Listing discovered modules from CLI and/or Puppetfile:

    arioch/keepalived


Installing modules. This may take a few minutes.

Your Puppetfile has been generated. Copy and paste between the markers:

=======================================================================
forge 'http://forge.puppetlabs.com'

# Modules discovered by generate-puppetfile
=======================================================================



ubuntu@dev:~/haproxy$ sudo gem install puppet
Fetching: facter-2.4.4.gem (100%)
Fetching: json_pure-1.8.3.gem (100%)
Fetching: hiera-3.0.5.gem (100%)
Fetching: puppet-4.3.1.gem (100%)
Successfully installed facter-2.4.4
Successfully installed json_pure-1.8.3
Successfully installed hiera-3.0.5
Successfully installed puppet-4.3.1
4 gems installed
Installing ri documentation for facter-2.4.4...
Installing ri documentation for json_pure-1.8.3...
Installing ri documentation for hiera-3.0.5...
Installing ri documentation for puppet-4.3.1...
Installing RDoc documentation for facter-2.4.4...
Installing RDoc documentation for json_pure-1.8.3...
Installing RDoc documentation for hiera-3.0.5...
Installing RDoc documentation for puppet-4.3.1...



ubuntu@dev:~/haproxy$ generate-puppetfile arioch/keepalived

Installing modules. This may take a few minutes.

Your Puppetfile has been generated. Copy and paste between the markers:

=======================================================================
forge 'http://forge.puppetlabs.com'

# Modules discovered by generate-puppetfile
mod 'arioch/keepalived', '1.2.3'
mod 'puppetlabs/concat', '1.2.5'
mod 'puppetlabs/stdlib', '4.10.0'
=======================================================================

add an option to block a module

It would be convenient if there was some option to blacklist a module or freeze module to a certain version.

For instance, if you have only Redhat based servers, there is no reason to install puppetlabs/apt or gentoo/portage. 'freeze' a version also can be handy, for example, keep puppetlabs/firewall at version 1.8.1, since 1.8.2 doesn't properly handle IPv6.

Bug: invalid byte sequence in US-ASCII

This is my error log:

<abs/code/environments/production/modules# generate-puppetfile -p ./Puppetfile

Installing modules. This may take a few minutes.

/opt/puppetlabs/puppet/lib/ruby/gems/2.1.0/gems/generate-puppetfile-0.10.0/lib/generate_puppetfile/bin.rb:222:in gsub!': invalid byte sequence in US-ASCII (ArgumentError) from /opt/puppetlabs/puppet/lib/ruby/gems/2.1.0/gems/generate-puppetfile-0.10.0/lib/generate_puppetfile/bin.rb:222:in generate_module_data'
from /opt/puppetlabs/puppet/lib/ruby/gems/2.1.0/gems/generate-puppetfile-0.10.0/lib/generate_puppetfile/bin.rb:85:in run' from /opt/puppetlabs/puppet/lib/ruby/gems/2.1.0/gems/generate-puppetfile-0.10.0/bin/generate-puppetfile:6:in <top (required)>'
from /opt/puppetlabs/puppet/bin/generate-puppetfile:23:in load' from /opt/puppetlabs/puppet/bin/generate-puppetfile:23:in

'

I've tried:

export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

But the same issue remains.

The puppetfile should be fine because it works fine when executing with r10k:
<ppetlabs/code/environments/production# r10k puppetfile install --verbose
INFO -> Updating module /etc/puppetlabs/code/environments/production/modules/zabbix
INFO -> Updating module /etc/puppetlabs/code/environments/production/modules/chocolatey
INFO -> Updating module /etc/puppetlabs/code/environments/production/modules/stdlib
INFO -> Updating module /etc/puppetlabs/code/environments/production/modules/powershell
INFO -> Updating module /etc/puppetlabs/code/environments/production/modules/windows_env

mktemp message on OS X

There is an error when running from OS X, mktemp:

generate-puppetfile -p Puppetfile 
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix 

The following works

   TMPFILE=`mktemp -d /tmp/tmp.XXXXXX` || exit 1

Error check module downloads

Currently, the name of a module is checked for valid characters, but the results of puppet module install $module is not verified. This could result in a valid but non-existent module name and no visible error to the user.

Add support for git repos in .fixture.yml

Hi!

my usecase: I've a long Puppetfile in my control repo and would like to create a suitable .fixture.yml file based on that. I'm not sure if this is a suitable usecase for this gem. Parts of the functionality are already present so it may fit? I'm using git modules only and nothing from the forge. No changes on the puppetfile are needed, I only want to create my fixtures based on that.

failure to parse Puppetfile when colon is used

When a Puppetfile contains the following syntax

mod 'stdlib',
  git: '[email protected]:puppetlabs/puppetlabs-stdlib',
  ref: '4.25.1'

And the command is run generate-puppetfile -p Puppetfile --fixtures-only --modulename jboss

The fixtures file does not contain the stdlib module.

accept 'forge' style module name as an argument

Modules on puppet forge generally has the following instruction

puppet module install puppetlabs-ntp --version 6.0.0

It would be convenient if generate-pupptfile would accept module name as listed, currently it does not:

 $ generate-puppetfile puppetlabs-ntp
'puppetlabs-ntp' is not a valid module name. Skipping.

Filter comments in Puppetfile better

When using the -p <file> -c arguments, comments are not filtered very well and can result in duplication.

In particular, # Modules discovered by generate-puppetfile, which is generated when using generate-puppetfile for the first time, is not filtered out of the discovered elements section. Every future run results in an additional comment added to the bottom.

Is this a recursive lookup?

Are the package dependency lookups recursive? For example in the event that module A requires modules 1,2,3 and module 2 requires module B, does the requirement for module B in the output roll up to the final output?

forge parameter

Current Puppetfile uses internal forge as forge line... can this be grabbed for use generating a new Puppetfile? We have internal forge that we would be using to generate the Puppetfile against. Obviously any internal module won't be available when it goes out to the public forge so we need this to go against internal.

noop

Is there anyway to create a noop mode for this.
Trying to compare either working dir to Puppetfile with create puppetfile
and trying to compare Puppetfile -> .fixtures.yml (current vs what's to be changed).

So something like working modules has ntp 7.4.4 but Puppetfile has 7.0.0 or Puppetfile has 7.4.4 and fixtures has 7.0.0

I'm still trying to determine if should have a generate Puppetfile from .fixtures since .fixtures would technically come before Puppetfile during testing so maybe generate a Puppetfile or diff from what fixtures thinks should be in Puppetfile.

working dir -> Puppetfile
Puppetfile -> fixtures
fixtures -> Puppetfile?

Generated Puppetfile missing quotes around module name

When I run generate-puppetfile the output seems to lack quotes around the module name, resulting in an incorrect Puppetfile.

For example:

$ generate-puppetfile saz/sudo
... snip...
mod puppetlabs/stdlib, '4.12.0'
mod saz/sudo, '3.1.0'

I think this was introduced in e7d8bee.

Support Puppet 6

Puppet 6 moved some once-core modules to separate repos. The puppet-agent typically provides those modules and they do not need to be listed in the Puppetfile (unless specifying a different version than the agent provides) and should not be listed when there are Puppet 5 agents connecting to the master. However, they need to be in the .fixtures.yml for testing.

We need an option to create the fixtures settings for the core modules. An additional option could add/remove them to/from the Puppetfile.

We must also consider the case where the Puppetfile specifies a subset of those modules, but not all, and ensure that the resulting fixtures specifies the Puppetfile version, not the default/latest versions.

Add --silent flag

When run in silent mode, a Puppetfile should be written to the current directory. This is useful for non-interactive usage. No output is generated to STDOUT except debug information when --debug is present. The option description should warn users of the impact of using both flags.

Add support for updating from git

Currently, this module only works with the forge versions of modules. Can this also have git functionality? For example, if I want to update all of my modules to the latest HEAD.

Example:

mod 'archive',
        :git    => 'https://github.com/voxpupuli/puppet-archive.git',
        :commit => 'f382f2d199574590739394050302f626056ad15e'

mod 'auditd',
        :git    => 'https://github.com/kemra102/puppet-auditd.git',
        :commit => '9958c76401085e96bf1b70bc059770b93c2585a0'
joseph.yaworski@jyaworski-mbpr ~ % git ls-remote https://github.com/voxpupuli/puppet-archive.git HEAD
24eace7915d1f08148a040d474cf4b2f72558779    HEAD

joseph.yaworski@jyaworski-mbpr ~ % git ls-remote https://github.com/kemra102/puppet-auditd.git HEAD
9958c76401085e96bf1b70bc059770b93c2585a0    HEAD

generate-puppetfile downgrades existing Puppetfile

I receive strange results. here is the original file

#
# Forge modules
#
forge 'http://forge.puppetlabs.com'

mod 'puppet/extlib', '1.1.0'
mod 'puppet/make', '1.1.0'
mod 'puppet/puppetboard', '2.9.0'
mod 'puppet/r10k', '5.0.2'
mod 'puppetlabs/apache', '1.11.0'
mod 'puppetlabs/concat', '2.2.1'
mod 'puppetlabs/gcc', '0.3.0'
mod 'puppetlabs/git', '0.5.0'
mod 'puppetlabs/inifile', '1.6.0'
mod 'puppetlabs/java', '1.6.0'
mod 'puppetlabs/ntp', '6.1.0'
mod 'puppetlabs/postgresql', '4.9.0'
mod 'puppetlabs/puppetdb', '5.1.2'
mod 'puppetlabs/puppetserver_gem', '0.2.0'
mod 'puppetlabs/ruby', '0.6.0'
mod 'puppetlabs/stdlib', '4.16.0'
mod 'puppetlabs/vcsrepo', '1.5.0'
mod 'stahnma/epel', '1.2.2'
mod 'theforeman/puppet', '7.1.1'
#
# Github modules
#
mod 'mcollective',
  :git    => 'https://github.com/vchepkov/puppet-mcollective.git',
  :branch => 'development'
mod 'python',
  :git    => 'https://github.com/vchepkov/puppet-python.git',
  :branch => 'setuptools34'

Here is the output

$ generate-puppetfile -p Puppetfile 

Installing modules. This may take a few minutes.

Your Puppetfile has been generated. Copy and paste between the markers:

=======================================================================
forge 'http://forge.puppetlabs.com'

# Modules discovered by generate-puppetfile
mod 'gentoo/portage', '2.3.0'
mod 'puppet/extlib', '1.1.0'
mod 'puppet/make', '1.1.0'
mod 'puppet/puppetboard', '2.9.0'
mod 'puppet/r10k', '5.0.2'
mod 'puppetlabs/apache', '1.3.0'
mod 'puppetlabs/concat', '4.0.0'
mod 'puppetlabs/gcc', '0.3.0'
mod 'puppetlabs/git', '0.5.0'
mod 'puppetlabs/inifile', '1.6.0'
mod 'puppetlabs/java', '1.6.0'
mod 'puppetlabs/ntp', '6.1.0'
mod 'puppetlabs/puppetserver_gem', '0.2.0'
mod 'puppetlabs/ruby', '0.6.0'
mod 'puppetlabs/stdlib', '4.16.0'
mod 'puppetlabs/vcsrepo', '1.5.0'
mod 'stahnma/epel', '1.2.2'
mod 'stankevich/python', '1.18.2'
mod 'theforeman/concat_native', '1.5.0'
mod 'theforeman/puppet', '3.0.0'
# Discovered elements from existing Puppetfile
#
# Forge modules
#
#
# Github modules
#
mod 'mcollective',
  :git    => 'https://github.com/vchepkov/puppet-mcollective.git',
  :branch => 'development'
mod 'python',
  :git    => 'https://github.com/vchepkov/puppet-python.git',
  :branch => 'setuptools34'
=======================================================================

As you can see it downgrades apache and puppet for some reasons

Bug: Incorrect dependency version

I have the following base puppetfile

mod 'puppetlabs/activemq', '0.4.0'
mod 'puppetlabs/apt', '2.2.2'
mod 'puppetlabs/catalog_preview', '2.1.0'
mod 'puppetlabs/git', '0.5.0'
mod 'puppetlabs/haproxy', '1.0.0'
mod 'puppetlabs/mcollective', '2.0.0'
mod 'puppetlabs/puppetdb', '4.0.0'
mod 'puppetlabs/ruby', '0.4.0'
mod 'puppetlabs/stdlib', '4.12.0'

mod 'richardc/datacat', '0.5.0'
mod 'torrancew/cron', '0.2.1'
mod 'zack/r10k', '3.2.0'

mod 'openstack_infra-puppet_pip',
    :git => 'https://github.com/openstack-infra/puppet-pip.git',
    :ref => 'adf639e'
mod 'jk2l-zabbix',
    :git => 'https://github.com/jk2l/puppet-zabbix.git',
    :ref => '9114e65d7edc868caa3e43f455667d85e02c07e3'

it generated me the following output

Your Puppetfile has been generated. Copy and paste between the markers:

=======================================================================
forge 'http://forge.puppetlabs.com'

# Modules discovered by generate-puppetfile
mod 'croddy/make', '0.0.5'
mod 'gentoo/portage', '2.3.0'
mod 'puppetlabs/activemq', '0.4.0'
mod 'puppetlabs/apt', '2.2.2'
mod 'puppetlabs/catalog_preview', '2.1.0'
mod 'puppetlabs/concat', '2.2.0'
mod 'puppetlabs/firewall', '1.8.1'
mod 'puppetlabs/gcc', '0.3.0'
mod 'puppetlabs/git', '0.5.0'
mod 'puppetlabs/haproxy', '1.5.0'
mod 'puppetlabs/inifile', '1.5.0'
mod 'puppetlabs/java', '1.6.0'
mod 'puppetlabs/mcollective', '0.1.8'
mod 'puppetlabs/pe_gem', '0.2.0'
mod 'puppetlabs/postgresql', '4.8.0'
mod 'puppetlabs/puppetdb', '5.1.2'
mod 'puppetlabs/ruby', '0.5.0'
mod 'puppetlabs/stdlib', '4.12.0'
mod 'puppetlabs/vcsrepo', '1.3.2'
mod 'richardc/datacat', '0.6.2'
mod 'torrancew/cron', '0.2.1'
mod 'zack/r10k', '3.2.0'
# Discovered elements from existing Puppetfile
# The modules actually required by our repo without all dependency added
# This is a more clean version of puppetfile
mod 'openstack_infra-puppet_pip',
    :git => 'https://github.com/openstack-infra/puppet-pip.git',
    :ref => 'adf639e'
mod 'jk2l-zabbix',
    :git => 'https://github.com/jk2l/puppet-zabbix.git',
    :ref => '9114e65d7edc868caa3e43f455667d85e02c07e3'
=======================================================================

The input puppetfile specifically stated 'puppetlabs/mcollective', '2.0.0', but it generated a puppetfile using '0.1.8'

Add support for 'mirroring' a Puppetfile into a .fixtures.yaml file

My use case is spec testing my 'role' module.
It'd be great if the exact versions of both git and forge modules that exist in a Puppetfile could be converted in to a .fixtures file that can be used.

My role spec tests are very simple. They just check that each role compiles.

Features: Remove all comments

My base puppetfile have some comments to mention what part of system they require or maybe TODO to comments for remove after certain features drop. The output file now turn out to be a bit ugly. maybe remove the comments off source file? or don't move the module to upper section

# General overall comments

# Comment A
mod 'puppetlabs/activemq',              '0.4.0'
mod 'puppetlabs/apt',                   '2.2.2'
mod 'puppetlabs/catalog_preview',       '2.1.0'
mod 'puppetlabs/git',                   '0.5.0'
mod 'puppetlabs/haproxy',               '1.0.0'
mod 'puppetlabs/puppetdb',              '4.0.0'
mod 'puppetlabs/ruby',                  '0.4.0'
mod 'puppetlabs/stdlib',                '4.12.0'

# Comment B
mod 'elasticsearch-logstashforwarder',  '0.1.1'

# Comment C
mod 'puppet/mcollective',               '2.2.0'
mod 'puppet/puppetboard',               '2.8.2'

# Comment D
mod 'cwood/uwsgi',                      '0.2.2'
mod 'richardc/datacat',                 '0.6.2'
mod 'torrancew/cron',                   '0.2.1'
mod 'zack/r10k',                        '3.2.0'

mod 'openstack_infra-pip',
    :git => 'https://github.com/openstack-infra/puppet-pip.git',
    :ref => 'adf639e'
mod 'jk2l-zabbix',
    :git => 'https://github.com/voxpupuli/puppet-zabbix.git',
    :ref => '577cb892494ff61b5d3d4aee3646e7251cef84fa'
forge 'http://forge.puppetlabs.com'

# Modules discovered by generate-puppetfile
mod 'croddy/make', '0.0.5'
mod 'cwood/uwsgi', '0.2.2'
mod 'gentoo/portage', '2.3.0'
mod 'puppet/mcollective', '2.2.0'
mod 'puppet/puppetboard', '2.8.2'
mod 'puppetlabs/activemq', '0.4.0'
mod 'puppetlabs/apt', '2.2.2'
mod 'puppetlabs/catalog_preview', '2.1.0'
mod 'puppetlabs/concat', '2.2.0'
mod 'puppetlabs/firewall', '1.8.1'
mod 'puppetlabs/gcc', '0.3.0'
mod 'puppetlabs/git', '0.5.0'
mod 'puppetlabs/haproxy', '1.5.0'
mod 'puppetlabs/inifile', '1.5.0'
mod 'puppetlabs/java', '1.6.0'
mod 'puppetlabs/pe_gem', '0.2.0'
mod 'puppetlabs/postgresql', '4.8.0'
mod 'puppetlabs/puppetdb', '5.1.2'
mod 'puppetlabs/ruby', '0.5.0'
mod 'puppetlabs/stdlib', '4.12.0'
mod 'puppetlabs/vcsrepo', '1.3.2'
mod 'richardc/datacat', '0.6.2'
mod 'stahnma/epel', '1.2.2'
mod 'stankevich/python', '1.14.0'
mod 'torrancew/cron', '0.2.1'
mod 'zack/r10k', '3.2.0'
# Discovered elements from existing Puppetfile
# General overall comments
# Comment A
# Comment B
mod 'elasticsearch-logstashforwarder',  '0.1.1'
# Comment C
# Comment D
mod 'openstack_infra-pip',
    :git => 'https://github.com/openstack-infra/puppet-pip.git',
    :ref => 'adf639e'
mod 'jk2l-zabbix',
    :git => 'https://github.com/voxpupuli/puppet-zabbix.git',
    :ref => '577cb892494ff61b5d3d4aee3646e7251cef84fa'

Fixtures: add symlinks to the fixtures

To support a fixtures file at the top of a controlrepo, populate the fixtures file with symlinks from the modulepath if an environment.conf is present.

Add Windows support

generate-puppetfile jhg03a/accountfacts -d

Processing modules from the command line...


Listing discovered modules from CLI and/or Puppetfile:

    jhg03a/accountfacts


Installing modules. This may take a few minutes.
Calling 'puppet module install jhg03a/accountfacts --modulepath C:/Users/JONATH~1.GRA/AppData/Local/Temp/d20160503-12340-1qmhzw1 >/dev/null 2>&1 '
The system cannot find the path specified.
There was a problem with the module name 'jhg03a/accountfacts'.
  Check that module exists as you spelled it and/or your connectivity to the puppet forge.

Add Rake Tasks to gem

Can you add rake tasks to this gem?

Similar to https://github.com/rodjek/puppet-lint/tree/master/lib/puppet-lint/tasks

Then you could do the following in .sync.yml:

Rakefile:
  requires:
    - puppet-lint/tasks/puppet-lint:
      require: puppet-lint/tasks/puppet-lint
      conditional: Bundler.rubygems.find_name('puppet-lint').any?
    - generate-puppetfile/tasks/generate_puppetfile:
      require: generate-puppetfile/tasks/generate_puppetfile
      conditional: Bundler.rubygems.find_name('generate-puppetfile').any?
    - generate-puppetfile/tasks/generate_fixturesfile:
      require: generate-puppetfile/tasks/generate_fixturesfile
      conditional: Bundler.rubygems.find_name('generate-puppetfile').any?

generate-puppetfile ignores Git modules whose name contains a slash

It seems that if a non-Forge module contains a slash in its name, generate-puppetfile assumes it must be a Forge module, fails to find it on the Forge, removes it from the output, and consequently generates a broken Puppetfile.

Input Puppetfile:

forge 'http://forge.puppetlabs.com'

mod 'puppetlabs/stdlib', '4.17.1'
mod 'pbg/ntp',
  :git => 'https://github.com/bitfield/pbg-ntp.git',
  :tag => '0.1.1'

Output:

/opt/puppetlabs/puppet/bin/generate-puppetfile -p /etc/puppetlabs/code/environments/pbg/Puppetfile.test

Installing modules. This may take a few minutes.

There was a problem with the module name 'pbg/ntp'.
  Check that modules exist as under the listed name, and/or your connectivity to the puppet forge.

Here is the PARTIAL Puppetfile that would have been generated.



Your Puppetfile has been generated. Copy and paste between the markers:

=======================================================================
forge 'http://forge.puppetlabs.com'

# Modules discovered by generate-puppetfile
mod 'puppetlabs/stdlib', '4.17.1'
# Discovered elements from existing Puppetfile
  :git => 'https://github.com/bitfield/pbg-ntp.git',
  :tag => '0.1.1'
=======================================================================

As you can see, the line mod 'pbg/ntp', has been omitted from the output, resulting in an invalid Puppetfile:

/opt/puppetlabs/puppet/bin/r10k puppetfile check
Failed to evaluate /etc/puppetlabs/code/environments/pbg/Puppetfile
Original exception:
/etc/puppetlabs/code/environments/pbg/Puppetfile:6: syntax error, unexpected =>, expecting end-of-input
:git => 'https://github.com/bitfield/
       ^

I am guessing that the slash is the culprit; if I change it to a hyphen, the problem does not occur.

I suggest that if a module has a :git attribute, it is not a Forge module, and generate-puppetfile should not attempt to look for it there. Alternatively, if a module is not found, rather than dropping it from the output, perhaps generate-puppetfile should simply pass it through untouched as a 'discovered element'.

Unsecure forge url for generated Puppetfile

I'm fairly new to Puppetfile, so forgive me if what I'm writing is rubbish. :)

When I call something like generate-puppetfile puppetlabs-docker the output will contain this line:

forge 'http://forge.puppetlabs.com'

This URL is not secure because it says http instead of https.

Also, I think it should read https://forge.puppet.com nowadays (no longer puppetlabs.com).

I've found two occurrences of the correct URL in bin.rb - so I guess you've just overlooked this one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.