chef 12.0.0.alpha.1-x86-mingw32 → 12.0.0.alpha.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/lib/chef/application.rb +8 -1
  3. data/lib/chef/application/apply.rb +4 -0
  4. data/lib/chef/application/client.rb +7 -7
  5. data/lib/chef/application/solo.rb +21 -13
  6. data/lib/chef/chef_fs/chef_fs_data_store.rb +60 -6
  7. data/lib/chef/chef_fs/config.rb +78 -4
  8. data/lib/chef/chef_fs/data_handler/acl_data_handler.rb +2 -2
  9. data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
  10. data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
  11. data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
  12. data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
  13. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +76 -2
  14. data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
  15. data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
  16. data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
  17. data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +30 -0
  18. data/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb +17 -0
  19. data/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb +17 -0
  20. data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
  21. data/lib/chef/chef_fs/data_handler/user_data_handler.rb +2 -1
  22. data/lib/chef/chef_fs/file_system.rb +0 -1
  23. data/lib/chef/chef_fs/file_system/acl_entry.rb +1 -1
  24. data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb +1 -1
  25. data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +5 -1
  26. data/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb +73 -13
  27. data/lib/chef/chef_fs/file_system/chef_server_root_dir.rb +44 -5
  28. data/lib/chef/chef_fs/file_system/cookbook_dir.rb +1 -1
  29. data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +3 -3
  30. data/lib/chef/chef_fs/file_system/org_entry.rb +34 -0
  31. data/lib/chef/chef_fs/file_system/organization_invites_entry.rb +58 -0
  32. data/lib/chef/chef_fs/file_system/organization_members_entry.rb +57 -0
  33. data/lib/chef/chef_fs/file_system/rest_list_entry.rb +13 -4
  34. data/lib/chef/chef_fs/knife.rb +1 -1
  35. data/lib/chef/client.rb +8 -2
  36. data/lib/chef/config.rb +75 -57
  37. data/lib/chef/config_fetcher.rb +6 -21
  38. data/lib/chef/dsl/data_query.rb +48 -3
  39. data/lib/chef/dsl/platform_introspection.rb +42 -0
  40. data/lib/chef/dsl/reboot_pending.rb +6 -3
  41. data/lib/chef/encrypted_data_bag_item.rb +1 -1
  42. data/lib/chef/encrypted_data_bag_item/encryptor.rb +12 -0
  43. data/lib/chef/exceptions.rb +2 -0
  44. data/lib/chef/http/basic_client.rb +14 -0
  45. data/lib/chef/http/json_output.rb +7 -2
  46. data/lib/chef/knife.rb +36 -121
  47. data/lib/chef/knife/bootstrap.rb +68 -54
  48. data/lib/chef/knife/bootstrap/archlinux-gems.erb +6 -1
  49. data/lib/chef/knife/bootstrap/chef-aix.erb +5 -0
  50. data/lib/chef/knife/bootstrap/chef-full.erb +5 -1
  51. data/lib/chef/knife/core/bootstrap_context.rb +70 -29
  52. data/lib/chef/knife/search.rb +56 -12
  53. data/lib/chef/knife/serve.rb +1 -1
  54. data/lib/chef/local_mode.rb +10 -4
  55. data/lib/chef/mixin/deep_merge.rb +6 -3
  56. data/lib/chef/mixin/shell_out.rb +33 -17
  57. data/lib/chef/null_logger.rb +72 -0
  58. data/lib/chef/platform.rb +2 -1
  59. data/lib/chef/platform/provider_mapping.rb +1 -1
  60. data/lib/chef/platform/rebooter.rb +54 -0
  61. data/lib/chef/provider/ifconfig.rb +15 -16
  62. data/lib/chef/provider/link.rb +1 -1
  63. data/lib/chef/provider/mount/mount.rb +1 -1
  64. data/lib/chef/provider/mount/solaris.rb +102 -64
  65. data/lib/chef/provider/package/aix.rb +4 -12
  66. data/lib/chef/provider/package/ips.rb +8 -12
  67. data/lib/chef/provider/package/macports.rb +4 -12
  68. data/lib/chef/provider/package/pacman.rb +2 -6
  69. data/lib/chef/provider/package/portage.rb +2 -6
  70. data/lib/chef/provider/package/rpm.rb +4 -12
  71. data/lib/chef/provider/package/solaris.rb +4 -12
  72. data/lib/chef/provider/reboot.rb +69 -0
  73. data/lib/chef/provider/service/debian.rb +10 -10
  74. data/lib/chef/provider/service/freebsd.rb +89 -73
  75. data/lib/chef/provider/service/gentoo.rb +2 -2
  76. data/lib/chef/provider/service/init.rb +6 -4
  77. data/lib/chef/provider/service/insserv.rb +3 -3
  78. data/lib/chef/provider/service/macosx.rb +2 -2
  79. data/lib/chef/provider/service/simple.rb +6 -4
  80. data/lib/chef/provider/service/solaris.rb +1 -1
  81. data/lib/chef/provider/service/systemd.rb +9 -9
  82. data/lib/chef/provider/service/upstart.rb +6 -6
  83. data/lib/chef/provider/subversion.rb +6 -6
  84. data/lib/chef/provider/user/dscl.rb +32 -28
  85. data/lib/chef/provider/user/windows.rb +6 -6
  86. data/lib/chef/provider/whyrun_safe_ruby_block.rb +1 -1
  87. data/lib/chef/providers.rb +1 -0
  88. data/lib/chef/recipe.rb +0 -1
  89. data/lib/chef/resource.rb +3 -5
  90. data/lib/chef/resource/mount.rb +9 -0
  91. data/lib/chef/resource/reboot.rb +48 -0
  92. data/lib/chef/resources.rb +1 -0
  93. data/lib/chef/run_context.rb +25 -0
  94. data/lib/chef/search/query.rb +122 -14
  95. data/lib/chef/util/path_helper.rb +54 -6
  96. data/lib/chef/util/windows/net_user.rb +4 -1
  97. data/lib/chef/version.rb +1 -1
  98. data/lib/chef/win32/api/file.rb +1 -5
  99. data/lib/chef/win32/api/net.rb +1 -0
  100. data/lib/chef/workstation_config_loader.rb +177 -0
  101. data/spec/functional/http/simple_spec.rb +57 -1
  102. data/spec/functional/mixin/shell_out_spec.rb +2 -2
  103. data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +51 -0
  104. data/spec/functional/rebooter_spec.rb +105 -0
  105. data/spec/functional/resource/deploy_revision_spec.rb +0 -4
  106. data/spec/functional/resource/file_spec.rb +26 -3
  107. data/spec/functional/resource/group_spec.rb +5 -3
  108. data/spec/functional/resource/link_spec.rb +16 -16
  109. data/spec/functional/resource/reboot_spec.rb +103 -0
  110. data/spec/integration/client/client_spec.rb +4 -8
  111. data/spec/integration/client/ipv6_spec.rb +1 -1
  112. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +3 -2
  113. data/spec/integration/knife/delete_spec.rb +39 -0
  114. data/spec/integration/knife/deps_spec.rb +30 -20
  115. data/spec/integration/knife/download_spec.rb +77 -1
  116. data/spec/integration/knife/list_spec.rb +221 -0
  117. data/spec/integration/knife/raw_spec.rb +1 -1
  118. data/spec/integration/knife/show_spec.rb +2 -2
  119. data/spec/integration/knife/upload_spec.rb +154 -1
  120. data/spec/support/pedant/run_pedant.rb +0 -1
  121. data/spec/support/shared/functional/http.rb +8 -1
  122. data/spec/support/shared/integration/integration_helper.rb +11 -19
  123. data/spec/support/shared/unit/platform_introspector.rb +22 -0
  124. data/spec/unit/application/apply.rb +11 -1
  125. data/spec/unit/application/solo_spec.rb +19 -3
  126. data/spec/unit/chef_fs/config_spec.rb +58 -0
  127. data/spec/unit/config_fetcher_spec.rb +1 -3
  128. data/spec/unit/config_spec.rb +247 -220
  129. data/spec/unit/dsl/data_query_spec.rb +165 -23
  130. data/spec/unit/dsl/reboot_pending_spec.rb +1 -7
  131. data/spec/unit/encrypted_data_bag_item_spec.rb +1 -1
  132. data/spec/unit/knife/bootstrap_spec.rb +354 -182
  133. data/spec/unit/knife/core/bootstrap_context_spec.rb +67 -30
  134. data/spec/unit/knife_spec.rb +3 -30
  135. data/spec/unit/mixin/deep_merge_spec.rb +14 -0
  136. data/spec/unit/mixin/shell_out_spec.rb +134 -64
  137. data/spec/unit/provider/ifconfig/debian_spec.rb +19 -9
  138. data/spec/unit/provider/ifconfig/redhat_spec.rb +16 -14
  139. data/spec/unit/provider/ifconfig_spec.rb +3 -3
  140. data/spec/unit/provider/link_spec.rb +5 -5
  141. data/spec/unit/provider/mount/mount_spec.rb +10 -1
  142. data/spec/unit/provider/mount/solaris_spec.rb +185 -11
  143. data/spec/unit/provider/package/aix_spec.rb +5 -17
  144. data/spec/unit/provider/package/ips_spec.rb +8 -21
  145. data/spec/unit/provider/package/macports_spec.rb +12 -12
  146. data/spec/unit/provider/package/pacman_spec.rb +4 -12
  147. data/spec/unit/provider/package/portage_spec.rb +5 -15
  148. data/spec/unit/provider/package/rpm_spec.rb +7 -22
  149. data/spec/unit/provider/package/solaris_spec.rb +5 -16
  150. data/spec/unit/provider/service/arch_service_spec.rb +8 -14
  151. data/spec/unit/provider/service/debian_service_spec.rb +1 -1
  152. data/spec/unit/provider/service/freebsd_service_spec.rb +457 -225
  153. data/spec/unit/provider/service/gentoo_service_spec.rb +2 -2
  154. data/spec/unit/provider/service/init_service_spec.rb +10 -10
  155. data/spec/unit/provider/service/insserv_service_spec.rb +3 -4
  156. data/spec/unit/provider/service/invokercd_service_spec.rb +8 -9
  157. data/spec/unit/provider/service/macosx_spec.rb +5 -5
  158. data/spec/unit/provider/service/simple_service_spec.rb +4 -6
  159. data/spec/unit/provider/service/solaris_smf_service_spec.rb +1 -3
  160. data/spec/unit/provider/service/systemd_service_spec.rb +20 -20
  161. data/spec/unit/provider/service/upstart_service_spec.rb +15 -17
  162. data/spec/unit/provider/subversion_spec.rb +5 -6
  163. data/spec/unit/provider/user/dscl_spec.rb +2 -1
  164. data/spec/unit/provider/user/windows_spec.rb +7 -0
  165. data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +2 -2
  166. data/spec/unit/resource/mount_spec.rb +9 -0
  167. data/spec/unit/resource_spec.rb +0 -4
  168. data/spec/unit/rest_spec.rb +1 -1
  169. data/spec/unit/run_context_spec.rb +15 -0
  170. data/spec/unit/search/query_spec.rb +196 -40
  171. data/spec/unit/util/path_helper_spec.rb +111 -28
  172. data/spec/unit/workstation_config_loader_spec.rb +283 -0
  173. metadata +36 -20
  174. data/lib/chef/knife/bootstrap/centos5-gems.erb +0 -62
  175. data/lib/chef/knife/bootstrap/fedora13-gems.erb +0 -44
  176. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +0 -53
  177. data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +0 -48
  178. data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +0 -46
  179. data/spec/support/shared/integration/chef_zero_support.rb +0 -130
  180. data/spec/unit/knife/config_file_selection_spec.rb +0 -135
