librarian-puppet 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbe00d37667721e7a61be8fb75277e88f75dec0d
4
- data.tar.gz: 6655c8212fe01704c529ea35fcbc7ada5ed14a1b
3
+ metadata.gz: ef4fd59f2a6e41ed320ea0bb94eb6374af121092
4
+ data.tar.gz: a8575338727993713ef495723986d28e71007244
5
5
  SHA512:
6
- metadata.gz: 41f48efc10bb44b6ab924bc2040d686264a1e74ee58f1a179bf23552e4947df3f2b94251fc92d96ad3ada0ad2fe3bada5c765a5ff7f174c2da67b1fe69f9a44e
7
- data.tar.gz: 59f9a5784cf4c0f801806c6821cf5c7ca33fbb577022ef6fcdae428d932d24ff918e0692bee4a8aebe9cab60de901de9d2f40a90587aaf9a008475d41c3c7f4f
6
+ metadata.gz: d006b91e46d7c964aacbeed2a88e4e385e9c8357e1a9f2920dced67d008ee0acba6d868f7dffccca7acc5ddc0642de1e43f680a96a7379b8f0b767090fe3222a
7
+ data.tar.gz: 666b2ee1a3d469fd23272495d228a9d6c64b8df70a2e7ae9a29ef8eee64bee06fca3bfdb495e06b23757413263c93d993bb637309ea292c127f8845c48097396
@@ -91,7 +91,7 @@ module Librarian
91
91
 
92
92
  command = %W{puppet module install --version #{version} --target-dir}
93
93
  command.push(*[path.to_s, "--module_repository", module_repository, "--modulepath", path.to_s, "--module_working_dir", path.to_s, "--ignore-dependencies", target])
94
- debug { "Executing puppet module install for #{name} #{version}" }
94
+ debug { "Executing puppet module install for #{name} #{version}: #{command.join(" ")}" }
95
95
 
96
96
  begin
97
97
  Librarian::Posix.run!(command)
@@ -136,11 +136,34 @@ module Librarian
136
136
 
137
137
  private
138
138
 
139
+ # Issue #223 dependencies may be duplicated
140
+ def clear_duplicated_dependencies(data)
141
+ return nil if data.nil?
142
+ data.each do |m,versions|
143
+ versions.each do |v|
144
+ if v["dependencies"] and !v["dependencies"].empty?
145
+ dependency_names = v["dependencies"].map {|d| d[0]}
146
+ duplicated = dependency_names.select{ |e| dependency_names.count(e) > 1 }
147
+ unless duplicated.empty?
148
+ duplicated.uniq.each do |module_duplicated|
149
+ to_remove = []
150
+ v["dependencies"].each_index{|i| to_remove << i if module_duplicated == v["dependencies"][i][0]}
151
+ warn { "Module #{m}@#{v["version"]} contains duplicated dependencies for #{module_duplicated}, ignoring all but the first of #{to_remove.map {|i| v["dependencies"][i]}}" }
152
+ to_remove.slice(1..-1).reverse.each {|i| v["dependencies"].delete_at(i) }
153
+ v["dependencies"] = v["dependencies"] - to_remove.slice(1..-1)
154
+ end
155
+ end
156
+ end
157
+ end
158
+ end
159
+ data
160
+ end
161
+
139
162
  # get and cache the API data for a specific module with all its versions and dependencies
140
163
  def api_data(module_name)
141
164
  return @api_data[module_name] if @api_data
142
165
  # call API and cache data
143
- @api_data = api_call(module_name)
166
+ @api_data = clear_duplicated_dependencies(api_call(module_name))
144
167
  if @api_data.nil?
145
168
  raise Error, "Unable to find module '#{name}' on #{source}"
146
169
  end
@@ -152,7 +175,7 @@ module Librarian
152
175
  # if we already got all the versions, find in cached data
153
176
  return @api_data[module_name].detect{|x| x['version'] == version.to_s} if @api_data
154
177
  # otherwise call the api for this version if not cached already
155
- @api_version_data[version] = api_call(name, version) if @api_version_data[version].nil?
178
+ @api_version_data[version] = clear_duplicated_dependencies(api_call(name, version)) if @api_version_data[version].nil?
156
179
  @api_version_data[version]
157
180
  end
158
181
 
@@ -28,10 +28,14 @@ module Librarian
28
28
  return vendor_checkout! if vendor_cached?
29
29
 
30
30
  if environment.local?
31
- raise Error, "Could not find a local copy of #{uri} at #{sha}."
31
+ raise Error, "Could not find a local copy of #{uri}#{" at #{sha}" unless sha.nil?}."
32
32
  end
33
33
 
34
- super
34
+ begin
35
+ super
36
+ rescue Librarian::Posix::CommandFailure => e
37
+ raise Error, "Could not checkout #{uri}#{" at #{sha}" unless sha.nil?}: #{e}"
38
+ end
35
39
 
36
40
  cache_in_vendor(repository.path) if environment.vendor?
37
41
  end
@@ -1,5 +1,5 @@
1
1
  module Librarian
2
2
  module Puppet
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librarian-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Sharpe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-11 00:00:00.000000000 Z
11
+ date: 2014-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: librarian