librarian-puppet
librarian-puppet copied to clipboard
Add --puppetfile option to the cli
Bundler can do bundle install --gemfile=/path/to/Gemfile
(and also responds to the BUNDLER_GEMFILE
environment variable). It might be nice to have similar functionality in librarian-puppet
so that one may install dependencies without having to change into the directory that contains the Puppetfile
.
I run my Puppets master-less, and use cron to apply updates, so this would help me a bunch. If this seems reasonable and is a change that should be made on this repository, I'd be happy to work on a pull request (but figured I'd ask first). Until then, I'll just have my cron task cd
into the directory.
it sounds reasonable, I'd use that too ;)
:thumbsup: me too
Cool, I'll see if I can't put something together in the next few days.
I need this in 1.0 as 1.1 is not supported in CentOS 6.X.
If it's done, I'll try to backport... any chance it will be merged in a 1.0.x release?
yes, I'm planning to keep 1.0.x updated for a while if it doesn't get too cumbersome
:+1:
Is this finally happening anytime soon?
I'm greping thru the code and the only references in non-test/non-documentation I can see are:
unless File.exist?('Puppetfile')
say "Could not find Puppetfile in #{Dir.pwd}", :red
exit 1
end
in the cli.rb... but that's just a check, I don't know from where it's taking the Puppetfile name...
In librarian:
def default_specfile_name
@default_specfile_name ||= begin
capped = adapter_name.capitalize
"#{capped}file"
end
end
I haven't gotten a chance to circle back around to this but should be able to soon — Eric Marden
On Fri, Jul 18, 2014 at 7:49 AM, Francisco A. Lozano [email protected] wrote:
In librarian:
def default_specfile_name @default_specfile_name ||= begin capped = adapter_name.capitalize "#{capped}file" end end
Reply to this email directly or view it on GitHub: https://github.com/rodjek/librarian-puppet/issues/226#issuecomment-49426719
ok, thank you
this issue has no bee touched in awhile, but thoughts on something like the following?
diff --git a/lib/librarian/puppet/cli.rb b/lib/librarian/puppet/cli.rb
index afb8e88..de864e4 100644
--- a/lib/librarian/puppet/cli.rb
+++ b/lib/librarian/puppet/cli.rb
@@ -47,6 +47,7 @@ module Librarian
option "destructive", :type => :boolean, :default => false
option "local", :type => :boolean, :default => false
option "use-v1-api", :type => :boolean, :default => true
+ option "puppetfile", :type => :string
def install
ensure!
@@ -61,6 +62,9 @@ module Librarian
if options.include?("path")
environment.config_db.local["path"] = options["path"]
end
+ if options.include?("puppetfile")
+ ENV["PUPPETFILE"] = options["puppetfile"]
+ end
environment.config_db.local['use-v1-api'] = options['use-v1-api'] ? '1' : nil
environment.config_db.local['mode'] = options['local'] ? 'local' : nil
diff --git a/lib/librarian/puppet/environment.rb b/lib/librarian/puppet/environment.rb
index d502415..73cdd30 100644
--- a/lib/librarian/puppet/environment.rb
+++ b/lib/librarian/puppet/environment.rb
@@ -11,6 +11,17 @@ module Librarian
"puppet"
end
+ def default_specfile_name
+ @default_specfile_name ||= begin
+ if ENV["PUPPETFILE"]
+ ENV["PUPPETFILE"]
+ else
+ capped = adapter_name.capitalize
+ "#{capped}file"
+ end
+ end
+ end
+
def lockfile
Lockfile.new(self, lockfile_path)
end