chef 0.9.0 → 0.9.2

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.
@@ -0,0 +1,17 @@
1
+ # chef-client - Chef Configuration Management Client
2
+ #
3
+ # Chef Client provides the Chef configuration management daemon
4
+
5
+ description "Chef Client"
6
+
7
+ start on filesystem
8
+ stop on runlevel [!2345]
9
+
10
+ respawn
11
+ respawn limit 5 30
12
+
13
+ pre-start script
14
+ test -x /usr/bin/chef-client || { stop; exit 0; }
15
+ end script
16
+
17
+ exec /usr/bin/chef-client -i 1800 -L /var/log/chef/client.log
@@ -0,0 +1,17 @@
1
+ # chef-server-webui - Chef Server WebUI
2
+ #
3
+ # Chef Server WebUI provides the browser-accessible UI to the Chef Server API
4
+
5
+ description "Chef Server WebUI"
6
+
7
+ start on filesystem
8
+ stop on runlevel [!2345]
9
+
10
+ respawn
11
+ respawn limit 5 30
12
+
13
+ pre-start script
14
+ test -x /usr/bin/chef-server-webui || { stop; exit 0; }
15
+ end script
16
+
17
+ exec /usr/bin/chef-server-webui -e production -p 4040 -L /var/log/chef/server-webui.log
@@ -0,0 +1,17 @@
1
+ # chef-server - Chef Server
2
+ #
3
+ # Chef Server provides the Chef API server
4
+
5
+ description "Chef Server API"
6
+
7
+ start on filesystem
8
+ stop on runlevel [!2345]
9
+
10
+ respawn
11
+ respawn limit 5 30
12
+
13
+ pre-start script
14
+ test -x /usr/bin/chef-server || { stop; exit 0; }
15
+ end script
16
+
17
+ exec /usr/bin/chef-server -e production -p 4000 -L /var/log/chef/server.log
@@ -0,0 +1,17 @@
1
+ # chef-solr-indexer - Chef Solr Indexer
2
+ #
3
+ # Chef Solr Indexer provides indexing of Solr for Chef Server
4
+
5
+ description "Chef Solr Indexer"
6
+
7
+ start on filesystem
8
+ stop on runlevel [!2345]
9
+
10
+ respawn
11
+ respawn limit 5 30
12
+
13
+ pre-start script
14
+ test -x /usr/bin/chef-solr-indexer || { stop; exit 0; }
15
+ end script
16
+
17
+ exec /usr/bin/chef-solr-indexer -c /etc/chef/solr.rb -L /var/log/chef/solr-indexer.log
@@ -0,0 +1,17 @@
1
+ # chef-solr - Chef Solr
2
+ #
3
+ # Chef Solr provides Solr search for Chef Server
4
+
5
+ description "Chef Solr"
6
+
7
+ start on filesystem
8
+ stop on runlevel [!2345]
9
+
10
+ respawn
11
+ respawn limit 5 30
12
+
13
+ pre-start script
14
+ test -x /usr/bin/chef-solr || { stop; exit 0; }
15
+ end script
16
+
17
+ exec /usr/bin/chef-solr -c /etc/chef/solr.rb -L /var/log/chef/solr.log
@@ -34,76 +34,6 @@ require 'chef/run_status'
34
34
  require 'chef/handler'
35
35
  require 'chef/handler/json_file'
36
36
 