@@ -114,7 +114,8 @@ EOM
114
114
  when_the_repository 'has a cookbook with dependencies' do
115
115
  before do
116
116
  file 'cookbooks/kettle/metadata.rb', 'name "kettle"'
117
- file 'cookbooks/quiche/metadata.rb', "name 'quiche'\ndepends 'kettle'\n"
117
+ file 'cookbooks/quiche/metadata.rb', 'name "quiche"
118
+ depends "kettle"'
118
119
  file 'cookbooks/quiche/recipes/default.rb', ''
119
120
  end
120
121
  it 'knife deps reports just the cookbook' do
@@ -204,10 +205,14 @@ EOM
204
205
  context 'circular dependencies' do
205
206
  when_the_repository 'has cookbooks with circular dependencies' do
206
207
  before do
207
- file 'cookbooks/foo/metadata.rb', "name 'foo'\ndepends 'bar'\n"
208
- file 'cookbooks/bar/metadata.rb', "name 'bar'\ndepends 'baz'\n"
209
- file 'cookbooks/baz/metadata.rb', "name 'baz'\ndepends 'foo'\n"
210
- file 'cookbooks/self/metadata.rb', "name 'self'\ndepends 'self'\n"
208
+ file 'cookbooks/foo/metadata.rb', 'name "foo"
209
+ depends "bar"'
210
+ file 'cookbooks/bar/metadata.rb', 'name "bar"
211
+ depends "baz"'
212
+ file 'cookbooks/baz/metadata.rb', 'name "baz"
213
+ depends "foo"'
214
+ file 'cookbooks/self/metadata.rb', 'name "self"
215
+ depends "self"'
211
216
  end
