[DRE-commits] [librarian-puppet] 18/153: Can't pass the Puppet Forge v1 api url to clients using v3 (3.6.0+ and PE 3.2.0+)
Stig Sandbeck Mathisen
ssm at debian.org
Wed Jun 1 20:30:34 UTC 2016
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository librarian-puppet.
commit b01c8c584832bbc490aa7357c8510009f582296b
Author: Carlos Sanchez <csanchez at maestrodev.com>
Date: Wed Jun 25 12:31:00 2014 +0200
Can't pass the Puppet Forge v1 api url to clients using v3 (3.6.0+ and PE 3.2.0+)
---
Changelog.md | 3 +++
lib/librarian/puppet/source/forge/repo.rb | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Changelog.md b/Changelog.md
index ff775eb..7db7807 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,6 +4,7 @@
* [Issue #231](https://github.com/rodjek/librarian-puppet/issues/231) Only use the GITHUB_API_TOKEN if it's not empty
* [Issue #233](https://github.com/rodjek/librarian-puppet/issues/233) Fix version regex to match e.g. 1.99.15
+ * Can't pass the Puppet Forge v1 api url to clients using v3 (3.6.0+ and PE 3.2.0+)
### 1.1.1
@@ -14,10 +15,12 @@
* [Issue #210](https://github.com/rodjek/librarian-puppet/issues/210) Use forgeapi.puppetlabs.com and API v3
* Accesing the v3 API requires Ruby 1.9 due to the puppet_forge library used
+
### 1.0.4
* [Issue #231](https://github.com/rodjek/librarian-puppet/issues/231) Only use the GITHUB_API_TOKEN if it's not empty
* [Issue #233](https://github.com/rodjek/librarian-puppet/issues/233) Fix version regex to match e.g. 1.99.15
+ * Can't pass the Puppet Forge v1 api url to clients using v3 (3.6.0+ and PE 3.2.0+)
### 1.0.3
diff --git a/lib/librarian/puppet/source/forge/repo.rb b/lib/librarian/puppet/source/forge/repo.rb
index 7365e2d..186c2c5 100644
--- a/lib/librarian/puppet/source/forge/repo.rb
+++ b/lib/librarian/puppet/source/forge/repo.rb
@@ -86,8 +86,16 @@ module Librarian
target = vendored?(name, version) ? vendored_path(name, version).to_s : name
- # TODO can't pass the default v3 forge url (http://forgeapi.puppetlabs.com) to clients that use the v1 API (https://forge.puppetlabs.com)
+ # can't pass the default v3 forge url (http://forgeapi.puppetlabs.com)
+ # to clients that use the v1 API (https://forge.puppetlabs.com)
+ # nor the other way around
module_repository = source.to_s
+
+ if Forge.client_api_version() > 1 and module_repository =~ %r{^http(s)?://forge\.puppetlabs\.com}
+ module_repository = "https://forgeapi.puppetlabs.com"
+ warn { "Replacing Puppet Forge API URL to use v3 #{module_repository} as required by your client version #{Librarian::Puppet.puppet_version}" }
+ end
+
m = module_repository.match(%r{^http(s)?://forgeapi\.puppetlabs\.com})
if Forge.client_api_version() == 1 and m
ssl = m[1]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/librarian-puppet.git
More information about the Pkg-ruby-extras-commits
mailing list