batali-wedge 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6f124231d53d1814403f5400386e24a8545241d
4
- data.tar.gz: 62d952e59accd7f3f5e1612a599f1a68ed11ddc2
3
+ metadata.gz: cd741e3b9eae3dbcae3ab5768344996aed820026
4
+ data.tar.gz: c63707d74fe4f8df1f449660dc6aba01f0096cc3
5
5
  SHA512:
6
- metadata.gz: 9d29e1eb3dfd9b83bdb99c2c20dd577ae15602c9fad0bec2451e9d2ce54157b049cb871de5a155ea5ee553bf4c6ed6bb67b5ce5575ee44d187096f655e517512
7
- data.tar.gz: b136b66efd8da4256ed80410cad2c7f1d76ba97cb99db12481b8c86345098d1e4fe00e4745f9182d23ca882c7c31a22c0f66cee0621d386454c7910e7e2547e9
6
+ metadata.gz: a4979ac7edb638581e1ce26c717dfb759bcd5c49e54c81309a17bf941beb18da2756c0f9e93f861b3314de35d6e5e4cd99da95246e1e49b8c37e0856a723cb3b
7
+ data.tar.gz: 4be01b72a68af46ea3de9eff37b7ab2a1da08cc423b53f1702f6ebc678fe399cac0deef183ef257f6d080bfb1b8f456cdad567724367eb1631ff7cd7ebae9369
@@ -1,16 +1,13 @@
1
1
  $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) + '/lib/'
2
- require 'batali-wedge/version'
3
2
  Gem::Specification.new do |s|
4
3
  s.name = 'batali-wedge'
5
- s.version = BataliWedge::VERSION.version
4
+ s.version = '0.1.2'
6
5
  s.summary = 'Magic wedger'
7
6
  s.author = 'Chris Roberts'
8
7
  s.email = 'code@chrisroberts.org'
9
- s.homepage = 'https://github.com/hw-labs/batali-wedge'
8
+ s.homepage = 'https://github.com/hw-labs/batali-infuse'
10
9
  s.description = 'Wedge magic into Chef'
11
- s.require_path = 'lib'
12
10
  s.license = 'Apache 2.0'
13
- s.add_runtime_dependency 'batali'
14
- s.add_runtime_dependency 'chef', '~> 12.2.0'
15
- s.files = Dir['{lib}/**/**/*'] + %w(batali-wedge.gemspec README.md CHANGELOG.md LICENSE)
11
+ s.add_runtime_dependency 'batali-infuse', '> 0'
12
+ s.files = %w(batali-wedge.gemspec)
16
13
  end
metadata CHANGED
@@ -1,57 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batali-wedge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-24 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: batali
14
+ name: batali-infuse
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: chef
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 12.2.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 12.2.0
41
27
  description: Wedge magic into Chef
42
28
  email: code@chrisroberts.org
43
29
  executables: []
44
30
  extensions: []
45
31
  extra_rdoc_files: []
46
32
  files:
47
- - CHANGELOG.md
48
- - LICENSE
49
- - README.md
50
33
  - batali-wedge.gemspec
51
- - lib/batali-wedge.rb
52
- - lib/batali-wedge/sync.rb
53
- - lib/batali-wedge/version.rb
54
- homepage: https://github.com/hw-labs/batali-wedge
34
+ homepage: https://github.com/hw-labs/batali-infuse
55
35
  licenses:
56
36
  - Apache 2.0
57
37
  metadata: {}