37
- # Adds a Dir.glob to Ruby 1.8.5, for compat
38
- if RUBY_VERSION < "1.8.6" || RUBY_PLATFORM =~ /mswin|mingw32|windows/
39
- class Dir
40
- class << self
41
- alias_method :glob_, :glob
42
- def glob(pattern, flags=0)
43
- raise ArgumentError unless (
44
- !pattern.nil? and (
45
- pattern.is_a? Array and !pattern.empty?
46
- ) or pattern.is_a? String
47
- )
48
- pattern.gsub!(/\\/, "/") if RUBY_PLATFORM =~ /mswin|mingw32|windows/
49
- [pattern].flatten.inject([]) { |r, p| r + glob_(p, flags) }
50
- end
51
- alias_method :[], :glob
52
- end
53
- end
54
- end
55
-
56
-
57
- # On ruby 1.9, Strings are aware of multibyte characters, so #size and length
58
- # give the actual number of characters. In Chef::REST, we need the bytesize
59
- # so we can correctly set the Content-Length headers, but ruby 1.8.6 and lower
60
- # don't define String#bytesize. Monkey patching time!
61
- class String
62
- unless method_defined?(:bytesize)
63
- alias :bytesize :size
64
- end
65
- end
66
-
67
-
68
- # Tempfile has a horrible bug where it causes an IOError: closed stream in its
69
- # finalizer, leading to intermittent application crashes with confusing stack
70
- # traces. Here we monkey patch the fix into place. You can track the bug on
71
- # ruby's redmine: http://redmine.ruby-lang.org/issues/show/3119
72
- class Tempfile
73
- # Tempfile has changes between 1.8.x and 1.9.x
74
- # so we monkey patch separately
75
- if RUBY_VERSION =~ /^1\.8/
76
- def unlink
77
- # keep this order for thread safeness
78
- begin
79
- File.unlink(@tmpname) if File.exist?(@tmpname)
80
- @@cleanlist.delete(@tmpname)
81
- @tmpname = nil
82
- ObjectSpace.undefine_finalizer(self)
83
- rescue Errno::EACCES
84
- # may not be able to unlink on Windows; just ignore
85
- end
86
- end
87
- alias delete unlink
88
-
89
-
90
- # There is a patch for this, to be merged into 1.9 at some point.
91
- # When that happens, we'll want to also check the RUBY_PATCHLEVEL
92
- elsif RUBY_VERSION =~ /^1\.9/
93
- def unlink
94
- # keep this order for thread safeness
95
- return unless @tmpname
96
- begin
97
- if File.exist?(@tmpname)
98
- File.unlink(@tmpname)
99
- end
100
- # remove tmpname from remover
101
- @data[0] = @data[2] = nil
102
- @tmpname = nil
103
- rescue Errno::EACCES
104
- # may not be able to unlink on Windows; just ignore
105
- end
106
- end
107
- alias delete unlink
108
- end
109
- end
37
+ require 'chef/monkey_patches/tempfile'
38
+ require 'chef/monkey_patches/dir'
39
+ require 'chef/monkey_patches/string'
@@ -19,6 +19,7 @@
19
19
 
20
20
  require 'chef/config'
21
21
  require 'chef/mixin/params_validate'
22
+ require 'chef/mixin/from_file'
22
23
  require 'chef/couchdb'
23
24
  require 'chef/certificate'
24
25
  require 'chef/index_queue'
@@ -129,7 +129,7 @@ class Chef
129
129
  def run_report_handlers(run_status)
130
130
  Chef::Log.info("Running report handlers")
131
131
  Array(Chef::Config[:report_handlers]).each do |handler|
132
- handler.run_report_safely(handler)
132
+ handler.run_report_safely(run_status)
133
133
  end
134
134
  Chef::Log.info("Report handlers complete")
135
135
  end
@@ -249,7 +249,7 @@ class Chef
249
249
  Chef::Log.debug("Synchronizing cookbook #{cookbook.name}")
250
250
 
251
251
  # files and templates are lazily loaded, and will be done later.
252
- eager_segments = Array(Chef::CookbookVersion::COOKBOOK_SEGMENTS)
252
+ eager_segments = Chef::CookbookVersion::COOKBOOK_SEGMENTS.dup
253
253
  eager_segments.delete(:files)
254
254
  eager_segments.delete(:templates)
255
255
 
@@ -20,7 +20,7 @@
20
20
  require 'rest_client'
21
21
 
22
22
  require 'chef/knife'
