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

fix #237 add install flag for using the v3 forge api #238

Merged
merged 3 commits into from
Jul 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ source specified. This command writes the complete resolution into
`Puppetfile.lock` and then copies all of the fetched modules into your
`modules/` directory, overwriting whatever was there before.

Librarian-puppet support both v1 and v3 of the Puppet Forge API.
Specify a specific API version when installing modules:

$ librarian-puppet install --use-v1-api # this is default
$ librarian-puppet install --no-use-v1-api # use the v3 API

Please note that this does not apply for the official Puppet Forge where v3 is used by default.

Get an overview of your `Puppetfile.lock` with:

$ librarian-puppet show
Expand Down
2 changes: 2 additions & 0 deletions lib/librarian/puppet/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def init
option "path", :type => :string
option "destructive", :type => :boolean, :default => false
option "local", :type => :boolean, :default => false
option "use-v1-api", :type => :boolean, :default => true
def install

unless File.exist?('Puppetfile')
Expand All @@ -64,6 +65,7 @@ def install
environment.config_db.local["path"] = options["path"]
end

environment.config_db.local['use-v1-api'] = options['use-v1-api'] ? '1' : nil
environment.config_db.local['mode'] = options['local'] ? 'local' : nil

resolve!
Expand Down
3 changes: 3 additions & 0 deletions lib/librarian/puppet/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def local?
config_db['mode'] == 'local'
end

def use_v1_api
config_db['use-v1-api']
end
end
end
end
3 changes: 2 additions & 1 deletion lib/librarian/puppet/source/forge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ def manifests(name)

def repo(name)
@repo ||= {}

unless @repo[name]
# if we are using the official Forge then use API v3, otherwise stick to v1 for now
if uri.hostname =~ /\.puppetlabs\.com$/
if uri.hostname =~ /\.puppetlabs\.com$/ || !environment.use_v1_api
@repo[name] = RepoV3.new(self, name)
else
@repo[name] = RepoV1.new(self, name)
Expand Down