chef 0.9.8 → 0.9.10.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/distro/common/man/man8/knife.8 +89 -79
- data/distro/common/markdown/knife.mkd +7 -0
- data/distro/debian/etc/default/chef-server +3 -0
- data/distro/debian/etc/default/chef-server-webui +3 -0
- data/distro/debian/etc/default/chef-solr +3 -0
- data/distro/debian/etc/default/chef-solr-indexer +3 -0
- data/distro/debian/etc/init.d/chef-server +3 -1
- data/distro/debian/etc/init.d/chef-server-webui +3 -1
- data/distro/redhat/etc/init.d/chef-client +1 -1
- data/lib/chef/application.rb +2 -0
- data/lib/chef/application/client.rb +5 -3
- data/lib/chef/application/knife.rb +16 -5
- data/lib/chef/application/solo.rb +0 -1
- data/lib/chef/checksum.rb +65 -1
- data/lib/chef/checksum_cache.rb +173 -0
- data/lib/chef/client.rb +84 -121
- data/lib/chef/cookbook/remote_file_vendor.rb +10 -3
- data/lib/chef/cookbook/syntax_check.rb +2 -2
- data/lib/chef/cookbook_loader.rb +2 -0
- data/lib/chef/cookbook_site_streaming_uploader.rb +29 -0
- data/lib/chef/cookbook_uploader.rb +8 -7
- data/lib/chef/cookbook_version.rb +155 -114
- data/lib/chef/exceptions.rb +5 -0
- data/lib/chef/handler.rb +43 -0
- data/lib/chef/index_queue/consumer.rb +1 -1
- data/lib/chef/index_queue/indexable.rb +1 -1
- data/lib/chef/knife.rb +18 -5
- data/lib/chef/knife/bootstrap.rb +2 -2
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +44 -0
- data/lib/chef/knife/bootstrap/client-install.vbs +80 -0
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +6 -7
- data/lib/chef/knife/bootstrap/windows-gems.erb +34 -0
- data/lib/chef/knife/configure_client.rb +4 -2
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +2 -1
- data/lib/chef/knife/cookbook_site_vendor.rb +6 -0
- data/lib/chef/knife/cookbook_test.rb +1 -1
- data/lib/chef/knife/ec2_server_create.rb +51 -26
- data/lib/chef/knife/exec.rb +52 -0
- data/lib/chef/knife/ssh.rb +27 -15
- data/lib/chef/knife/status.rb +27 -10
- data/lib/chef/knife/windows_bootstrap.rb +154 -0
- data/lib/chef/mixin/checksum.rb +2 -2
- data/lib/chef/mixin/xml_escape.rb +75 -49
- data/lib/chef/node.rb +54 -58
- data/lib/chef/node/attribute.rb +61 -53
- data/lib/chef/platform.rb +19 -2
- data/lib/chef/provider/breakpoint.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +3 -3
- data/lib/chef/provider/cron.rb +3 -3
- data/lib/chef/provider/cron/solaris.rb +195 -0
- data/lib/chef/provider/deploy.rb +3 -3
- data/lib/chef/provider/directory.rb +2 -2
- data/lib/chef/provider/env.rb +5 -5
- data/lib/chef/provider/execute.rb +1 -1
- data/lib/chef/provider/file.rb +10 -9
- data/lib/chef/provider/git.rb +12 -4
- data/lib/chef/provider/group.rb +5 -5
- data/lib/chef/provider/http_request.rb +25 -9
- data/lib/chef/provider/ifconfig.rb +2 -2
- data/lib/chef/provider/link.rb +11 -6
- data/lib/chef/provider/log.rb +1 -0
- data/lib/chef/provider/mdadm.rb +3 -3
- data/lib/chef/provider/mount.rb +5 -5
- data/lib/chef/provider/mount/mount.rb +1 -1
- data/lib/chef/provider/ohai.rb +41 -0
- data/lib/chef/provider/package.rb +5 -5
- data/lib/chef/provider/package/yum-dump.py +5 -2
- data/lib/chef/provider/remote_directory.rb +11 -5
- data/lib/chef/provider/remote_file.rb +2 -2
- data/lib/chef/provider/route.rb +154 -133
- data/lib/chef/provider/ruby_block.rb +1 -1
- data/lib/chef/provider/service.rb +6 -6
- data/lib/chef/provider/subversion.rb +12 -9
- data/lib/chef/provider/template.rb +2 -2
- data/lib/chef/provider/user.rb +7 -7
- data/lib/chef/provider/user/useradd.rb +15 -1
- data/lib/chef/providers.rb +2 -0
- data/lib/chef/resource.rb +164 -58
- data/lib/chef/resource/http_request.rb +9 -0
- data/lib/chef/resource/ohai.rb +40 -0
- data/lib/chef/resource/remote_directory.rb +10 -1
- data/lib/chef/resource/rpm_package.rb +34 -0
- data/lib/chef/resource_collection.rb +3 -2
- data/lib/chef/resources.rb +2 -0
- data/lib/chef/rest.rb +13 -7
- data/lib/chef/rest/auth_credentials.rb +1 -1
- data/lib/chef/rest/rest_request.rb +3 -1
- data/lib/chef/runner.rb +31 -55
- data/lib/chef/shef/shef_session.rb +1 -1
- data/lib/chef/util/windows/net_use.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/webui_user.rb +0 -1
- metadata +38 -19
- data/lib/chef/cache.rb +0 -61
- data/lib/chef/cache/checksum.rb +0 -91
data/lib/chef/cache.rb
DELETED
@@ -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
|
data/lib/chef/cache/checksum.rb
DELETED
@@ -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
|
-
|