23
- require 'chef/streaming_cookbook_uploader'
23
+ require 'chef/cookbook_loader'
24
24
  require 'chef/cache/checksum'
25
25
  require 'chef/sandbox'
26
26
  require 'chef/cookbook_version'
@@ -144,7 +144,7 @@ class Chef
144
144
  begin
145
145
  catch_auth_exceptions{ rest.put_rest(sandbox_url, {:is_completed => true}) }
146
146
  rescue Net::HTTPServerException => e
147
- if e.to_s =~ /400 "Bad Request"/ && retries += 1 <= 1
147
+ if e.message =~ /^400/ && (retries += 1) <= 1
148
148
  sleep 2
149
149
  retry
150
150
  else
@@ -0,0 +1,53 @@
1
+ #
2
+ # Author:: Ian Meyer (<ianmmeyer@gmail.com>)
3
+ # Copyright:: Copyright (c) 2010 Ian Meyer
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+ require 'json'
21
+
22
+ class Chef
23
+ class Knife
24
+ class SlicehostImagesList < Knife
25
+
26
+ banner "Sub-Command: slicehost images list"
27
+
28
+ def highline
29
+ @highline ||= HighLine.new
30
+ end
31
+
32
+ def run
33
+ require 'fog'
34
+ require 'highline'
35
+
36
+ slicehost = Fog::Slicehost.new(
37
+ :slicehost_password => Chef::Config[:knife][:slicehost_password]
38
+ )
39
+
40
+ images = slicehost.images.inject({}) { |h,i| h[i.id] = i.name; h }
41
+
42
+ image_list = [ highline.color('ID', :bold), highline.color('Name', :bold) ]
43
+
44
+ slicehost.images.each do |server|
45
+ image_list << server.id.to_s
46
+ image_list << server.name
47
+ end
48
+ puts highline.list(image_list, :columns_across, 2)
49
+
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,103 @@
1
+ #
2
+ # Author:: Ian Meyer (<ianmmeyer@gmail.com>)
3
+ # Copyright:: Copyright (c) 2009 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+ require 'json'
21
+
22
+ class Chef
23
+ class Knife
24
+ class SlicehostServerCreate < Knife
25
+
26
+ banner "Sub-Command: slicehost server create [RUN LIST...] (options)"
27
+
28
+ option :flavor,
29
+ :short => "-f FLAVOR",
30
+ :long => "--flavor FLAVOR",
31
+ :description => "The flavor of server",
32
+ :proc => Proc.new { |f| f.to_i },
33
+ :default => 1
34
+
35
+ option :image,
36
+ :short => "-i IMAGE",
37
+ :long => "--image IMAGE",
38
+ :description => "The image of the server",
39
+ :proc => Proc.new { |i| i.to_i },
40
+ :default => 49
41
+
42
+ option :server_name,
43
+ :short => "-N NAME",
44
+ :long => "--server-name NAME",
45
+ :description => "The server name",
46
+ :default => "wtf"
47
+
48
+ option :slicehost_password,
49
+ :short => "-K KEY",
50
+ :long => "--slicehost-password password",
51
+ :description => "Your slicehost API password",
52
+ :proc => Proc.new { |password| Chef::Config[:knife][:slicehost_password] = password }
53
+
54
+
55
+ def h
56
+ @highline ||= HighLine.new
57
+ end
58
+
59
+ def run
60
+ require 'fog'
61
+ require 'highline'
62
+ require 'net/ssh/multi'
63
+ require 'readline'
64
+
65
+ slicehost = Fog::Slicehost.new(
66
+ :slicehost_password => Chef::Config[:knife][:slicehost_password]
67
+ )
68
+
69
+ flavors = slicehost.flavors.inject({}) { |h,f| h[f.id] = f.name; h }
70
+ images = slicehost.images.inject({}) { |h,i| h[i.id] = i.name; h }
71
+
72
+ response = slicehost.create_slice(config[:flavor],
73
+ config[:image],
74
+ config[:server_name])
75
+ $stdout.sync = true
76
+
77
+ puts "#{h.color("Name", :cyan)}: #{response.body['name']}"
78
+ puts "#{h.color("Flavor", :cyan)}: #{flavors[response.body['flavor-id']]}"
79
+ puts "#{h.color("Image", :cyan)}: #{images[response.body['image-id']]}"
80
+ puts "#{h.color("Public Address", :cyan)}: #{response.body['addresses'][1]}"
81
+ puts "#{h.color("Private Address", :cyan)}: #{response.body['addresses'][0]}"
82
+ puts "#{h.color("Password", :cyan)}: #{response.body['root-password']}"
83
+
84
+ print "\n#{h.color("Requesting status of #{response.body['name']}", :magenta)}"
85
+ saved_password = response.body['root-password']
86
+
87
+ # wait for it to be ready to do stuff
88
+ loop do
89
+ sleep 15
90
+ host = slicehost.get_slice(response.body['id'])
91
+ if host.body['status'] == 'active'
92
+ break
93
+ end
94
+ end
95
+
96
+ puts "\nServer ready!!"
97
+
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+
@@ -0,0 +1,61 @@
1
+ #
2
+ # Author:: Ian Meyer (<ianmmeyer@gmail.com>)
3
+ # Copyright:: Copyright (c) 2009 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+ require 'json'
21
+
22
+ class Chef
23
+ class Knife
24
+ class SlicehostServerDelete < Knife
25
+
26
+ banner "Sub-Command: slicehost server delete SLICENAME"
27
+
28
+ def run
29
+ require 'fog'
30
+ require 'readline'
31
+
32
+ slicehost = Fog::Slicehost.new(
33
+ :slicehost_password => Chef::Config[:knife][:slicehost_password]
34
+ )
35
+
36
+ # Build hash of slice => id
37
+ servers = slicehost.servers.inject({}) { |h,f| h[f.name] = f.id; h }
38
+
39
+ unless servers.has_key?(@name_args[0])
40
+ Chef::Log.warn("I can't find a slice named #{@name_args[0]}")
41
+ return false
42
+ end
43
+
44
+ confirm("Do you really want to delete server ID #{servers[@name_args[0]]} named #{@name_args[0]}")
45
+
46
+ begin
47
+ response = slicehost.delete_slice(servers[@name_args[0]])
48
+
49
+ if response.headers['status'] == "200 OK"
50
+ Chef::Log.warn("Deleted server #{servers[@name_args[0]]} named #{@name_args[0]}")
51
+ end
52
+ rescue Excon::Errors::UnprocessableEntity
53
+ Chef::Log.warn("There was a problem deleting #{@name_args[0]}, check your slice manager")
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+
61
+
@@ -0,0 +1,64 @@
1
+ #
2
+ # Author:: Ian Meyer (<ianmmeyer@gmail.com>)
3
+ # Copyright:: Copyright (c) 2009 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife'
20
+ require 'json'
21
+
22
+ class Chef
23
+ class Knife
24
+ class SlicehostServerList < Knife
25
+
26
+ banner "Sub-Command: slicehost server list (options)"
27
+
28
+ def h
29
+ @highline ||= HighLine.new
30
+ end
31
+
32
+ def run
33
+ require 'fog'
34
+ require 'highline'
35
+ require 'net/ssh/multi'
36
+ require 'readline'
37
+
38
+ slicehost = Fog::Slicehost.new(
39
+ :slicehost_password => Chef::Config[:knife][:slicehost_password]
40
+ )
41
+
42
+ # Make hash of flavor id => name and image id => name
43
+ flavors = slicehost.flavors.inject({}) { |h,f| h[f.id] = f.name; h }
44
+ images = slicehost.images.inject({}) { |h,i| h[i.id] = i.name; h }
45
+
46
+ server_list = [ h.color('ID', :bold), h.color('Name', :bold), h.color('Public IP', :bold), h.color('Private IP', :bold), h.color('Image', :bold), h.color('Flavor', :bold) ]
47
+
48
+ slicehost.servers.each do |server|
49
+ server_list << server.id.to_s
50
+ server_list << server.name
51
+ server_list << server.addresses[1]
52
+ server_list << server.addresses[0]
53
+ server_list << images[server.image_id].to_s
54
+ server_list << flavors[server.flavor_id].to_s
55
+ end
56
+ puts h.list(server_list, :columns_across, 6)
57
+
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+
64
+
@@ -17,7 +17,7 @@
17
17
  # See the License for the specific language governing permissions and
