cheffish 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -8
  3. data/Rakefile +24 -12
  4. data/cheffish.gemspec +15 -15
  5. data/lib/chef/resource/chef_acl.rb +63 -63
  6. data/lib/chef/resource/chef_client.rb +9 -9
  7. data/lib/chef/resource/chef_container.rb +9 -9
  8. data/lib/chef/resource/chef_data_bag.rb +9 -9
  9. data/lib/chef/resource/chef_data_bag_item.rb +27 -27
  10. data/lib/chef/resource/chef_environment.rb +21 -22
  11. data/lib/chef/resource/chef_group.rb +19 -19
  12. data/lib/chef/resource/chef_mirror.rb +32 -17
  13. data/lib/chef/resource/chef_node.rb +14 -14
  14. data/lib/chef/resource/chef_organization.rb +29 -30
  15. data/lib/chef/resource/chef_resolved_cookbooks.rb +7 -7
  16. data/lib/chef/resource/chef_role.rb +25 -22
  17. data/lib/chef/resource/chef_user.rb +13 -14
  18. data/lib/chef/resource/private_key.rb +24 -25
  19. data/lib/chef/resource/public_key.rb +6 -7
  20. data/lib/cheffish.rb +17 -17
  21. data/lib/cheffish/array_property.rb +2 -2
  22. data/lib/cheffish/base_properties.rb +3 -3
  23. data/lib/cheffish/base_resource.rb +8 -8
  24. data/lib/cheffish/basic_chef_client.rb +17 -17
  25. data/lib/cheffish/chef_actor_base.rb +8 -8
  26. data/lib/cheffish/chef_run.rb +7 -2
  27. data/lib/cheffish/chef_run_data.rb +2 -2
  28. data/lib/cheffish/chef_run_listener.rb +1 -1
  29. data/lib/cheffish/key_formatter.rb +16 -18
  30. data/lib/cheffish/merged_config.rb +5 -3
  31. data/lib/cheffish/node_properties.rb +11 -7
  32. data/lib/cheffish/recipe_dsl.rb +33 -34
  33. data/lib/cheffish/rspec.rb +3 -3
  34. data/lib/cheffish/rspec/chef_run_support.rb +13 -13
  35. data/lib/cheffish/rspec/matchers.rb +4 -4
  36. data/lib/cheffish/rspec/matchers/be_idempotent.rb +3 -3
  37. data/lib/cheffish/rspec/matchers/emit_no_warnings_or_errors.rb +3 -3
  38. data/lib/cheffish/rspec/matchers/have_updated.rb +3 -3
  39. data/lib/cheffish/rspec/recipe_run_wrapper.rb +8 -7
  40. data/lib/cheffish/rspec/repository_support.rb +6 -6
  41. data/lib/cheffish/server_api.rb +11 -11
  42. data/lib/cheffish/version.rb +1 -1
  43. data/spec/functional/fingerprint_spec.rb +12 -12
  44. data/spec/functional/merged_config_spec.rb +46 -6
  45. data/spec/functional/server_api_spec.rb +3 -3
  46. data/spec/integration/chef_acl_spec.rb +489 -489
  47. data/spec/integration/chef_client_spec.rb +39 -39
  48. data/spec/integration/chef_container_spec.rb +14 -14
  49. data/spec/integration/chef_data_bag_item_spec.rb +9 -9
  50. data/spec/integration/chef_group_spec.rb +219 -219
  51. data/spec/integration/chef_mirror_spec.rb +228 -228
  52. data/spec/integration/chef_node_spec.rb +511 -511
  53. data/spec/integration/chef_organization_spec.rb +126 -126
  54. data/spec/integration/chef_role_spec.rb +33 -33
  55. data/spec/integration/chef_user_spec.rb +37 -37
  56. data/spec/integration/private_key_spec.rb +154 -154
  57. data/spec/integration/recipe_dsl_spec.rb +10 -10
  58. data/spec/integration/rspec/converge_spec.rb +49 -49
  59. data/spec/support/key_support.rb +6 -6
  60. data/spec/support/spec_support.rb +3 -3
  61. data/spec/unit/get_private_key_spec.rb +19 -19
  62. data/spec/unit/recipe_run_wrapper_spec.rb +4 -4
  63. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b731f1a9d1df6902419eaccd5d0a2be19ae1378
