chef 10.14.0 → 10.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/distro/common/html/chef-client.8.html +3 -3
  2. data/distro/common/html/chef-expander.8.html +3 -3
  3. data/distro/common/html/chef-expanderctl.8.html +3 -3
  4. data/distro/common/html/chef-server-webui.8.html +3 -3
  5. data/distro/common/html/chef-server.8.html +3 -3
  6. data/distro/common/html/chef-solo.8.html +3 -3
  7. data/distro/common/html/chef-solr.8.html +3 -3
  8. data/distro/common/html/knife-bootstrap.1.html +3 -3
  9. data/distro/common/html/knife-client.1.html +3 -3
  10. data/distro/common/html/knife-configure.1.html +4 -4
  11. data/distro/common/html/knife-cookbook-site.1.html +3 -3
  12. data/distro/common/html/knife-cookbook.1.html +3 -3
  13. data/distro/common/html/knife-data-bag.1.html +3 -3
  14. data/distro/common/html/knife-environment.1.html +6 -6
  15. data/distro/common/html/knife-exec.1.html +3 -3
  16. data/distro/common/html/knife-index.1.html +3 -3
  17. data/distro/common/html/knife-node.1.html +3 -3
  18. data/distro/common/html/knife-role.1.html +6 -6
  19. data/distro/common/html/knife-search.1.html +5 -5
  20. data/distro/common/html/knife-ssh.1.html +3 -3
  21. data/distro/common/html/knife-status.1.html +4 -4
  22. data/distro/common/html/knife-tag.1.html +4 -4
  23. data/distro/common/html/knife.1.html +11 -11
  24. data/distro/common/html/shef.1.html +7 -7
  25. data/distro/common/man/man1/knife-bootstrap.1 +1 -1
  26. data/distro/common/man/man1/knife-client.1 +1 -1
  27. data/distro/common/man/man1/knife-configure.1 +1 -1
  28. data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
  29. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  30. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  31. data/distro/common/man/man1/knife-environment.1 +1 -1
  32. data/distro/common/man/man1/knife-exec.1 +1 -1
  33. data/distro/common/man/man1/knife-index.1 +1 -1
  34. data/distro/common/man/man1/knife-node.1 +1 -1
  35. data/distro/common/man/man1/knife-role.1 +1 -1
  36. data/distro/common/man/man1/knife-search.1 +1 -1
  37. data/distro/common/man/man1/knife-ssh.1 +1 -1
  38. data/distro/common/man/man1/knife-status.1 +1 -1
  39. data/distro/common/man/man1/knife-tag.1 +1 -1
  40. data/distro/common/man/man1/knife.1 +1 -1
  41. data/distro/common/man/man1/shef.1 +1 -1
  42. data/distro/common/man/man8/chef-client.8 +1 -1
  43. data/distro/common/man/man8/chef-expander.8 +1 -1
  44. data/distro/common/man/man8/chef-expanderctl.8 +1 -1
  45. data/distro/common/man/man8/chef-server-webui.8 +1 -1
  46. data/distro/common/man/man8/chef-server.8 +1 -1
  47. data/distro/common/man/man8/chef-solo.8 +1 -1
  48. data/distro/common/man/man8/chef-solr.8 +1 -1
  49. data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +2 -2
  50. data/lib/chef/knife/ssh.rb +1 -1
  51. data/lib/chef/knife/status.rb +4 -6
  52. data/lib/chef/provider/service/freebsd.rb +1 -2
  53. data/lib/chef/provider/service/systemd.rb +1 -1
  54. data/lib/chef/provider/user/useradd.rb +4 -4
  55. data/lib/chef/resource/group.rb +1 -1
  56. data/lib/chef/version.rb +1 -1
  57. data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +39 -0
  58. data/spec/unit/knife/status_spec.rb +43 -0
  59. data/spec/unit/provider/user/useradd_spec.rb +16 -10
  60. metadata +5 -4
@@ -68,8 +68,7 @@ class Chef
68
68
  end
69
69
 
70
70
  def define_resource_requirements
71
- super
72
-
71
+ shared_resource_requirements
73
72
  requirements.assert(:start, :enable, :reload, :restart) do |a|
74
73
  a.assertion { @rcd_script_found }
75
74
  a.failure_message Chef::Exceptions::Service, "#{@new_resource}: unable to locate the rc.d script"
@@ -48,7 +48,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
48
48
  end
49
49
 
50
50
  def define_resource_requirements
51
- super
51
+ shared_resource_requirements
52
52
  requirements.assert(:all_actions) do |a|
53
53
  a.assertion { @status_check_success }
54
54
  # We won't stop in any case, but in whyrun warn and tell what we're doing.
@@ -34,8 +34,9 @@ class Chef
34
34
  end
35
35
 
36
36
  def manage_user
37
- command = compile_command("usermod") { |u| u << universal_options }
38
- command << " -m" if managing_home_dir?
37
+ command = compile_command("usermod") do |u|
38
+ u << universal_options
39
+ end
39
40
  run_command(:command => command)
40
41
  end
41
42
 
@@ -108,7 +109,7 @@ class Chef
108
109
  if updating_home?
109
110
  if managing_home_dir?
110
111
  Chef::Log.debug("#{@new_resource} managing the users home directory")
111
- opts << " -d '#{@new_resource.home}'"
112
+ opts << " -m -d '#{@new_resource.home}'"
112
113
  else
113
114
  Chef::Log.debug("#{@new_resource} setting home to #{@new_resource.home}")
114
115
  opts << " -d '#{@new_resource.home}'"
@@ -120,7 +121,6 @@ class Chef
120
121
 
121
122
  def useradd_options
122
123
  opts = ''
123
- opts << " -m" if updating_home? && managing_home_dir?
124
124
  opts << " -r" if @new_resource.system
125
125
  opts
126
126
  end
@@ -43,7 +43,7 @@ class Chef
43
43
  set_or_return(
44
44
  :gid,
45
45
  arg,
46
- :kind_of => [ Integer ]
46
+ :kind_of => [ String, Integer ]
47
47
  )
48
48
  end
49
49
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  class Chef
19
19
  CHEF_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
20
- VERSION = '10.14.0'
20
+ VERSION = '10.14.2'
21
21
  end
22
22
 
23
23
  # NOTE: the Chef::Version class is defined in version_class.rb
@@ -90,5 +90,44 @@ describe Chef::Formatters::ErrorInspectors::CompileErrorInspector do
90
90
  end
91
91
  end
92
92
 
93
+ describe "when explaining an error on windows" do
94
+ before do
95
+ Chef::Config.stub!(:cookbook_path).and_return([ "C:/opscode/chef/var/cache/cookbooks" ])
96
+ recipe_lines = BAD_RECIPE.split("\n").map {|l| l << "\n" }
97
+ IO.should_receive(:readlines).with("C:/opscode/chef/var/cache/cookbooks/foo/recipes/default.rb").and_return(recipe_lines)
98
+ @trace = [
99
+ "C:/opscode/chef/var/cache/cookbooks/foo/recipes/default.rb:14 in `from_file'",
100
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:144:in `rescue in block in load_libraries'",
101
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:138:in `block in load_libraries'",
102
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:230:in `call'",
103
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:230:in `block (2 levels) in foreach_cookbook_load_segment'",
104
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:229:in `each'",
105
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:229:in `block in foreach_cookbook_load_segment'",
106
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:227:in `each'",
107
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:227:in `foreach_cookbook_load_segment'",
108
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:137:in `load_libraries'",
109
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:62:in `load'",
110
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/client.rb:198:in `setup_run_context'",
111
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/client.rb:418:in `do_run'",
112
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/client.rb:176:in `run'",
113
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/application/client.rb:283:in `block in run_application'",
114
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/application/client.rb:270:in `loop'",
115
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/application/client.rb:270:in `run_application'",
116
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/application.rb:70:in `run'",
117
+ "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/bin/chef-client:26:in `<top (required)>'",
118
+ "C:/opscode/chef/bin/chef-client:19:in `load'",
119
+ "C:/opscode/chef/bin/chef-client:19:in `<main>'"
120
+ ]
121
+ @exception.set_backtrace(@trace)
122
+ @path = "/var/chef/cache/cookbooks/syntax-err/recipes/default.rb"
123
+ @inspector = described_class.new(@path, @exception)
124
+ @inspector.add_explanation(@description)
125
+ end
126
+
127
+ it "prints a pretty message" do
128
+ @description.display(@outputter)
129
+ end
130
+ end
131
+
93
132
 
94
133
  end
@@ -0,0 +1,43 @@
1
+ #
2
+ # Author:: Sahil Muthoo (<sahil.muthoo@gmail.com>)
3
+ # Copyright:: Copyright (c) 2012 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 'spec_helper'
20
+ require 'highline'
21
+
22
+ describe Chef::Knife::Status do
23
+ before(:each) do
24
+ node = Chef::Node.new.tap do |n|
25
+ n["fqdn"] = "foobar"
26
+ n["ohai_time"] = 1343845969
27
+ end
28
+ query = mock("Chef::Search::Query")
29
+ query.stub!(:search).and_yield(node)
30
+ Chef::Search::Query.stub!(:new).and_return(query)
31
+ @knife = Chef::Knife::Status.new
32
+ @stdout = StringIO.new
33
+ @knife.stub!(:highline).and_return(HighLine.new(StringIO.new, @stdout))
34
+ end
35
+
36
+ describe "run" do
37
+ it "should not colorize output unless it's writing to a tty" do
38
+ @knife.run
39
+ @stdout.string.match(/foobar/).should_not be_nil
40
+ @stdout.string.match(/\e.*ago/).should be_nil
41
+ end
42
+ end
43
+ end
@@ -115,9 +115,9 @@ describe Chef::Provider::User::Useradd do
115
115
  :non_unique => false})
