knife-mirror 0.1.0 → 0.1.1

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: 9e9df5f32eafbd870052b94aaf48203c58bba73d
4
- data.tar.gz: a806c489d3ca99d77a622dc1248208ffd887ee38
3
+ metadata.gz: 1c1ce443c7aebf8ad72c144e835178828eb39be6
4
+ data.tar.gz: 1038e4f000b8c38cb3c1465f104cc2ef3baf383e
5
5
  SHA512:
6
- metadata.gz: 437b74da06762c2cf1ece6b7dbaa7206177318a74f3c69e11a092e302173a99ac22c1262f5292ee7c536550034676416cdba7fae5066d7246a0743ecc855adcf
7
- data.tar.gz: 1a42e9dbc1306de3e87ed252a43975e10b730601b2958ec3d14bd7869703c43386cc867bbb69882f37107a9831c17b4feae81e0f382c666b08c2302d716535f0
6
+ metadata.gz: a7939d1dff7e649e5a533b5b4664799ce888fadc194d6ce7ecb489e989e361309485b104a388e13eb72a988004d33c77f597da003201c65f58eeb4d2357be97c
7
+ data.tar.gz: 1c1a7091a71ecada1468d90af6de48a779eb206e55a5b0427aa4e7393e0c12c4d5c0e89119da7bc29b4d4acd7a93d7104b84819109841182f00fda4994533d53
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # knife-mirror Change log
2
2
 
3
+ ## 0.1.1 (2015-09-25)
4
+
5
+ - do not show orphaned cookbook count if count = 0
6
+ - improve get_cookbook_meta: return valid (empty) metadata if endpoint (cookbook) does not exist
7
+
3
8
  ## 0.1.0 (2015-09-23)
4
9
 
5
10
  - Initial version (still lots of WIP)
@@ -12,3 +17,4 @@
12
17
  - configurable delay to ease load on Supermarkets
13
18
  - disable meta data replication, supermarket does not honor it anyways
14
19
  - add some initial docs to readme
20
+ - switch gpl license I defaulted my repo with, to Apache 2.0
data/README.md CHANGED
@@ -47,10 +47,6 @@ If the requested catagory does not exist, supermarket refuses to accept the cook
47
47
 
48
48
  So obviously need to revisit that.
49
49
 
50
- Last minute: Just noticed during some final tests, before releasing this first version; if you attempt a ```knife mirror cookbook all``` or ```knife mirror all``` to an 'empty' new fresh supermarket, things will fail.
51
- Please, as a workaround for now, just mirror a recent version for some cookbook first, as in, ```knife mirror apt -t https://supermarket.your.domain.tld```.
52
- I'll fix this asap, simply need to add some endpoint checking of course, mea culpa.
53
-
54
50
  ## Requirements
55
51
 
56
52
  - You need to have Chef Knife working
@@ -25,6 +25,7 @@ class Chef
25
25
  category 'mirror'
26
26
 
27
27
  deps do
28
+ require 'chef/cookbook/metadata'
28
29
  require 'chef/cookbook_site_streaming_uploader'
29
30
  end
30
31
 
@@ -75,7 +76,7 @@ class Chef
75
76
  ui.info('Done!')
76
77
  removed, added = universe_diff(private_universe, community_universe)
77
78
  ui.info("We are still missing #{added.size} cookbooks (out of #{community_universe.size}) on our target Supermarket.")
78
- ui.info("Though we're not doing anything with these just yet, you should know we have #{removed.size} cookbooks which are no longer present on the Supermarket (source).")
79
+ ui.info("Though we're not doing anything with these just yet, you should know we have #{removed.size} cookbooks which are no longer present on the Supermarket (source).") if removed.size > 0
79
80
  added.sort.each do |cookbook, versions|
80
81
  ui.info("Mirroring #{versions.size} version(s) for #{cookbook} cookbook:")
81
82
  displayed_before = false
@@ -160,6 +161,15 @@ class Chef
160
161
 
161
162
  def get_cookbook_meta(cookbook = @name_args[0], api_url = "#{config[:supermarket_site]}/api/v1/cookbooks")
162
163
  unauthenticated_get_rest("#{api_url}/#{cookbook}")
164
+ rescue => e
165
+ if e.message =~ /404/
166
+ # Return proper (empty) metadata structure
167
+ md = Chef::Cookbook::Metadata.new
168
+ return md.to_hash.merge!('metrics' => { 'downloads' => { 'versions' => {} } })
169
+ else
170
+ ui.error("Error during #{cookbook} metadata request (#{e.message}). Increase log verbosity (-VV) for more information.")
171
+ exit(1)
172
+ end
163
173
  end
164
174
 
165
175
  def cookbook_deprecated?(cookbookmeta)
@@ -1,5 +1,5 @@
1
1
  # KnifeMirror version
2
2
  module KnifeMirror
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-mirror
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - G.J. Moed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-23 00:00:00.000000000 Z
11
+ date: 2015-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef