rnelson0 / puppet-generate-puppetfile

Generate or update a Puppetfile for use with r10k or librarian-puppet. Optionally, create a fixtures file for rspec-puppet.
92 stars 22 forks source link

Bug: Incorrect dependency version #43

Closed jk2l closed 7 years ago

jk2l commented 7 years ago

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'

jk2l commented 7 years ago

It seem 'puppetlabs/mcollective', '2.0.0' conflict with 'richardc/datacat', '0.5.0' and my zabbix

update to 'puppet/mcollective', '2.2.0' fix it. It will be good if they have dependency conflict show up. i only found the issue when i test my puppetfile with librarian-puppet

rnelson0 commented 7 years ago

Can you provide the command line you used to generate the output file?

jk2l commented 7 years ago

generate-puppetfile -c -p Puppetfile_base the base file is the same as first one i posted you

rnelson0 commented 7 years ago

generate-puppetfile relies on the puppet module tool (PMT) and runs puppet module install $module on every given name, without specifying the version number, in the order they're discovered. So when mcollective is being installed, the module list is:

$ puppet module list --modulepath=/tmp/tmp.pmL8X1MAZy
/tmp/tmp.pmL8X1MAZy
├── puppetlabs-activemq (v0.4.0)
├── puppetlabs-apt (v2.3.0)
├── puppetlabs-catalog_preview (v2.2.0)
├── puppetlabs-concat (v2.2.0)
├── puppetlabs-git (v0.5.0)
├── puppetlabs-haproxy (v1.5.0)
├── puppetlabs-java (v1.6.0)
└── puppetlabs-stdlib (v4.15.0)

When you try and install mcollective, it starts with the latest version, in this case version 99.99.99. Per the dependencies at https://forge.puppet.com/puppetlabs/mcollective/dependencies:

You can see that it requires concat v1 but 2.2.0 is installed. That results in an obvious conflict that is resolved with version 0.1.8 somehow:

$ puppet module install --modulepath /tmp/tmp.pmL8X1MAZy puppetlabs/mcollective
Notice: Preparing to install into /tmp/tmp.pmL8X1MAZy ...
Notice: Downloading from https://forgeapi.puppet.com ...
Info: Resolving dependencies ...
Info: Preparing to install ...
Notice: Installing -- do not interrupt ...
/tmp/tmp.pmL8X1MAZy
└─┬ puppetlabs-mcollective (v0.1.8)
  └── puppetlabs-stdlib (v4.15.0)

If we uninstall the mcollective module and try to force installation of 2.0.0, we get a failure:

$ puppet module install --modulepath /tmp/tmp.pmL8X1MAZy puppetlabs/mcollective --version 2.0.0
Notice: Preparing to install into /tmp/tmp.pmL8X1MAZy ...
Notice: Downloading from https://forgeapi.puppet.com ...
Info: Resolving dependencies ...
Error: Could not install module 'puppetlabs-mcollective' (???)
  No version of 'puppetlabs-mcollective' can satisfy all dependencies
    Use `puppet module install --ignore-dependencies` to install only this module

You can try versions all the way back to 1.0.0 and it does not work. Only 0.1.8 satisfies it. There must be something in the dependency train that is a problem.

Now, the good news is that there's a modern mcollective version you can use. When a module version is 99.99.99 or 999.999.999, it indicates a deprecated module. The replacement is puppet/mcollective and its version 2.5.0 works fine.

$ cat 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 'puppet/mcollective', '2.0.0'
mod 'puppetlabs/puppetdb', '4.0.0'
mod 'puppetlabs/ruby', '0.4.0'
mod 'puppetlabs/stdlib', '4.12.0'

mod 'torrancew/cron', '0.2.1'
mod 'zack/r10k', '3.2.0'

$ be generate-puppetfile -p Puppetfile

Installing modules. This may take a few minutes.

Module croddy/make has a version of 999.999.999, it may be deprecated. For more information, visit https://forge.puppet.com/croddy/make
Module zack/r10k has a version of 999.999.999, it may be deprecated. For more information, visit https://forge.puppet.com/zack/r10k

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

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

# Modules discovered by generate-puppetfile
mod 'croddy/make', '999.999.999'
mod 'gentoo/portage', '2.3.0'
mod 'puppet/mcollective', '2.5.0'
mod 'puppetlabs/activemq', '0.4.0'
mod 'puppetlabs/apt', '2.3.0'
mod 'puppetlabs/catalog_preview', '2.2.0'
mod 'puppetlabs/concat', '2.2.0'
mod 'puppetlabs/firewall', '1.8.2'
mod 'puppetlabs/gcc', '0.3.0'
mod 'puppetlabs/git', '0.5.0'
mod 'puppetlabs/haproxy', '1.5.0'
mod 'puppetlabs/inifile', '1.6.0'
mod 'puppetlabs/java', '1.6.0'
mod 'puppetlabs/pe_gem', '0.2.0'
mod 'puppetlabs/postgresql', '4.9.0'
mod 'puppetlabs/puppetdb', '5.1.2'
mod 'puppetlabs/ruby', '0.6.0'
mod 'puppetlabs/stdlib', '4.15.0'
mod 'puppetlabs/vcsrepo', '1.5.0'
mod 'richardc/datacat', '0.6.2'
mod 'torrancew/cron', '0.2.1'
mod 'zack/r10k', '999.999.999'

You'll notice that croddy/make and zack/r10k have the same issue; they've been replaced with puppet/make and puppet/r10k. Rename those and you'll be okay.

rnelson0 commented 7 years ago

@jk2l Sorry for the long delay in response on this issue!