116
116
  end
117
117
 
118
- it "should set -d /homedir -m" do
119
- @provider.universal_options.should == " -d '/wowaweea'"
120
- @provider.useradd_options.should == " -m"
118
+ it "should set -m -d /homedir" do
119
+ @provider.universal_options.should == " -m -d '/wowaweea'"
120
+ @provider.useradd_options.should == ""
121
121
  end
122
122
  end
123
123
 
@@ -128,9 +128,9 @@ describe Chef::Provider::User::Useradd do
128
128
  @new_resource.stub!(:non_unique).and_return(false)
129
129
  end
130
130
 
131
- it "should set -d /homedir -m" do
132
- @provider.universal_options.should eql(" -d '/wowaweea'")
133
- @provider.useradd_options.should == " -m"
131
+ it "should set -m -d /homedir" do
132
+ @provider.universal_options.should eql(" -m -d '/wowaweea'")
133
+ @provider.useradd_options.should == ""
134
134
  end
135
135
  end
136
136
 
@@ -168,7 +168,7 @@ describe Chef::Provider::User::Useradd do
168
168
  end
169
169
 
170
170
  it "runs useradd with the computed command options" do
171
- command = "useradd -c 'Adam Jacob' -g '23' -p 'abracadabra' -s '/usr/bin/zsh' -u '1000' -d '/Users/mud' -m adam"
171
+ command = "useradd -c 'Adam Jacob' -g '23' -p 'abracadabra' -s '/usr/bin/zsh' -u '1000' -m -d '/Users/mud' adam"
172
172
  @provider.should_receive(:run_command).with({ :command => command }).and_return(true)
173
173
  @provider.create_user
174
174
  end
@@ -181,7 +181,7 @@ describe Chef::Provider::User::Useradd do
181
181
  @provider.new_resource.instance_variable_set("@home", nil)
182
182
  end
183
183
 
184
- it "should not include -d in the command options" do
184
+ it "should not include -m or -d in the command options" do
185
185
  command = "useradd -c 'Adam Jacob' -g '23' -p 'abracadabra' -s '/usr/bin/zsh' -u '1000' -r adam"
186
186
  @provider.should_receive(:run_command).with({ :command => command }).and_return(true)
187
187
  @provider.create_user
@@ -198,17 +198,23 @@ describe Chef::Provider::User::Useradd do
198
198
  @provider.new_resource.gid '23'
199
199
  end
200
200
 
201
+ # CHEF-3423, -m must come before the username
201
202
  it "runs usermod with the computed command options" do
202
- @provider.should_receive(:run_command).with({ :command => "usermod -g '23' -d '/Users/mud' adam -m" }).and_return(true)
203
+ @provider.should_receive(:run_command).with({ :command => "usermod -g '23' -m -d '/Users/mud' adam" }).and_return(true)
203
204
  @provider.manage_user
204
205
  end
205
206
 
206
207
  it "does not set the -r option to usermod" do
207
208
  @new_resource.system(true)
208
- @provider.should_receive(:run_command).with({ :command => "usermod -g '23' -d '/Users/mud' adam -m" }).and_return(true)
209
+ @provider.should_receive(:run_command).with({ :command => "usermod -g '23' -m -d '/Users/mud' adam" }).and_return(true)
209
210
  @provider.manage_user
210
211
  end
211
212
 
213
+ it "CHEF-3429: does not set -m if we aren't changing the home directory" do
214
+ @provider.should_receive(:updating_home?).and_return(false)
215
+ @provider.should_receive(:run_command).with({ :command => "usermod -g '23' adam" }).and_return(true)
216
+ @provider.manage_user
217
+ end
212
218
  end
213
219
 
214
220
  describe "when removing a user" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- hash: 119
4
+ hash: 115
5
5
  prerelease:
6
6
  segments:
7
7
  - 10
8
8
  - 14
9
- - 0
10
- version: 10.14.0
9
+ - 2
10
+ version: 10.14.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adam Jacob
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-07 00:00:00 Z
18
+ date: 2012-09-10 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: mixlib-config
@@ -1151,6 +1151,7 @@ files:
1151
1151
  - spec/unit/knife/role_from_file_spec.rb
1152
1152
  - spec/unit/knife/node_run_list_add_spec.rb
1153
1153
  - spec/unit/knife/cookbook_site_download_spec.rb
1154
+ - spec/unit/knife/status_spec.rb
1154
1155
  - spec/unit/knife/configure_client_spec.rb
1155
1156
  - spec/unit/knife/ssh_spec.rb
1156
1157
  - spec/unit/knife/cookbook_metadata_from_file_spec.rb