18
18
  # limitations under the License.
19
19
 
20
- require 'chef'
20
+ require 'logger'
21
21
  require 'mixlib/log'
22
22
 
23
23
  class Chef
@@ -0,0 +1,36 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ # Adds a Dir.glob to Ruby 1.8.5, for compat
20
+ if RUBY_VERSION < "1.8.6" || RUBY_PLATFORM =~ /mswin|mingw32|windows/
21
+ class Dir
22
+ class << self
23
+ alias_method :glob_, :glob
24
+ def glob(pattern, flags=0)
25
+ raise ArgumentError unless (
26
+ !pattern.nil? and (
27
+ pattern.is_a? Array and !pattern.empty?
28
+ ) or pattern.is_a? String
29
+ )
30
+ pattern.gsub!(/\\/, "/") if RUBY_PLATFORM =~ /mswin|mingw32|windows/
31
+ [pattern].flatten.inject([]) { |r, p| r + glob_(p, flags) }
32
+ end
33
+ alias_method :[], :glob
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,27 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ # On ruby 1.9, Strings are aware of multibyte characters, so #size and length
20
+ # give the actual number of characters. In Chef::REST, we need the bytesize
21
+ # so we can correctly set the Content-Length headers, but ruby 1.8.6 and lower
22
+ # don't define String#bytesize. Monkey patching time!
23
+ class String
24
+ unless method_defined?(:bytesize)
25
+ alias :bytesize :size
26
+ end
27
+ end
@@ -0,0 +1,60 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ # Tempfile has a horrible bug where it causes an IOError: closed stream in its
20
+ # finalizer, leading to intermittent application crashes with confusing stack
21
+ # traces. Here we monkey patch the fix into place. You can track the bug on
22
+ # ruby's redmine: http://redmine.ruby-lang.org/issues/show/3119
23
+ class Tempfile
24
+ # Tempfile has changes between 1.8.x and 1.9.x
25
+ # so we monkey patch separately
26
+ if RUBY_VERSION =~ /^1\.8/
27
+ def unlink
28
+ # keep this order for thread safeness
29
+ begin
30
+ File.unlink(@tmpname) if File.exist?(@tmpname)
31
+ @@cleanlist.delete(@tmpname)
32
+ @tmpname = nil
33
+ ObjectSpace.undefine_finalizer(self)
34
+ rescue Errno::EACCES
35
+ # may not be able to unlink on Windows; just ignore
36
+ end
37
+ end
38
+ alias delete unlink
39
+
40
+
41
+ # There is a patch for this, to be merged into 1.9 at some point.
42
+ # When that happens, we'll want to also check the RUBY_PATCHLEVEL
43
+ elsif RUBY_VERSION =~ /^1\.9/
44
+ def unlink
45
+ # keep this order for thread safeness
46
+ return unless @tmpname
47
+ begin
48
+ if File.exist?(@tmpname)
49
+ File.unlink(@tmpname)
50
+ end
51
+ # remove tmpname from remover
52
+ @data[0] = @data[2] = nil
53
+ @tmpname = nil
54
+ rescue Errno::EACCES
55
+ # may not be able to unlink on Windows; just ignore
56
+ end
57
+ end
58
+ alias delete unlink
59
+ end
60
+ end
@@ -39,7 +39,7 @@ class Chef
39
39
  Chef::Log.debug("Checking for mount point #{@current_resource.mount_point}")