4
- data.tar.gz: 6e7c7b386f1eecbb5cfab28fc44065649951530a
3
+ metadata.gz: e80fab8f974325b02588b59deeceb5ef09f09d93
4
+ data.tar.gz: c529cab52c9114b867220a79c57547047621c513
5
5
  SHA512:
6
- metadata.gz: e7be456dd28621ee6d112d5a5972d6c1d91ee3343cf63ae397da0a837a3f4371fd9427dec6a3f815c1f838be312b57b11192e26131122c0ea857623fafc27070
7
- data.tar.gz: e5f65e2a06214d1ee0e850d0271fc3d3e7efedae19f35217c63af1c7107f68a7336ac164857f60ef0e13e975d33c9a0321461fc1f01b636122cb535871e0a237
6
+ metadata.gz: 43c6db79856bea2d371c38c6937f3e53d4c1cafa1e053686dca513d943a8882ccaa56821d0db37d249c102e10680135fd658fe9a94cd46d3743e0fa7f2916df2
7
+ data.tar.gz: c63bb304439024c4ca4732c05fd12f602b72bbba3cebe0338e24ee18ca16612ac821a5e822c998b668edac62f3e022d0a5c67f0037ffd8056c4b2839db139f32
data/Gemfile CHANGED
@@ -1,21 +1,21 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
5
  group :changelog do
6
- gem 'github_changelog_generator'
6
+ gem "github_changelog_generator", git: "https://github.com/tduffield/github-changelog-generator", branch: "adjust-tag-section-mapping"
7
7
  end
8
8
 
9
9
  group :development do
10
- gem 'rake'
11
- gem 'rspec', '~> 3.0'
10
+ gem "chefstyle"
11
+ gem "rake"
12
+ gem "rspec", "~> 3.0"
12
13
  end
13
14
 
14
-
15
15
  # Allow Travis to run tests with different dependency versions
16
- if ENV['GEMFILE_MOD']
17
- puts ENV['GEMFILE_MOD']
18
- instance_eval(ENV['GEMFILE_MOD'])
16
+ if ENV["GEMFILE_MOD"]
17
+ puts ENV["GEMFILE_MOD"]
18
+ instance_eval(ENV["GEMFILE_MOD"])
19
19
  else
20
20
  group :development do
21
21
  gem "chef", git: "https://github.com/chef/chef" # until a version allowing chef-zero 5 is released
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- require 'bundler'
2
- require 'rubygems'
3
- require 'rubygems/package_task'
4
- require 'rdoc/task'
5
- require 'rspec/core/rake_task'
1
+ require "bundler"
2
+ require "rubygems"
3
+ require "rubygems/package_task"
4
+ require "rdoc/task"
5
+ require "rspec/core/rake_task"
6
6
 
7
7
  Bundler::GemHelper.install_tasks
8
8
 
@@ -10,27 +10,39 @@ task :default => :spec
10
10
 
11
11
  desc "Run specs"
12
12
  RSpec::Core::RakeTask.new(:spec) do |spec|
13
- spec.pattern = 'spec/**/*_spec.rb'
13
+ spec.pattern = "spec/**/*_spec.rb"
14
14
  end
15
15
 
16
16
  gem_spec = eval(File.read("cheffish.gemspec"))
17
17
 
18
18
  RDoc::Task.new do |rdoc|
19
- rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.rdoc_dir = "rdoc"
20
20
  rdoc.title = "cheffish #{gem_spec.version}"
