chef-zero 2.1 → 2.1.1

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: 7f471a666e1d3e6bf940a786920438a6a956e10b
4
- data.tar.gz: 15d364fda6c211d6f306909c5c7380830d9e66ad
3
+ metadata.gz: 06ef2b090b7ac3eed283205f44d61cd66c693c74
4
+ data.tar.gz: 14fb6b29d392f772e579685056499a4e053cf5eb
5
5
  SHA512:
6
- metadata.gz: b3333fe38f5a88350b324ffae8889cd9440b66db783338aca651a77a1480b9e6f5aac3e122e57d046776ac327ede11f8422bb8f4cf260ff4326951771e7219dd
7
- data.tar.gz: 1aaeb7212a5c29090a6b3f83d6a0a66f565c104e92e32c421cb1830c865c51f2377341b5e046f2e173ccd89ffd8f504abe44a5f6e703dc25fd2095318e2858dc
6
+ metadata.gz: 91a2192f2a50b203f19e6b45e8d911fb0fb304a5771b0721e49e47b587df40d33f53bdd59a8a83f119815929087f9b0aa2002ba983e9497c79c5e0f33c47d557
7
+ data.tar.gz: a82c744dbbacbc2841e8d11f9fdd17748393c8d1b9a5b8e713ce87876a521fc6ae3a8d0b55abb78a81e2fd8f84f9450ea1e7f190b4c12a0df32ee1d152a73d26
@@ -3,27 +3,25 @@ require 'chef_zero/data_store/interface_v2'
3
3
  module ChefZero
4
4
  module DataStore
5
5
  class V1ToV2Adapter < ChefZero::DataStore::InterfaceV2
6
- def initialize(real_store, single_org)
6
+ def initialize(real_store, single_org, options = {})
7
7
  @real_store = real_store
8
8
  @single_org = single_org
9
- # Handle defaults per V2 specification
10
- @defaults = {
11
- 'organizations' => {
12
- single_org => {
13
- 'clients' => {
14
- 'chef-validator' => '{ "validator": true }',
15
- 'chef-webui' => '{ "admin": true }'
16
- },
17
- 'environments' => {
18
- '_default' => '{ "description": "The default Chef environment" }'
19
- },
20
- 'users' => {
21
- 'admin' => '{ "admin": "true" }'
22
- }
23
- }
24
- }
9
+ org_defaults = options[:org_defaults] || {}
10
+ @defaults = { 'organizations' => { single_org => org_defaults }}
11
+ end
12
+
13
+ ORG_DEFAULTS = {
14
+ 'clients' => {
15
+ 'chef-validator' => '{ "validator": true }',
16
+ 'chef-webui' => '{ "admin": true }'
17
+ },
18
+ 'environments' => {
19
+ '_default' => '{ "description": "The default Chef environment" }'
20
+ },
21
+ 'users' => {
22
+ 'admin' => '{ "admin": "true" }'
25
23
  }
26
- end
24
+ }
27
25
 
28
26
  attr_reader :real_store
29
27
  attr_reader :single_org
@@ -95,9 +95,9 @@ module ChefZero
95
95
  #
96
96
  def url
97
97
  @url ||= if @options[:host].include?(':')
98
- "http://[#{@options[:host]}]:#{@options[:port]}"
98
+ URI("http://[#{@options[:host]}]:#{@options[:port]}").to_s
99
99
  else
100
- "http://#{@options[:host]}:#{@options[:port]}"
100
+ URI("http://#{@options[:host]}:#{@options[:port]}").to_s
101
101
  end
102
102
  end
103
103
 
@@ -284,7 +284,6 @@ module ChefZero
284
284
  # }
285
285
  # }
286
286
  def load_data(contents, org_name = 'chef')
287
- data_store.create_dir('organizations', org_name)
288
287
  %w(clients environments nodes roles users).each do |data_type|
289
288
  if contents[data_type]
290
289
  dejsonize_children(contents[data_type]).each_pair do |name, data|
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '2.1'
2
+ VERSION = '2.1.1'
3
3
  end
data/spec/run.rb CHANGED
@@ -23,6 +23,7 @@ def start_server(chef_repo_path)
23
23
  Chef::Config.versioned_cookbooks = true
24
24
  chef_fs = Chef::ChefFS::Config.new.local_fs
25
25
  data_store = Chef::ChefFS::ChefFSDataStore.new(chef_fs)
26
+ data_store = ChefZero::DataStore::V1ToV2Adapter.new(data_store, 'chef', :org_defaults => ChefZero::DataStore::V1ToV2Adapter::ORG_DEFAULTS)
26
27
  server = ChefZero::Server.new(:port => 8889, :data_store => data_store)#, :log_level => :debug)
27
28
  server.start_background
28
29
  server
@@ -35,6 +36,7 @@ begin
35
36
  require 'tmpdir'
36
37
  require 'fileutils'
37
38
  require 'chef/version'
39
+ require 'chef_zero/data_store/v1_to_v2_adapter'
38
40
 
39
41
  # Create chef repository
40
42
  tmpdir = Dir.mktmpdir
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.1'
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-26 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-log