chef 0.9.8 → 0.9.10.rc.0

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.
Files changed (98) hide show
  1. data/README.rdoc +1 -1
  2. data/distro/common/man/man8/knife.8 +89 -79
  3. data/distro/common/markdown/knife.mkd +7 -0
  4. data/distro/debian/etc/default/chef-server +3 -0
  5. data/distro/debian/etc/default/chef-server-webui +3 -0
  6. data/distro/debian/etc/default/chef-solr +3 -0
  7. data/distro/debian/etc/default/chef-solr-indexer +3 -0
  8. data/distro/debian/etc/init.d/chef-server +3 -1
  9. data/distro/debian/etc/init.d/chef-server-webui +3 -1
  10. data/distro/redhat/etc/init.d/chef-client +1 -1
  11. data/lib/chef/application.rb +2 -0
  12. data/lib/chef/application/client.rb +5 -3
  13. data/lib/chef/application/knife.rb +16 -5
  14. data/lib/chef/application/solo.rb +0 -1
  15. data/lib/chef/checksum.rb +65 -1
  16. data/lib/chef/checksum_cache.rb +173 -0
  17. data/lib/chef/client.rb +84 -121
  18. data/lib/chef/cookbook/remote_file_vendor.rb +10 -3
  19. data/lib/chef/cookbook/syntax_check.rb +2 -2
  20. data/lib/chef/cookbook_loader.rb +2 -0
  21. data/lib/chef/cookbook_site_streaming_uploader.rb +29 -0
  22. data/lib/chef/cookbook_uploader.rb +8 -7
  23. data/lib/chef/cookbook_version.rb +155 -114
  24. data/lib/chef/exceptions.rb +5 -0
  25. data/lib/chef/handler.rb +43 -0
  26. data/lib/chef/index_queue/consumer.rb +1 -1
  27. data/lib/chef/index_queue/indexable.rb +1 -1
  28. data/lib/chef/knife.rb +18 -5
  29. data/lib/chef/knife/bootstrap.rb +2 -2
  30. data/lib/chef/knife/bootstrap/archlinux-gems.erb +44 -0
  31. data/lib/chef/knife/bootstrap/client-install.vbs +80 -0
  32. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -2
  33. data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +6 -7
  34. data/lib/chef/knife/bootstrap/windows-gems.erb +34 -0
  35. data/lib/chef/knife/configure_client.rb +4 -2
  36. data/lib/chef/knife/cookbook_metadata.rb +1 -1
  37. data/lib/chef/knife/cookbook_site_share.rb +2 -1
  38. data/lib/chef/knife/cookbook_site_vendor.rb +6 -0
  39. data/lib/chef/knife/cookbook_test.rb +1 -1
  40. data/lib/chef/knife/ec2_server_create.rb +51 -26
  41. data/lib/chef/knife/exec.rb +52 -0
  42. data/lib/chef/knife/ssh.rb +27 -15
  43. data/lib/chef/knife/status.rb +27 -10
  44. data/lib/chef/knife/windows_bootstrap.rb +154 -0
  45. data/lib/chef/mixin/checksum.rb +2 -2
  46. data/lib/chef/mixin/xml_escape.rb +75 -49
  47. data/lib/chef/node.rb +54 -58
  48. data/lib/chef/node/attribute.rb +61 -53
  49. data/lib/chef/platform.rb +19 -2
  50. data/lib/chef/provider/breakpoint.rb +1 -1
  51. data/lib/chef/provider/cookbook_file.rb +3 -3
  52. data/lib/chef/provider/cron.rb +3 -3
  53. data/lib/chef/provider/cron/solaris.rb +195 -0
  54. data/lib/chef/provider/deploy.rb +3 -3
  55. data/lib/chef/provider/directory.rb +2 -2
  56. data/lib/chef/provider/env.rb +5 -5
  57. data/lib/chef/provider/execute.rb +1 -1
  58. data/lib/chef/provider/file.rb +10 -9
  59. data/lib/chef/provider/git.rb +12 -4
  60. data/lib/chef/provider/group.rb +5 -5
  61. data/lib/chef/provider/http_request.rb +25 -9
  62. data/lib/chef/provider/ifconfig.rb +2 -2
  63. data/lib/chef/provider/link.rb +11 -6
  64. data/lib/chef/provider/log.rb +1 -0
  65. data/lib/chef/provider/mdadm.rb +3 -3
  66. data/lib/chef/provider/mount.rb +5 -5
  67. data/lib/chef/provider/mount/mount.rb +1 -1
  68. data/lib/chef/provider/ohai.rb +41 -0
  69. data/lib/chef/provider/package.rb +5 -5
  70. data/lib/chef/provider/package/yum-dump.py +5 -2
  71. data/lib/chef/provider/remote_directory.rb +11 -5
  72. data/lib/chef/provider/remote_file.rb +2 -2
  73. data/lib/chef/provider/route.rb +154 -133
  74. data/lib/chef/provider/ruby_block.rb +1 -1
  75. data/lib/chef/provider/service.rb +6 -6
  76. data/lib/chef/provider/subversion.rb +12 -9
  77. data/lib/chef/provider/template.rb +2 -2
  78. data/lib/chef/provider/user.rb +7 -7
  79. data/lib/chef/provider/user/useradd.rb +15 -1
  80. data/lib/chef/providers.rb +2 -0
  81. data/lib/chef/resource.rb +164 -58
  82. data/lib/chef/resource/http_request.rb +9 -0
  83. data/lib/chef/resource/ohai.rb +40 -0
  84. data/lib/chef/resource/remote_directory.rb +10 -1
  85. data/lib/chef/resource/rpm_package.rb +34 -0
  86. data/lib/chef/resource_collection.rb +3 -2
  87. data/lib/chef/resources.rb +2 -0
  88. data/lib/chef/rest.rb +13 -7
  89. data/lib/chef/rest/auth_credentials.rb +1 -1
  90. data/lib/chef/rest/rest_request.rb +3 -1
  91. data/lib/chef/runner.rb +31 -55
  92. data/lib/chef/shef/shef_session.rb +1 -1
  93. data/lib/chef/util/windows/net_use.rb +1 -1
  94. data/lib/chef/version.rb +1 -1
  95. data/lib/chef/webui_user.rb +0 -1
  96. metadata +38 -19
  97. data/lib/chef/cache.rb +0 -61
  98. data/lib/chef/cache/checksum.rb +0 -91