40
40
 
41
41
  # only check for existence of non-remote devices
42
- if(@new_resource.device !~ /:/ && @new_resource.device !~ /\/\// && !::File.exists?(@new_resource.device) )
42
+ if(@new_resource.device !~ /:/ && @new_resource.device !~ /\/\// && !::File.exists?(device_real) )
43
43
  raise Chef::Exceptions::Mount, "Device #{@new_resource.device} does not exist"
44
44
  elsif( !::File.exists?(@new_resource.mount_point) )
45
45
  raise Chef::Exceptions::Mount, "Mount point #{@new_resource.mount_point} does not exist"
@@ -84,7 +84,14 @@ class Chef
84
84
  unless @current_resource.mounted
85
85
  command = "mount -t #{@new_resource.fstype}"
86
86
  command << " -o #{@new_resource.options.join(',')}" unless @new_resource.options.nil? || @new_resource.options.empty?
87
- command << " #{device_real}"
87
+ command << case @new_resource.device_type
88
+ when :device
89
+ " #{device_real}"
90
+ when :label
91
+ " -L #{@new_resource.device}"
92
+ when :uuid
93
+ " -U #{@new_resource.device}"
94
+ end
88
95
  command << " #{@new_resource.mount_point}"
89
96
  shell_out!(command)
90
97
  Chef::Log.info("Mounted #{@new_resource.mount_point}")
@@ -174,11 +181,10 @@ class Chef
174
181
  if @new_resource.device_type == :device
175
182
  @real_device = @new_resource.device
176
183
  else
184
+ @real_device = ""
177
185
  status = popen4("/sbin/findfs #{device_fstab}") do |pid, stdin, stdout, stderr|
178
- @real_device = stdout.first.chomp
179
- end
180
- unless status.exitstatus == 0
181
- @real_device = "/dev/null"
186
+ device_line = stdout.first # stdout.first consumes
187
+ @real_device = device_line.chomp unless device_line.nil?
182
188
  end
183
189
  end
184
190
  end
@@ -41,7 +41,7 @@ class Chef
41
41
 
42
42
  super
43
43
 
44
- chkconfig = shell_out!("/sbin/chkconfig --list #{@current_resource.service_name}")
44
+ chkconfig = shell_out!("/sbin/chkconfig --list #{@current_resource.service_name}", :returns => [0,1])
45
45
  @current_resource.enabled(!!(chkconfig.stdout =~ CHKCONFIG_ON))
46
46
  @current_resource
47
47
  end
@@ -52,7 +52,7 @@ class Chef
52
52
  Chef::Log.info("Writing updated content for #{@new_resource} to #{@new_resource.path}")
53
53
  backup
54
54
  set_all_access_controls(rendered_template.path)
55
- FileUtils.cp(rendered_template.path, @new_resource.path)
55
+ FileUtils.mv(rendered_template.path, @new_resource.path)
56
56
  @new_resource.updated = true
57
57
  end
58
58
  end
@@ -27,6 +27,7 @@ require 'tempfile'
27
27
  require 'chef/api_client'
28
28
  require 'chef/rest/auth_credentials'
29
29
  require 'chef/rest/rest_request'
30
+ require 'chef/monkey_patches/string'
30
31
 
31
32
  class Chef
32
33
  class REST
@@ -23,6 +23,7 @@
23
23
  require 'uri'
24
24
  require 'net/http'
25
25
  require 'chef/rest/cookie_jar'
26
+ require 'chef/version'
26
27
 
27
28
  class Chef
28
29
  class REST
@@ -165,4 +166,4 @@ class Chef
165
166
 
166
167
  end
167
168
  end
168
- end
169
+ end
@@ -19,6 +19,8 @@
19
19
  require 'etc'
20
20
  require 'tmpdir'
21
21
  require 'chef/log'
22
+ require 'fcntl'
23
+ require 'chef/exceptions'
22
24
 
23
25
  class Chef
24
26
 
@@ -42,6 +44,7 @@ class Chef
42
44
  attr_accessor :user, :group, :cwd, :valid_exit_codes
43
45
  attr_reader :command, :umask, :environment
44
46
  attr_writer :timeout
47
+ attr_reader :execution_time
45
48
 
46
49
  attr_reader :stdout, :stderr, :status
47
50
 
@@ -136,7 +139,7 @@ class Chef
136
139
  propagate_pre_exec_failure
137
140
 
138
141
  @result = nil
139
- read_time = 0
142
+ @execution_time = 0
140
143
 
141
144
  # Ruby 1.8.7 and 1.8.6 from mid 2009 try to allocate objects during GC
142
145
  # when calling IO.select and IO#read. Some OS Vendors are not interested
@@ -146,8 +149,8 @@ class Chef
146
149
  until @status
147
150
  ready = IO.select(open_pipes, nil, nil, READ_WAIT_TIME)
148
151
  unless ready
149
- read_time += READ_WAIT_TIME
150
- if read_time >= timeout && !@result
152
+ @execution_time += READ_WAIT_TIME
153
+ if @execution_time >= timeout && !@result
151
154
  raise Chef::Exceptions::CommandTimeout, "command timed out:\n#{format_for_exception}"
152
155
  end
153
156
  end
@@ -9,6 +9,7 @@
9
9
  require 'net/http'
10
10
  require 'mixlib/authentication/signedheaderauth'
11
11
  require 'openssl'
12
+ require 'chef/version'
12
13
 
13
14
  class Chef
14
15
  class StreamingCookbookUploader
@@ -16,5 +16,5 @@
16
16
  # limitations under the License.
17
17
 
18
18
  class Chef
19
- VERSION = '0.9.0'
20
- end
19
+ VERSION = '0.9.2'
20
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 9
9
- - 0
10
- version: 0.9.0
8
+ - 2
9
+ version: 0.9.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Adam Jacob
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-06-20 00:00:00 -07:00
17
+ date: 2010-06-29 00:00:00 -07:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 19
30
28
  segments:
31
29
  - 1
32
30
  - 1
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 19
46
43
  segments:
47
44
  - 1
48
45
  - 1
@@ -58,7 +55,6 @@ dependencies:
58
55
  requirements:
59
56
  - - ">="
60
57
  - !ruby/object:Gem::Version
61
- hash: 19
62
58
  segments:
63
59
  - 1
64
60
  - 1
@@ -74,7 +70,6 @@ dependencies:
74
70
  requirements:
75
71
  - - ">="
76
72
  - !ruby/object:Gem::Version
77
- hash: 19
78
73
  segments:
79
74
  - 1
80
75
  - 1
@@ -90,7 +85,6 @@ dependencies:
90
85
  requirements:
91
86
  - - ">="
92
87
  - !ruby/object:Gem::Version
93
- hash: 11
94
88
  segments:
95
89
  - 0
96
90
  - 5
@@ -106,7 +100,6 @@ dependencies:
106
100
  requirements:
107
101
  - - ">="
108
102
  - !ruby/object:Gem::Version
109
- hash: 31
110
103
  segments:
111
104
  - 1
112
105
  - 0
@@ -114,7 +107,6 @@ dependencies:
114
107
  version: 1.0.4
115
108
  - - <=
116
109
  - !ruby/object:Gem::Version
117
- hash: 1
118
110
  segments:
119
111
  - 1
120
112
  - 5
@@ -130,7 +122,6 @@ dependencies:
130
122
  requirements:
131
123
  - - ">="
132
124
  - !ruby/object:Gem::Version
133
- hash: 7
134
125
  segments:
135
126
  - 0
136
127
  - 6
@@ -146,7 +137,6 @@ dependencies:
146
137
  requirements:
147
138
  - - <=
148
139
  - !ruby/object:Gem::Version
149
- hash: 3
150
140
  segments:
151
141
  - 1
152
142
  - 4
@@ -162,7 +152,6 @@ dependencies:
162
152
  requirements:
163
153
  - - ">="
164
154
  - !ruby/object:Gem::Version
165
- hash: 3
166
155
  segments:
167
156
  - 0
168
157
  version: "0"
@@ -176,7 +165,6 @@ dependencies:
176
165
  requirements:
177
166
  - - ">="
178
167
  - !ruby/object:Gem::Version
179
- hash: 3
180
168
  segments:
181
169
  - 0
182
170
  version: "0"
@@ -190,7 +178,6 @@ dependencies:
190
178
  requirements:
191
179
  - - ">="
192
180
  - !ruby/object:Gem::Version
193
- hash: 3
194
181
  segments:
195
182
  - 0
196
183
  version: "0"
@@ -204,7 +191,6 @@ dependencies:
204
191
  requirements:
205
192
  - - ">="
206
193
  - !ruby/object:Gem::Version
207
- hash: 3
208
194
  segments:
209
195
  - 0
210
196
  version: "0"
@@ -218,7 +204,6 @@ dependencies:
218
204
  requirements:
219
205
  - - ">="
220
206
  - !ruby/object:Gem::Version
221
- hash: 3
222
207
  segments:
223
208
  - 0
224
209
  version: "0"
@@ -256,6 +241,11 @@ files:
256
241
  - distro/debian/etc/default/chef-server-webui
257
242
  - distro/debian/etc/default/chef-solr
258
243
  - distro/debian/etc/default/chef-solr-indexer
244
+ - distro/debian/etc/init/chef-client.conf
245
+ - distro/debian/etc/init/chef-server-webui.conf
246
+ - distro/debian/etc/init/chef-server.conf
247
+ - distro/debian/etc/init/chef-solr-indexer.conf
248
+ - distro/debian/etc/init/chef-solr.conf
259
249
  - distro/debian/etc/init.d/chef-client
260
250
  - distro/debian/etc/init.d/chef-server
261
251
  - distro/debian/etc/init.d/chef-server-webui
@@ -369,6 +359,10 @@ files:
369
359
  - lib/chef/knife/role_list.rb
370
360
  - lib/chef/knife/role_show.rb
371
361
  - lib/chef/knife/search.rb
362
+ - lib/chef/knife/slicehost_images_list.rb
363
+ - lib/chef/knife/slicehost_server_create.rb
364
+ - lib/chef/knife/slicehost_server_delete.rb
365
+ - lib/chef/knife/slicehost_server_list.rb
372
366
  - lib/chef/knife/ssh.rb
373
367
  - lib/chef/knife/status.rb
374
368
  - lib/chef/knife/terremark_server_create.rb
@@ -394,6 +388,9 @@ files:
394
388
  - lib/chef/mixin/template.rb
395
389
  - lib/chef/mixin/xml_escape.rb
396
390
  - lib/chef/mixins.rb
391
+ - lib/chef/monkey_patches/dir.rb
392
+ - lib/chef/monkey_patches/string.rb
393
+ - lib/chef/monkey_patches/tempfile.rb
397
394
  - lib/chef/node/attribute.rb
398
395
  - lib/chef/node.rb
399
396
  - lib/chef/openid_registration.rb
@@ -561,7 +558,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
561
558
  requirements:
562
559
  - - ">="
563
560
  - !ruby/object:Gem::Version
564
- hash: 3
565
561
  segments:
566
562
  - 0
567
563
  version: "0"
@@ -570,7 +566,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
570
566
  requirements:
571
567
  - - ">="
572
568
  - !ruby/object:Gem::Version
573
- hash: 3
574
569
  segments:
575
570
  - 0
576
571
  version: "0"