212
217
 
213
218
  it 'knife deps prints each once' do
@@ -379,8 +384,8 @@ EOM
379
384
  before do
380
385
  role 'starring', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
381
386
  role 'minor', {}
382
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => "name 'quiche'\nversion '1.0.0'\n", 'recipes' => { 'default.rb' => '' } }
383
- cookbook 'soup', '1.0.0', { 'metadata.rb' => "name 'soup'\nversion '1.0.0'\n", 'recipes' => { 'chicken.rb' => '' } }
387
+ cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
388
+ cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
384
389
  end
385
390
  it 'knife deps reports all dependencies' do
386
391
  knife('deps --remote /roles/starring.json').should_succeed <<EOM
@@ -396,8 +401,8 @@ EOM
396
401
  before do
397
402
  role 'starring', { 'env_run_lists' => { 'desert' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
398
403
  role 'minor', {}
399
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => "name 'quiche'\nversion '1.0.0'\n", 'recipes' => { 'default.rb' => '' } }
400
- cookbook 'soup', '1.0.0', { 'metadata.rb' => "name 'soup'\nversion '1.0.0'\n", 'recipes' => { 'chicken.rb' => '' } }
404
+ cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
405
+ cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
401
406
  end
402
407
  it 'knife deps reports all dependencies' do
403
408
  knife('deps --remote /roles/starring.json').should_succeed <<EOM
@@ -427,8 +432,8 @@ EOM
427
432
  when_the_chef_server 'has a node with roles and recipes in its run_list' do
428
433
  before do
429
434
  role 'minor', {}
430
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => "name 'quiche'\nversion '1.0.0'\n", 'recipes' => { 'default.rb' => '' } }
431
- cookbook 'soup', '1.0.0', { 'metadata.rb' => "name 'soup'\nversion '1.0.0'\n", 'recipes' => { 'chicken.rb' => '' } }
435
+ cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
436
+ cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
432
437
  node 'mort', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