21
- rdoc.rdoc_files.include('README*')
22
- rdoc.rdoc_files.include('lib/**/*.rb')
21
+ rdoc.rdoc_files.include("README*")
22
+ rdoc.rdoc_files.include("lib/**/*.rb")
23
23
  end
24
24
 
25
25
  begin
26
- require 'github_changelog_generator/task'
26
+ require "github_changelog_generator/task"
27
27
 
28
28
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
29
29
  require "cheffish/version"
30
30
  config.future_release = Cheffish::VERSION
31
- config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
32
- config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
31
+ config.enhancement_labels = "enhancement,Enhancement,Improvement,New Feature,Feature".split(",")
32
+ config.bug_labels = "bug,Bug,Upstream Bug".split(",")
33
33
  config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",")
34
+ config.max_issues = 0
35
+ config.add_issues_wo_labels = false
34
36
  end
35
37
  rescue LoadError
36
38
  end
39
+
40
+ begin
41
+ require "chefstyle"
42
+ require "rubocop/rake_task"
43
+ RuboCop::RakeTask.new(:style) do |task|
44
+ task.options += ["--display-cop-names", "--no-color"]
45
+ end
46
+ rescue LoadError
47
+ puts "chefstyle/rubocop is not available."
48
+ end
data/cheffish.gemspec CHANGED
@@ -1,26 +1,26 @@
1
- $:.unshift(File.dirname(__FILE__) + '/lib')
2
- require 'cheffish/version'
1
+ $:.unshift(File.dirname(__FILE__) + "/lib")
2
+ require "cheffish/version"
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = 'cheffish'
5
+ s.name = "cheffish"
6
6
  s.version = Cheffish::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
- s.extra_rdoc_files = [ 'README.md', 'LICENSE' ]
9
- s.summary = 'A library to manipulate Chef in Chef.'
8
+ s.extra_rdoc_files = [ "README.md", "LICENSE" ]
9
+ s.summary = "A library to manipulate Chef in Chef."
10
10
  s.description = s.summary
11
- s.author = 'John Keiser'
12
- s.email = 'jkeiser@chef.io'
13
- s.homepage = 'http://github.com/chef/cheffish'
11
+ s.author = "John Keiser"
12
+ s.email = "jkeiser@chef.io"
13
+ s.homepage = "http://github.com/chef/cheffish"
14
14
 
15
- s.required_ruby_version = '>= 2.2.2'
15
+ s.required_ruby_version = ">= 2.2.2"
16
16
 
17
- s.add_dependency 'chef-zero', '~> 5.0'
18
- s.add_dependency 'net-ssh'
17
+ s.add_dependency "chef-zero", "~> 5.0"
18
+ s.add_dependency "net-ssh"
19
19
 
20
20
  s.bindir = "bin"
21
- s.executables = %w( )
21
+ s.executables = %w{ }
22
22
 