@@ -1,2 +0,0 @@
1
- # v0.1.0
2
- * Initial release
data/LICENSE DELETED
@@ -1,13 +0,0 @@
1
- Copyright 2015 Chris Roberts
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
data/README.md DELETED
@@ -1,50 +0,0 @@
1
- # Batali Wedge
2
-
3
- Lets have some fun with `chef-client`!
4
-
5
- ## Wedge Batali
6
-
7
- This gem wedges Batali into `chef-client` to perform cookbook
8
- resolution locally on the node, and request the solution set
9
- from the Chef Server.
10
-
11
- ## OMG WHY!?
12
-
13
- There were old complaints about local solvers not generating
14
- the same results as the solver on the server. So, what if we
15
- just used the same solver, then you'd know you had the same
16
- resolution. This lead to:
17
-
18
- > I wonder if Batali could be wedged into the client
19
-
20
- As it turns out, it can.
21
-
22
- ## Usage
23
-
24
- This only support 12.2.x versions of Chef. The gem needs to be
25
- installed into the omnibus like so:
26
-
27
- ```
28
- $ /opt/chef/emebedded/bin/gem install batali-wedge --no-document
29
- ```
30
-
31
- Then you can enable it via the `client.rb` file by adding this to
32
- the top:
33
-
34
- ```ruby
35
- # /etc/chef/client.rb
36
-
37
- require 'batali-wedge/sync'
38
- ```
39
-
40
- ## What does this provide?
41
-
42
- Cookbook resolution, just on the client, via Batali. There's no
43
- least impact yet, but mostly because this was a first pass to
44
- see _if_ it would work. The next release will likely include
45
- that feature just to see what happens.
46
-
47
- # Info
48
-
49
- * Repository: https://github.com/hw-labs/batali-wedge
50
- * IRC: Freenode @ #heavywater
@@ -1,2 +0,0 @@
1
- require 'batali'
2
- require 'batali-wedge/version'
@@ -1,95 +0,0 @@
1
- require 'batali-wedge'
2
-
3
- class Chef::PolicyBuilder::ExpandNodeObject
4
-
5
- # Provide override to force Batali resolution
6
- def sync_cookbooks
7
- Chef::Log.debug("Synchronizing cookbooks")
8
-
9
- begin
10
- events.cookbook_resolution_start(@expanded_run_list_with_versions)
11
- cookbook_hash = batali_cookbook_hash
12
-
13
- rescue Exception => e
14
- # TODO: wrap/munge exception to provide helpful error output
15
- events.cookbook_resolution_failed(@expanded_run_list_with_versions, e)
16
- raise
17
- else
18
- events.cookbook_resolution_complete(cookbook_hash)
19
- end
20
-
21
- synchronizer = Chef::CookbookSynchronizer.new(cookbook_hash, events)
22
- if temporary_policy?
23
- synchronizer.remove_obsoleted_files = false
24
- end
25
- synchronizer.sync_cookbooks
26
-
27
- # register the file cache path in the cookbook path so that CookbookLoader actually picks up the synced cookbooks
28
- Chef::Config[:cookbook_path] = File.join(Chef::Config[:file_cache_path], "cookbooks")
29
-
30
- cookbook_hash
31
-
32
- end
33
-
34
- # Generate expected cookbook version hash
35
- #
36
- # @return [Hash]
37
- def batali_cookbook_hash
38
- Chef::Log.warn 'Resolving cookbooks via Batali!'
39
- system = batali_build_system
40
- constraints = Smash[
41
- api_service.get_rest("environments/#{node.chef_environment}").cookbook_versions.to_a
42
- ]
43
- @expanded_run_list_with_versions.each do |item|
44
- c_name, c_version = item.split('@')
45
- c_name = c_name.split('::').first
46
- if(c_version)
47
- constraints[c_name] = c_version
48
- elsif(constraints[c_name].nil?)
49
- constraints[c_name] = '> 0'
50
- end
51
- end
52
- requirements = Grimoire::RequirementList.new(
53
- :name => :batali_resolv,
54
- :requirements => constraints.to_a
55
- )
56
- solver = Grimoire::Solver.new(
57
- :requirements => requirements,
58
- :system => system
59
- )
60
- results = solver.generate!
61
- solution = results.pop
62
- solution_output = solution.units.sort_by(&:name).map{|u| "#{u.name}<#{u.version}>"}.join(', ')
63
- node.set[:batali] ||= Mash.new
64
- node.set[:batali][:last_resolution] = Mash[solution.map{|u| [u.name, u.version]}]
65
- Chef::Log.warn "Batali cookbook resolution: #{solution_output}"
66
- Hash[
67
- solution.units.map do |unit|
68
- [unit.name, api_service.get_rest("cookbooks/#{unit.name}/#{unit.version}")]
69
- end
70
- ]
71
- end
72
-
73
- # Build the base system for generating solution
74
- #
75
- # @return [Grimoire::System]
76
- def batali_build_system
77
- system = Grimoire::System.new
78
- units = api_service.get_rest('cookbooks').map do |c_name, meta|
79
- meta['versions'].map do |info|
80
- "#{c_name}/#{info['version']}"
81
- end
82
- end.flatten.map do |ckbk|
83
- Grimoire::Unit.new(
84
- Smash.new(
85
- :name => ckbk.split('/').first,
86
- :version => ckbk.split('/').last,
87
- :dependencies => api_service.get_rest("cookbooks/#{ckbk}").metadata.dependencies.to_a
88
- )
89
- )
90
- end
91
- system.add_unit(*units)
92
- system
93
- end
94
-
95
- end
@@ -1,3 +0,0 @@
1
- module BataliWedge
2
- VERSION = Gem::Version.new('0.1.0')
3
- end