433
438
  end
434
439
  it 'knife deps reports just the node' do
@@ -442,7 +447,7 @@ EOM
442
447
  end
443
448
  when_the_chef_server 'has a cookbook with no dependencies' do
444
449
  before do
445
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => "name 'quiche'\nversion '1.0.0'\n", 'recipes' => { 'default.rb' => '' } }
450
+ cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
446
451
  end
447
452
  it 'knife deps reports just the cookbook' do
448
453
  knife('deps --remote /cookbooks/quiche').should_succeed "/cookbooks/quiche\n"
@@ -450,8 +455,9 @@ EOM
450
455
  end
451
456
  when_the_chef_server 'has a cookbook with dependencies' do
452
457
  before do
453
- cookbook 'kettle', '1.0.0', { 'metadata.rb' => "name 'kettle'\nversion '1.0.0'\n" }
454
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => "name 'quiche'\ndepends 'kettle'\n", 'recipes' => { 'default.rb' => '' } }
458
+ cookbook 'kettle', '1.0.0', { 'metadata.rb' => %Q{name "kettle"\nversion "1.0.0"\n} }
459
+ cookbook 'quiche', '1.0.0', { 'metadata.rb' => 'name "quiche"
460
+ depends "kettle"', 'recipes' => { 'default.rb' => '' } }
455
461
  end
456
462
  it 'knife deps reports the cookbook and its dependencies' do
457
463
  knife('deps --remote /cookbooks/quiche').should_succeed "/cookbooks/kettle\n/cookbooks/quiche\n"
@@ -473,8 +479,8 @@ EOM
473
479
  before do
474
480
  role 'starring', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
475
481
  role 'minor', {}
476
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => "name 'quiche'\nversion '1.0.0'\n", 'recipes' => { 'default.rb' => '' } }
477
- cookbook 'soup', '1.0.0', { 'metadata.rb' => "name 'soup'\nversion '1.0.0'\n", 'recipes' => { 'chicken.rb' => '' } }
482
+ cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
483
+ cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
478
484
  environment 'desert', {}