23
- s.require_path = 'lib'
24
- s.files = %w(Gemfile Rakefile LICENSE README.md) + Dir.glob("*.gemspec") +
25
- Dir.glob("{distro,lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
23
+ s.require_path = "lib"
24
+ s.files = %w{Gemfile Rakefile LICENSE README.md} + Dir.glob("*.gemspec") +
25
+ Dir.glob("{distro,lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
26
26
  end
@@ -1,8 +1,8 @@
1
- require 'cheffish'
2
- require 'cheffish/base_resource'
3
- require 'chef/chef_fs/data_handler/acl_data_handler'
4
- require 'chef/chef_fs/parallelizer'
5
- require 'uri'
1
+ require "cheffish"
2
+ require "cheffish/base_resource"
3
+ require "chef/chef_fs/data_handler/acl_data_handler"
4
+ require "chef/chef_fs/parallelizer"
5
+ require "uri"
6
6
 
7
7
  class Chef
8
8
  class Resource
@@ -65,7 +65,7 @@ class Chef
65
65
 
66
66
  # Find all matching paths so we can update them (resolve * and **)
67
67
  paths = match_paths(new_resource.path)
68
- if paths.size == 0 && !new_resource.path.split('/').any? { |p| p == '*' }
68
+ if paths.size == 0 && !new_resource.path.split("/").any? { |p| p == "*" }
69
69
  raise "Path #{new_resource.path} cannot have an ACL set on it!"
70
70
  end
71
71
 
@@ -95,7 +95,7 @@ class Chef
95
95
 
96
96
  if differences.size > 0
97
97
  # Verify we aren't trying to destroy grant permissions
98
- if permission == 'grant' && desired_json['actors'] == [] && desired_json['groups'] == []
98
+ if permission == "grant" && desired_json["actors"] == [] && desired_json["groups"] == []
99
99
  # NOTE: if superusers exist, this should turn into a warning.
100
100
  raise "chef_acl attempted to remove all actors from GRANT! I'm sorry Dave, I can't let you remove access to an object with no hope of recovery."
101
101
  end
@@ -106,9 +106,9 @@ class Chef
106
106
 
107
107
  if modify.size > 0
108
108
  changed = true
109
- description = [ "update acl #{path} at #{rest_url(path)}" ] + modify.map do |diffs, permissions|
109
+ description = [ "update acl #{path} at #{rest_url(path)}" ] + modify.flat_map do |diffs, permissions|
110
110
  diffs.map { |diff| " #{permissions.keys.join(', ')}:#{diff}" }
111
- end.flatten(1)
111
+ end
112
112
  converge_by description do
113
113
  modify.values.each do |permissions|
114
114
  permissions.each do |permission, desired_json|
@@ -124,14 +124,14 @@ class Chef
124
124
  # If recurse is on_change, then we will recurse if there is no ACL, or if
125
125
  # the ACL has changed.
126
126
  if new_resource.recursive == true || (new_resource.recursive == :on_change && (!acl || changed))
127
- children, error = list(path, '*')
127
+ children, error = list(path, "*")
128
128
  Chef::ChefFS::Parallelizer.parallel_do(children) do |child|
129
- next if child.split('/')[-1] == 'containers'
129
+ next if child.split("/")[-1] == "containers"
130
130
  create_acl(child)
131
131
  end
132
132
  # containers mess up our descent, so we do them last
133
133
  Chef::ChefFS::Parallelizer.parallel_do(children) do |child|
134
- next if child.split('/')[-1] != 'containers'
134
+ next if child.split("/")[-1] != "containers"
135
135
  create_acl(child)
136
136
  end
137
137
 
@@ -145,7 +145,7 @@ class Chef
145
145
  @current_acls[acl_path] = begin
146
146
  rest.get(rest_url(acl_path))
147
147
  rescue Net::HTTPServerException => e
148
- unless e.response.code == '404' && new_resource.path.split('/').any? { |p| p == '*' }
148
+ unless e.response.code == "404" && new_resource.path.split("/").any? { |p| p == "*" }
149
149
  raise
150
150
  end
151
151
  end
@@ -212,16 +212,16 @@ class Chef
212
212
  # => 'foo' instead, idempotence will not notice that anything needs
213
213
  # to be updated and nothing will happen.
214
214
  if rights[:users]
215
- ace['actors'] ||= []
216
- ace['actors'] |= Array(rights[:users])
215
+ ace["actors"] ||= []
216
+ ace["actors"] |= Array(rights[:users])
217
217
  end
218
218
  if rights[:clients]
219
- ace['actors'] ||= []
220
- ace['actors'] |= Array(rights[:clients])
219
+ ace["actors"] ||= []
220
+ ace["actors"] |= Array(rights[:clients])
221
221
  end
222
222
  if rights[:groups]
223
- ace['groups'] ||= []
224
- ace['groups'] |= Array(rights[:groups])
223
+ ace["groups"] ||= []
224
+ ace["groups"] |= Array(rights[:groups])
225
225
  end
226
226
  end
227
227
  end
@@ -235,16 +235,16 @@ class Chef
235
235
  if permission == :all
236
236
  json.each_key do |key|
237
237
  ace = json[key] = json[key.dup]
238
- ace['actors'] = ace['actors'] - Array(rights[:users]) if rights[:users] && ace['actors']
239
- ace['actors'] = ace['actors'] - Array(rights[:clients]) if rights[:clients] && ace['actors']
240
- ace['groups'] = ace['groups'] - Array(rights[:groups]) if rights[:groups] && ace['groups']
238
+ ace["actors"] = ace["actors"] - Array(rights[:users]) if rights[:users] && ace["actors"]
239
+ ace["actors"] = ace["actors"] - Array(rights[:clients]) if rights[:clients] && ace["actors"]
240
+ ace["groups"] = ace["groups"] - Array(rights[:groups]) if rights[:groups] && ace["groups"]
241
241
  end
242
242
  else
243
243
  ace = json[permission.to_s] = json[permission.to_s].dup
244
244
  if ace
245
- ace['actors'] = ace['actors'] - Array(rights[:users]) if rights[:users] && ace['actors']
246
- ace['actors'] = ace['actors'] - Array(rights[:clients]) if rights[:clients] && ace['actors']
247
- ace['groups'] = ace['groups'] - Array(rights[:groups]) if rights[:groups] && ace['groups']
245
+ ace["actors"] = ace["actors"] - Array(rights[:users]) if rights[:users] && ace["actors"]
246
+ ace["actors"] = ace["actors"] - Array(rights[:clients]) if rights[:clients] && ace["actors"]
247
+ ace["groups"] = ace["groups"] - Array(rights[:groups]) if rights[:groups] && ace["groups"]
248
248
  end
249
249
  end
250
250
  end
@@ -270,17 +270,17 @@ class Chef
270
270
  def match_paths(path)
271
271
  # Turn multiple slashes into one
272
272
  # nodes//x -> nodes/x
273
- path = path.gsub(/[\/]+/, '/')
273
+ path = path.gsub(/[\/]+/, "/")
274
274
  # If it's absolute, start the matching with /. If it's relative, start with '' (relative root).
275
- if path[0] == '/'
276
- matches = [ '/' ]
275
+ if path[0] == "/"
276
+ matches = [ "/" ]
277
277
  else
278
- matches = [ '' ]
278
+ matches = [ "" ]
279
279
  end
280
280
 
281
281
  # Split the path, and get rid of the empty path at the beginning and end
282
282
  # (/a/b/c/ -> [ 'a', 'b', 'c' ])
283
- parts = path.split('/').select { |x| x != '' }.to_a
283
+ parts = path.split("/").select { |x| x != "" }.to_a
284
284
 
285
285
  # Descend until we find the matches:
286
286
  # path = 'a/b/c'
@@ -302,7 +302,7 @@ class Chef
302
302
  matches = Chef::ChefFS::Parallelizer.parallelize(matches) do |path|
303
303
  found, error = list(path, part)
304
304
  if error
305
- if parts[0..index-1].all? { |p| p != '*' }
305
+ if parts[0..index - 1].all? { |p| p != "*" }
306
306
  raise error
307
307
  end
308
308
  []
@@ -326,56 +326,56 @@ class Chef
326
326
  # /organizations/foo/nodes/x -> /organizations/foo/nodes/x/_acl
327
327
  #
328
328
  def acl_path(path)
329
- parts = path.split('/').select { |x| x != '' }.to_a
330
- prefix = (path[0] == '/') ? '/' : ''
329
+ parts = path.split("/").select { |x| x != "" }.to_a
330
+ prefix = (path[0] == "/") ? "/" : ""
331
331
 
332
332
  case parts.size
333
333
  when 0
334
334
  # /, empty (relative root)
335
335
  # The root of the server has no publicly visible ACLs. Only nodes/*, etc.
336
- if prefix == ''
337
- ::File.join('organizations', '_acl')
336
+ if prefix == ""
337
+ ::File.join("organizations", "_acl")
338
338
  end
339
339
 
340
340
  when 1
341
341
  # nodes, roles, etc.
342
342
  # The top level organizations and users containers have no publicly
343
343
  # visible ACLs. Only nodes/*, etc.
344
- if prefix == ''
345
- ::File.join('containers', path, '_acl')
344
+ if prefix == ""
345
+ ::File.join("containers", path, "_acl")
346
346
  end
347
347
 
348
348
  when 2
349
349
  # /organizations/NAME, /users/NAME, nodes/NAME, roles/NAME, etc.
350
- if prefix == '/' && parts[0] == 'organizations'
351
- ::File.join(path, 'organizations', '_acl')
350
+ if prefix == "/" && parts[0] == "organizations"
351
+ ::File.join(path, "organizations", "_acl")
352
352
  else
353
- ::File.join(path, '_acl')
353
+ ::File.join(path, "_acl")
354
354
  end
355
355
 
356
356
  when 3
357
357
  # /organizations/NAME/nodes, cookbooks/NAME/VERSION, etc.
358
- if prefix == '/'
359
- ::File.join('/', parts[0], parts[1], 'containers', parts[2], '_acl')
358
+ if prefix == "/"
359
+ ::File.join("/", parts[0], parts[1], "containers", parts[2], "_acl")
360
360
  else
361
- ::File.join(parts[0], parts[1], '_acl')
361
+ ::File.join(parts[0], parts[1], "_acl")
362
362
  end
363
363
 
364
364
  when 4
365
365
  # /organizations/NAME/nodes/NAME, cookbooks/NAME/VERSION/BLAH
366
366
  # /organizations/NAME/nodes/NAME, cookbooks/NAME/VERSION, etc.
367
- if prefix == '/'
368
- ::File.join(path, '_acl')
367
+ if prefix == "/"
368
+ ::File.join(path, "_acl")
369
369
  else
370
- ::File.join(parts[0], parts[1], '_acl')
370
+ ::File.join(parts[0], parts[1], "_acl")
371
371
  end
372
372
 
373
373
  else
374
374
  # /organizations/NAME/cookbooks/NAME/VERSION/..., cookbooks/NAME/VERSION/A/B/...
375
- if prefix == '/'
376
- ::File.join('/', parts[0], parts[1], parts[2], parts[3], '_acl')
375
+ if prefix == "/"
376
+ ::File.join("/", parts[0], parts[1], parts[2], parts[3], "_acl")
377
377
  else
378
- ::File.join(parts[0], parts[1], '_acl')
378
+ ::File.join(parts[0], parts[1], "_acl")
379
379
  end
380
380
  end
381
381
  end
@@ -398,9 +398,9 @@ class Chef
398
398
  #
399
399
  def list(path, child)
400
400
  # TODO make ChefFS understand top level organizations and stop doing this altogether.
401
- parts = path.split('/').select { |x| x != '' }.to_a
402
- absolute = (path[0] == '/')
403
- if absolute && parts[0] == 'organizations'
401
+ parts = path.split("/").select { |x| x != "" }.to_a
402
+ absolute = (path[0] == "/")
403
+ if absolute && parts[0] == "organizations"
404
404
  return [ [], "ACLs cannot be set on children of #{path}" ] if parts.size > 3
405
405
  else
406
406
  return [ [], "ACLs cannot be set on children of #{path}" ] if parts.size > 1
@@ -408,7 +408,7 @@ class Chef
408
408
 
409
409
  error = nil
410
410
 
411
- if child == '*'
411
+ if child == "*"
412
412
  case parts.size
413
413
  when 0
414
414
  # /*, *
@@ -427,7 +427,7 @@ class Chef
427
427
 
428
428
  when 2
429
429
  # /organizations/NAME/*
430
- results, error = rest_list(::File.join(path, 'containers'))
430
+ results, error = rest_list(::File.join(path, "containers"))
431
431
  if !error
432
432
  results = results.map { |result| ::File.join(path, result) }
433
433
  end
@@ -441,14 +441,14 @@ class Chef
441
441
  end
442
442
 
443
443
  else
444
- if child == 'data_bags' &&
445
- (parts.size == 0 || (parts.size == 2 && parts[0] == 'organizations'))
446
- child = 'data'
444
+ if child == "data_bags" &&
445
+ (parts.size == 0 || (parts.size == 2 && parts[0] == "organizations"))
446
+ child = "data"
447
447
  end
448
448
 
449
449
  if absolute
450
450
  # /<child>, /users/<child>, /organizations/<child>, /organizations/foo/<child>, /organizations/foo/nodes/<child> ...
451
- results = [ ::File.join('/', parts[0..2], child) ]
451
+ results = [ ::File.join("/", parts[0..2], child) ]
452
452
  elsif parts.size == 0
453
453
  # <child> (nodes, roles, etc.)
454
454
  results = [ child ]
@@ -462,7 +462,7 @@ class Chef
462
462
  end
463
463
 
464
464
  def rest_url(path)
465
- path[0] == '/' ? URI.join(rest.url, path) : path
465
+ path[0] == "/" ? URI.join(rest.url, path) : path
466
466
  end
467
467
 
468
468
  def rest_list(path)
@@ -470,12 +470,12 @@ class Chef
470
470
  # All our rest lists are hashes where the keys are the names
471
471
  [ rest.get(rest_url(path)).keys, nil ]
472
472
  rescue Net::HTTPServerException => e
473
- if e.response.code == '405' || e.response.code == '404'
474
- parts = path.split('/').select { |p| p != '' }.to_a
473
+ if e.response.code == "405" || e.response.code == "404"
474
+ parts = path.split("/").select { |p| p != "" }.to_a
475
475
 
476
476
  # We KNOW we expect these to exist. Other containers may or may not.
477
- unless (parts.size == 1 || (parts.size == 3 && parts[0] == 'organizations')) &&
478
- %w(clients containers cookbooks data environments groups nodes roles).include?(parts[-1])
477
+ unless (parts.size == 1 || (parts.size == 3 && parts[0] == "organizations")) &&
478
+ %w{clients containers cookbooks data environments groups nodes roles}.include?(parts[-1])
479
479
  return [ [], "Cannot get list of #{path}: HTTP response code #{e.response.code}" ]
480
480
  end
481
481
  end
@@ -1,5 +1,5 @@
1
- require 'cheffish'
2
- require 'cheffish/chef_actor_base'
1
+ require "cheffish"
2
+ require "cheffish/chef_actor_base"
3
3
 
4
4
  class Chef
5
5
  class Resource
@@ -7,7 +7,7 @@ class Chef
7
7
  resource_name :chef_client
8
8
 
9
9
  # Client attributes
10
- property :name, Cheffish::NAME_REGEX, name_property: true
10
+ property :chef_client_name, Cheffish::NAME_REGEX, name_property: true
11
11
  property :admin, Boolean
12
12
  property :validator, Boolean
13
13
 
@@ -40,11 +40,11 @@ class Chef
40
40
 
41
41
  action_class.class_eval do
42
42
  def actor_type
43
- 'client'
43
+ "client"
44
44
  end
45
45
 
46
46
  def actor_path
47
- 'clients'
47
+ "clients"
48
48
  end
49
49
 
50
50
  #
@@ -61,10 +61,10 @@ class Chef
61
61
 
62
62
  def keys
63
63
  {
64
- 'name' => :name,
65
- 'admin' => :admin,
66
- 'validator' => :validator,
67
- 'public_key' => :source_key
64
+ "name" => :chef_client_name,
65
+ "admin" => :admin,
66
+ "validator" => :validator,
67
+ "public_key" => :source_key,
68
68
  }
69
69
  end
70
70
  end