@@ -1,61 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Author:: Daniel DeLeo (<dan@kallistec.com>)
4
- # Copyright:: Copyright (c) 2009 Opscode, Inc.
5
- # Copyright:: Copyright (c) 2009 Daniel DeLeo
6
- # License:: Apache License, Version 2.0
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- require 'chef/log'
22
- require 'chef/config'
23
- require 'chef/mixin/convert_to_class_name'
24
- require 'singleton'
25
- require 'moneta'
26
-
27
- class Chef
28
- class Cache
29
- include Chef::Mixin::ConvertToClassName
30
- include ::Singleton
31
-
32
- attr_reader :moneta
33
-
34
- def initialize(*args)
35
- self.reset!(*args)
36
- end
37
-
38
- def reset!(backend=nil, options=nil)
39
- backend ||= Chef::Config[:cache_type]
40
- options ||= Chef::Config[:cache_options]
41
-
42
- begin
43
- require "moneta/#{convert_to_snake_case(backend, 'Moneta')}"
44
- rescue LoadError => e
45
- Chef::Log.fatal("Could not load Moneta back end #{backend.inspect}")
46
- raise e
47
- end
48
-
49
- @moneta = Moneta.const_get(backend).new(options)
50
- end
51
-
52
- end
53
- end
54
-
55
- module Moneta
56
- module Defaults
57
- def default
58
- nil
59
- end
60
- end
61
- end
@@ -1,91 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Author:: Daniel DeLeo (<dan@kallistec.com>)
4
- # Copyright:: Copyright (c) 2009 Opscode, Inc.
5
- # Copyright:: Copyright (c) 2009 Daniel DeLeo
6
- # License:: Apache License, Version 2.0
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- require 'chef/cache'
22
- require 'digest/md5'
23
-
24
- class Chef
25
- class Cache
26
- class Checksum < Chef::Cache
27
- # singleton is inherited from Chef::Cache, but we like to be explicit.
28
- include ::Singleton
29
-
30
- def self.checksum_for_file(*args)
31
- instance.checksum_for_file(*args)
32
- end
33
-
34
- def checksum_for_file(file, key=nil)
35
- key ||= generate_key(file)
36
- fstat = File.stat(file)
37
- lookup_checksum(key, fstat) || generate_checksum(key, file, fstat)
38
- end
39
-
40
- def lookup_checksum(key, fstat)
41
- cached = @moneta.fetch(key)
42
- if cached && file_unchanged?(cached, fstat)
43
- cached["checksum"]
44
- else
45
- nil
46
- end
47
- end
48
-
49
- def generate_checksum(key, file, fstat)
50
- checksum = checksum_file(file, Digest::SHA256.new)
51
- moneta.store(key, {"mtime" => fstat.mtime.to_f, "checksum" => checksum})
52
- checksum
53
- end
54
-
55
- def generate_key(file, group="chef")
56
- "#{group}-file-#{file.gsub(/(#{File::SEPARATOR}|\.)/, '-')}"
57
- end
58
-
59
- def self.generate_md5_checksum_for_file(*args)
60
- instance.generate_md5_checksum_for_file(*args)
61
- end
62
-
63
- def generate_md5_checksum_for_file(file)
64
- checksum_file(file, Digest::MD5.new)
65
- end
66
-
67
- def generate_md5_checksum(io)
68
- checksum_io(io, Digest::MD5.new)
69
- end
70
-
71
- private
72
-
73
- def file_unchanged?(cached, fstat)
74
- cached["mtime"].to_f == fstat.mtime.to_f
75
- end
76
-
77
- def checksum_file(file, digest)
78
- File.open(file) { |f| checksum_io(f, digest) }
79
- end
80
-
81
- def checksum_io(io, digest)
82
- while chunk = io.read(1024 * 8)
83
- digest.update(chunk)
84
- end
85
- digest.hexdigest
86
- end
87
-
88
- end
89
- end
90
- end
91
-