479
485
  node 'mort', { 'chef_environment' => 'desert', 'run_list' => [ 'role[starring]' ] }
480
486
  node 'bart', { 'run_list' => [ 'role[minor]' ] }
@@ -538,10 +544,14 @@ EOM
538
544
  context 'circular dependencies' do
539
545
  when_the_chef_server 'has cookbooks with circular dependencies' do
540
546
  before do
541
- cookbook 'foo', '1.0.0', { 'metadata.rb' => "name 'foo'\ndepends 'bar'\n" }
542
- cookbook 'bar', '1.0.0', { 'metadata.rb' => "name 'bar'\ndepends 'baz'\n" }
543
- cookbook 'baz', '1.0.0', { 'metadata.rb' => "name 'baz'\ndepends 'foo'\n" }
544
- cookbook 'self', '1.0.0', { 'metadata.rb' => "name 'self'\ndepends 'self'\n" }
547
+ cookbook 'foo', '1.0.0', { 'metadata.rb' => 'name "foo"
548
+ depends "bar"' }
549
+ cookbook 'bar', '1.0.0', { 'metadata.rb' => 'name "bar"
550
+ depends "baz"' }
551
+ cookbook 'baz', '1.0.0', { 'metadata.rb' => 'name "baz"
552
+ depends "foo"' }
553
+ cookbook 'self', '1.0.0', { 'metadata.rb' => 'name "self"
554
+ depends "self"' }
545
555
  end
546
556
  it 'knife deps prints each once' do
547
557
  knife('deps --remote /cookbooks/foo /cookbooks/self').should_succeed <<EOM
@@ -903,7 +903,7 @@ EOM
903
903
 
904
904
  when_the_repository 'has a cookbook' do
905
905
  before do
906
- file 'cookbooks/x-1.0.0/metadata.rb', 'name "x"; version "1.0.0"'
906
+ file 'cookbooks/x-1.0.0/metadata.rb', 'name "x"; version "1.0.0"#unmodified'
907
907
  file 'cookbooks/x-1.0.0/z.rb', ''
908
908
  end
909
909
 
@@ -1091,4 +1091,80 @@ EOM
1091
1091
  end
1092
1092
  end
1093
1093
  end
1094
+
1095
+ when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
1096
+ before do
1097
+ organization 'foo' do
1098
+ container 'x', {}
1099
+ group 'x', {}
1100
+ end
1101
+ end
1102
+
1103
+ before :each do
1104
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
1105
+ end
1106
+
1107
+ when_the_repository 'is empty' do
1108
+ it 'knife download / downloads everything' do
1109
+ knife('download /').should_succeed <<EOM
1110
+ Created /acls
1111
+ Created /acls/clients
1112
+ Created /acls/clients/foo-validator.json
1113
+ Created /acls/containers
1114
+ Created /acls/containers/clients.json
1115
+ Created /acls/containers/containers.json
1116
+ Created /acls/containers/cookbooks.json
1117
+ Created /acls/containers/data.json
1118
+ Created /acls/containers/environments.json
1119
+ Created /acls/containers/groups.json
1120
+ Created /acls/containers/nodes.json
1121
+ Created /acls/containers/roles.json
1122
+ Created /acls/containers/sandboxes.json
1123
+ Created /acls/containers/x.json
1124
+ Created /acls/cookbooks
1125
+ Created /acls/data_bags
1126
+ Created /acls/environments
1127
+ Created /acls/environments/_default.json
1128
+ Created /acls/groups
1129
+ Created /acls/groups/admins.json
1130
+ Created /acls/groups/billing-admins.json
1131
+ Created /acls/groups/clients.json
1132
+ Created /acls/groups/users.json
1133
+ Created /acls/groups/x.json
1134
+ Created /acls/nodes
1135
+ Created /acls/roles
1136
+ Created /acls/organization.json
1137
+ Created /clients
1138
+ Created /clients/foo-validator.json
1139
+ Created /containers
1140
+ Created /containers/clients.json
1141
+ Created /containers/containers.json
1142
+ Created /containers/cookbooks.json
1143
+ Created /containers/data.json
1144
+ Created /containers/environments.json
1145
+ Created /containers/groups.json
1146
+ Created /containers/nodes.json
1147
+ Created /containers/roles.json
1148
+ Created /containers/sandboxes.json
1149
+ Created /containers/x.json
1150
+ Created /cookbooks
1151
+ Created /data_bags
1152
+ Created /environments
1153
+ Created /environments/_default.json
1154
+ Created /groups
1155
+ Created /groups/admins.json
1156
+ Created /groups/billing-admins.json
1157
+ Created /groups/clients.json
1158
+ Created /groups/users.json
1159
+ Created /groups/x.json
1160
+ Created /invitations.json
1161
+ Created /members.json
1162
+ Created /nodes
1163
+ Created /org.json
1164
+ Created /roles
1165
+ EOM
1166
+ knife('diff --name-status /').should_succeed ''
1167
+ end
1168
+ end
1169
+ end
1094
1170
  end
@@ -641,4 +641,225 @@ EOM
641
641
  end
642
642
  end
643
643
  end
644
+
645
+ when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
646
+ before do
647
+ organization 'foo'
648
+ end
649
+
650
+ before :each do
651
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
652
+ end
653
+
654
+ context 'and is empty' do
655
+ it "knife list / returns all top level directories" do
656
+ knife('list /').should_succeed <<EOM
657
+ /acls
658
+ /clients
659
+ /containers
660
+ /cookbooks
661
+ /data_bags
662
+ /environments
663
+ /groups
664
+ /invitations.json
665
+ /members.json
666
+ /nodes
667
+ /org.json
668
+ /roles
669
+ EOM
670
+ end
671
+
672
+ it "knife list -R / returns everything" do
673
+ knife('list -R /').should_succeed <<EOM
674
+ /:
675
+ acls
676
+ clients
677
+ containers
678
+ cookbooks
679
+ data_bags
680
+ environments
681
+ groups
682
+ invitations.json
683
+ members.json
684
+ nodes
685
+ org.json
686
+ roles
687
+
688
+ /acls:
689
+ clients
690
+ containers
691
+ cookbooks
692
+ data_bags
693
+ environments
694
+ groups
695
+ nodes
696
+ organization.json
697
+ roles
698
+
699
+ /acls/clients:
700
+ foo-validator.json
701
+
702
+ /acls/containers:
703
+ clients.json
704
+ containers.json
705
+ cookbooks.json
706
+ data.json
707
+ environments.json
708
+ groups.json
709
+ nodes.json
710
+ roles.json
711
+ sandboxes.json
712
+
713
+ /acls/cookbooks:
714
+
715
+ /acls/data_bags:
716
+
717
+ /acls/environments:
718
+ _default.json
719
+
720
+ /acls/groups:
721
+ admins.json
722
+ billing-admins.json
723
+ clients.json
724
+ users.json
725
+
726
+ /acls/nodes:
727
+
728
+ /acls/roles:
729
+
730
+ /clients:
731
+ foo-validator.json
732
+
733
+ /containers:
734
+ clients.json
735
+ containers.json
736
+ cookbooks.json
737
+ data.json
738
+ environments.json
739
+ groups.json
740
+ nodes.json
741
+ roles.json
742
+ sandboxes.json
743
+
744
+ /cookbooks:
745
+
746
+ /data_bags:
747
+
748
+ /environments:
749
+ _default.json
750
+
751
+ /groups:
752
+ admins.json
753
+ billing-admins.json
754
+ clients.json
755
+ users.json
756
+
757
+ /nodes:
758
+
759
+ /roles:
760
+ EOM
761
+ end
762
+ end
763
+ end
764
+
765
+ when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
766
+ before do
767
+ organization 'foo'
768
+ end
769
+
770
+ before :each do
771
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
772
+ end
773
+
774
+ it 'knife list -R / returns everything' do
775
+ knife('list -R /').should_succeed <<EOM
776
+ /:
777
+ acls
778
+ clients
779
+ containers
780
+ cookbooks
781
+ data_bags
782
+ environments
783
+ groups
784
+ invitations.json
785
+ members.json
786
+ nodes
787
+ org.json
788
+ roles
789
+
790
+ /acls:
791
+ clients
792
+ containers
793
+ cookbooks
794
+ data_bags
795
+ environments
796
+ groups
797
+ nodes
798
+ organization.json
799
+ roles
800
+
801
+ /acls/clients:
802
+ foo-validator.json
803
+
804
+ /acls/containers:
805
+ clients.json
806
+ containers.json
807
+ cookbooks.json
808
+ data.json
809
+ environments.json
810
+ groups.json
811
+ nodes.json
812
+ roles.json
813
+ sandboxes.json
814
+
815
+ /acls/cookbooks:
816
+
817
+ /acls/data_bags:
818
+
819
+ /acls/environments:
820
+ _default.json
821
+
822
+ /acls/groups:
823
+ admins.json
824
+ billing-admins.json
825
+ clients.json
826
+ users.json
827
+
828
+ /acls/nodes:
829
+
830
+ /acls/roles:
831
+
832
+ /clients:
833
+ foo-validator.json
834
+
835
+ /containers:
836
+ clients.json
837
+ containers.json
838
+ cookbooks.json
839
+ data.json
840
+ environments.json
841
+ groups.json
842
+ nodes.json
843
+ roles.json
844
+ sandboxes.json
845
+
846
+ /cookbooks:
847
+
848
+ /data_bags:
849
+
850
+ /environments:
851
+ _default.json
852
+
853
+ /groups:
854
+ admins.json
855
+ billing-admins.json
856
+ clients.json
857
+ users.json
858
+
859
+ /nodes:
860
+
861
+ /roles:
862
+ EOM
863
+ end
864
+ end
644
865
  end
@@ -169,7 +169,7 @@ EOM
169
169
 
170
170
  knife("raw -m POST -i #{file.path} /roles").should_succeed <<EOM
171
171
  {
172
- "uri": "#{ChefZeroSupport::Server.server.url}/roles/y"
172
+ "uri": "#{Chef::Config.chef_server_url}/roles/y"
173
173
  }
174
174
  EOM
175
175
  knife('show /roles/y.json').should_succeed <<EOM
@@ -51,13 +51,13 @@ describe 'knife show' do
51
51
  it 'knife show /cookbooks/x/metadata.rb shows the remote version' do
52
52
  knife('show /cookbooks/x/metadata.rb').should_succeed <<EOM
53
53
  /cookbooks/x/metadata.rb:
54
- name 'x'; version '1.0.0'
54
+ name "x"; version "1.0.0"
55
55
  EOM
56
56
  end
57
57
  it 'knife show --local /cookbooks/x/metadata.rb shows the local version' do
58
58
  knife('show --local /cookbooks/x/metadata.rb').should_succeed <<EOM
59
59
  /cookbooks/x/metadata.rb:
60
- name 'x'; version '1.0.0'
60
+ name "x"; version "1.0.0"
61
61
  EOM
62
62
  end
63
63
  it 'knife show /data_bags/x/y.json shows the remote version' do