rodjek / librarian-puppet

http://librarian-puppet.com
MIT License
693 stars 209 forks source link

Need --exclude switch on install target to avoid duplicate installations #290

Open hesco opened 9 years ago

hesco commented 9 years ago

The use case I face at the moment involves developing and testing new in-house modules not intended for release of their proprietary business rules to the forge. Automating rspec-puppet and serverspec tests on this code requires creating an environment with both forge hosted modules from the public domain and in-house hosted modules. Some of those in-house modules have dependencies on still others hosted on the forge. Setting up that test framework looks like this:

#!/bin/bash

if [[ $1 == '' ]]
then 
  TARGET='install --path=modules'
  /bin/echo "USAGE: Defaulting to install target for modules path"
else
  TARGET=$1
fi

LIBRARIAN=/usr/bin/librarian-puppet

echo 'Build dependencies from puppet forge.'
cd etc/puppet
$LIBRARIAN $TARGET
cd - 

echo 'Build dependencies from the internal code base.'
cd etc/puppet/environments/production
$LIBRARIAN $TARGET
cd - 

exit 0

Consequently I would like to run:

librarian-puppet install --exclude=../../modules --path=modules

and have it do the right thing to avoid the duplicate installation of forge modules, so I do not wind up with stdlib being installed at both /etc/puppet/modules (where I want to see it) and /etc/puppet/environments/production/modules, where its presence poses a threat of hard to resolve bugs.

Would appreciate such a contribution from anyone so inclined, or in case the team might see this as germane to this client's priorities and thus a suitable use of the time they pay me for, then folks feedback on this.

hesco commented 9 years ago

Perhaps another way to resolve my issue and satisfy my use case would be the addition of a --no-follow switch, so I could specify on the install target invocation that for these in-house modules I do not want the dependency chain followed; that it should only install those items explicitly listed in the Puppetfile.

carlossg commented 9 years ago

why not run librarian puppet to get all the modules and then move the ones you want to a different folder?

hesco commented 9 years ago

that is my current work-around, but is less than elegant. I think of my first suggestion: with the --exclude switch as the most elegant and natural and generally useful implementation.