diff options
author | John Keiser <jkeiser@opscode.com> | 2014-05-26 22:02:12 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2014-05-26 22:02:12 -0700 |
commit | 8be4c781bc8b624dafde8eb9d5ba869c7ebf33d2 (patch) | |
tree | d7623a9b288f083793c9cb3efeb3a64c73b42812 | |
parent | e9db4a08c81038b09921a67238bc3a9d83bf7b73 (diff) | |
download | chef-zero-8be4c781bc8b624dafde8eb9d5ba869c7ebf33d2.tar.gz |
Allow callers to specify their own org defaults
-rw-r--r-- | lib/chef_zero/data_store/v1_to_v2_adapter.rb | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/chef_zero/data_store/v1_to_v2_adapter.rb b/lib/chef_zero/data_store/v1_to_v2_adapter.rb index 3f2276e..56641a6 100644 --- a/lib/chef_zero/data_store/v1_to_v2_adapter.rb +++ b/lib/chef_zero/data_store/v1_to_v2_adapter.rb @@ -3,26 +3,22 @@ require 'chef_zero/data_store/interface_v2' module ChefZero module DataStore class V1ToV2Adapter < ChefZero::DataStore::InterfaceV2 - def initialize(real_store, single_org) + def initialize(real_store, single_org, options = {}) @real_store = real_store @single_org = single_org - # Handle defaults per V2 specification - @defaults = { - 'organizations' => { - single_org => { - 'clients' => { - 'chef-validator' => '{ "validator": true }', - 'chef-webui' => '{ "admin": true }' - }, - 'environments' => { - '_default' => '{ "description": "The default Chef environment" }' - }, - 'users' => { - 'admin' => '{ "admin": "true" }' - } - } + org_defaults = options[:org_defaults] || { + 'clients' => { + 'chef-validator' => '{ "validator": true }', + 'chef-webui' => '{ "admin": true }' + }, + 'environments' => { + '_default' => '{ "description": "The default Chef environment" }' + }, + 'users' => { + 'admin' => '{ "admin": "true" }' } } + @defaults = { 'organizations' => { single_org => org_defaults }} end attr_reader :real_store |