summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-01-14 14:08:03 +0000
committerThom May <thom@chef.io>2016-01-14 14:08:03 +0000
commit51cfbdc4d16739caac4d946fadbe678444aafe34 (patch)
tree56dfd8f1cd9fd933de27268b32402e955a43ac2b /lib/chef/chef_fs
parent05064423057d4cf46f4713b81b08829cf6d20af6 (diff)
downloadchef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
Diffstat (limited to 'lib/chef/chef_fs')
-rw-r--r--lib/chef/chef_fs/chef_fs_data_store.rb158
-rw-r--r--lib/chef/chef_fs/command_line.rb12
-rw-r--r--lib/chef/chef_fs/config.rb26
-rw-r--r--lib/chef/chef_fs/data_handler/acl_data_handler.rb18
-rw-r--r--lib/chef/chef_fs/data_handler/client_data_handler.rb24
-rw-r--r--lib/chef/chef_fs/data_handler/container_data_handler.rb10
-rw-r--r--lib/chef/chef_fs/data_handler/cookbook_data_handler.rb26
-rw-r--r--lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb18
-rw-r--r--lib/chef/chef_fs/data_handler/data_handler_base.rb6
-rw-r--r--lib/chef/chef_fs/data_handler/environment_data_handler.rb24
-rw-r--r--lib/chef/chef_fs/data_handler/group_data_handler.rb36
-rw-r--r--lib/chef/chef_fs/data_handler/node_data_handler.rb26
-rw-r--r--lib/chef/chef_fs/data_handler/organization_data_handler.rb16
-rw-r--r--lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb4
-rw-r--r--lib/chef/chef_fs/data_handler/organization_members_data_handler.rb4
-rw-r--r--lib/chef/chef_fs/data_handler/policy_data_handler.rb16
-rw-r--r--lib/chef/chef_fs/data_handler/policy_group_data_handler.rb2
-rw-r--r--lib/chef/chef_fs/data_handler/role_data_handler.rb28
-rw-r--r--lib/chef/chef_fs/data_handler/user_data_handler.rb22
-rw-r--r--lib/chef/chef_fs/file_pattern.rb28
-rw-r--r--lib/chef/chef_fs/file_system.rb10
-rw-r--r--lib/chef/chef_fs/file_system/already_exists_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/base_fs_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/base_fs_object.rb12
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acl_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acl_entry.rb8
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acls_dir.rb16
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb54
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb18
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb14
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb8
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/environments_dir.rb10
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb8
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/org_entry.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb14
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb10
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policies_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb10
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb8
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb14
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/cookbook_frozen_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/memory/memory_dir.rb10
-rw-r--r--lib/chef/chef_fs/file_system/memory/memory_file.rb2
-rw-r--r--lib/chef/chef_fs/file_system/memory/memory_root.rb4
-rw-r--r--lib/chef/chef_fs/file_system/multiplexed_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/must_delete_recursively_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/nonexistent_fs_object.rb4
-rw-r--r--lib/chef/chef_fs/file_system/not_found_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/operation_failed_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/operation_not_allowed_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb8
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb14
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb10
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb10
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb8
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb58
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/repository/file_system_entry.rb16
-rw-r--r--lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb2
-rw-r--r--lib/chef/chef_fs/knife.rb26
-rw-r--r--lib/chef/chef_fs/parallelizer.rb4
-rw-r--r--lib/chef/chef_fs/parallelizer/parallel_enumerable.rb2
-rw-r--r--lib/chef/chef_fs/path_utils.rb12
74 files changed, 496 insertions, 496 deletions
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb
index 07cb3d2cd5..99a668d50d 100644
--- a/lib/chef/chef_fs/chef_fs_data_store.rb
+++ b/lib/chef/chef_fs/chef_fs_data_store.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/cookbook_manifest'
-require 'chef_zero/data_store/memory_store'
-require 'chef_zero/data_store/data_already_exists_error'
-require 'chef_zero/data_store/data_not_found_error'
-require 'chef/chef_fs/file_pattern'
-require 'chef/chef_fs/file_system'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/memory/memory_root'
-require 'fileutils'
+require "chef/cookbook_manifest"
+require "chef_zero/data_store/memory_store"
+require "chef_zero/data_store/data_already_exists_error"
+require "chef_zero/data_store/data_not_found_error"
+require "chef/chef_fs/file_pattern"
+require "chef/chef_fs/file_system"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/memory/memory_root"
+require "fileutils"
class Chef
module ChefFS
@@ -185,15 +185,15 @@ class Chef
if use_memory_store?(path)
@memory_store.create(path, name, data, *options)
- elsif path[0] == 'cookbooks' && path.length == 2
+ elsif path[0] == "cookbooks" && path.length == 2
# Do nothing. The entry gets created when the cookbook is created.
# create [/organizations/ORG]/users/NAME (with content '{}')
# Manipulate the `members.json` file that contains a list of all users
- elsif is_org? && path == [ 'users' ]
- update_json('members.json', []) do |members|
+ elsif is_org? && path == [ "users" ]
+ update_json("members.json", []) do |members|
# Format of each entry: { "user": { "username": "jkeiser" } }
- if members.any? { |member| member['user']['username'] == name }
+ if members.any? { |member| member["user"]["username"] == name }
raise ChefZero::DataStore::DataAlreadyExistsError.new(path, entry)
end
@@ -203,10 +203,10 @@ class Chef
# create [/organizations/ORG]/association_requests/NAME (with content '{}')
# Manipulate the `invitations.json` file that contains a list of all users
- elsif is_org? && path == [ 'association_requests' ]
- update_json('invitations.json', []) do |invitations|
+ elsif is_org? && path == [ "association_requests" ]
+ update_json("invitations.json", []) do |invitations|
# Format of each entry: { "id" => "jkeiser-chef", 'username' => 'jkeiser' }
- if invitations.any? { |member| member['username'] == name }
+ if invitations.any? { |member| member["username"] == name }
raise ChefZero::DataStore::DataAlreadyExistsError.new(path)
end
@@ -233,8 +233,8 @@ class Chef
if use_memory_store?(path)
@memory_store.get(path)
- elsif path[0] == 'file_store' && path[1] == 'repo'
- entry = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path[2..-1].join('/'))
+ elsif path[0] == "file_store" && path[1] == "repo"
+ entry = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path[2..-1].join("/"))
begin
entry.read
rescue Chef::ChefFS::FileSystem::NotFoundError => e
@@ -242,10 +242,10 @@ class Chef
end
# /policy_groups/NAME/policies/POLICYNAME: return the revision of the given policy
- elsif path[0] == 'policy_groups' && path[2] == 'policies' && path.length == 4
+ elsif path[0] == "policy_groups" && path[2] == "policies" && path.length == 4
with_entry(path[0..1]) do |entry|
policy_group = Chef::JSONCompat.parse(entry)
- if !policy_group['policies'] || !policy_group['policies'][path[3]] || !policy_group['policies'][path[3]]
+ if !policy_group["policies"] || !policy_group["policies"][path[3]] || !policy_group["policies"][path[3]]
raise ChefZero::DataStore::DataNotFoundError.new(path, entry)
end
# The policy group looks like:
@@ -254,30 +254,30 @@ class Chef
# "x": { "revision_id": "10" }
# }
# }
- Chef::JSONCompat.to_json_pretty(policy_group['policies'][path[3]]["revision_id"])
+ Chef::JSONCompat.to_json_pretty(policy_group["policies"][path[3]]["revision_id"])
end
# GET [/organizations/ORG]/users/NAME -> /users/NAME
# Manipulates members.json
- elsif is_org? && path[0] == 'users' && path.length == 2
- if get_json('members.json', []).any? { |member| member['user']['username'] == path[1] }
- '{}'
+ elsif is_org? && path[0] == "users" && path.length == 2
+ if get_json("members.json", []).any? { |member| member["user"]["username"] == path[1] }
+ "{}"
else
raise ChefZero::DataStore::DataNotFoundError.new(path)
end
# GET [/organizations/ORG]/association_requests/NAME -> /users/NAME
# Manipulates invites.json
- elsif is_org? && path[0] == 'association_requests' && path.length == 2
- if get_json('invites.json', []).any? { |member| member['user']['username'] == path[1] }
- '{}'
+ elsif is_org? && path[0] == "association_requests" && path.length == 2
+ if get_json("invites.json", []).any? { |member| member["user"]["username"] == path[1] }
+ "{}"
else
raise ChefZero::DataStore::DataNotFoundError.new(path)
end
else
with_entry(path) do |entry|
- if path[0] == 'cookbooks' && path.length == 3
+ if path[0] == "cookbooks" && path.length == 3
# get /cookbooks/NAME/version
result = nil
begin
@@ -289,15 +289,15 @@ class Chef
result.each_pair do |key, value|
if value.is_a?(Array)
value.each do |file|
- if file.is_a?(Hash) && file.has_key?('checksum')
- relative = ['file_store', 'repo', 'cookbooks']
+ if file.is_a?(Hash) && file.has_key?("checksum")
+ relative = ["file_store", "repo", "cookbooks"]
if chef_fs.versioned_cookbooks
relative << "#{path[1]}-#{path[2]}"
else
relative << path[1]
end
- relative = relative + file[:path].split('/')
- file['url'] = ChefZero::RestBase::build_uri(request.base_uri, relative)
+ relative = relative + file[:path].split("/")
+ file["url"] = ChefZero::RestBase::build_uri(request.base_uri, relative)
end
end
end
@@ -324,7 +324,7 @@ class Chef
end
# Write out the files!
- if path[0] == 'cookbooks' && path.length == 3
+ if path[0] == "cookbooks" && path.length == 3
write_cookbook(path, data, *options)
else
with_dir(path[0..-2]) do |parent|
@@ -345,9 +345,9 @@ class Chef
# DELETE [/organizations/ORG]/users/NAME
# Manipulates members.json
- elsif is_org? && path[0] == 'users' && path.length == 2
- update_json('members.json', []) do |members|
- result = members.reject { |member| member['user']['username'] == path[1] }
+ elsif is_org? && path[0] == "users" && path.length == 2
+ update_json("members.json", []) do |members|
+ result = members.reject { |member| member["user"]["username"] == path[1] }
if result.size == members.size
raise ChefZero::DataStore::DataNotFoundError.new(path)
end
@@ -356,9 +356,9 @@ class Chef
# DELETE [/organizations/ORG]/users/NAME
# Manipulates members.json
- elsif is_org? && path[0] == 'association_requests' && path.length == 2
- update_json('invitations.json', []) do |invitations|
- result = invitations.reject { |invitation| invitation['username'] == path[1] }
+ elsif is_org? && path[0] == "association_requests" && path.length == 2
+ update_json("invitations.json", []) do |invitations|
+ result = invitations.reject { |invitation| invitation["username"] == path[1] }
if result.size == invitations.size
raise ChefZero::DataStore::DataNotFoundError.new(path)
end
@@ -368,7 +368,7 @@ class Chef
else
with_entry(path) do |entry|
begin
- if path[0] == 'cookbooks' && path.length >= 3
+ if path[0] == "cookbooks" && path.length >= 3
entry.delete(true)
else
entry.delete(false)
@@ -398,18 +398,18 @@ class Chef
if use_memory_store?(path)
@memory_store.list(path)
- elsif path[0] == 'policy_groups' && path.length == 2
+ elsif path[0] == "policy_groups" && path.length == 2
with_entry(path) do |entry|
- [ 'policies' ]
+ [ "policies" ]
end
- elsif path[0] == 'policy_groups' && path[2] == 'policies' && path.length == 3
- with_entry([ 'policy_groups', path[1] ]) do |entry|
+ elsif path[0] == "policy_groups" && path[2] == "policies" && path.length == 3
+ with_entry([ "policy_groups", path[1] ]) do |entry|
policy_group = Chef::JSONCompat.parse(entry.read)
- (policy_group['policies'] || {}).keys
+ (policy_group["policies"] || {}).keys
end
- elsif path[0] == 'cookbooks' && path.length == 1
+ elsif path[0] == "cookbooks" && path.length == 1
with_entry(path) do |entry|
begin
if chef_fs.versioned_cookbooks
@@ -424,9 +424,9 @@ class Chef
end
end
- elsif path[0] == 'cookbooks' && path.length == 2
+ elsif path[0] == "cookbooks" && path.length == 2
if chef_fs.versioned_cookbooks
- result = with_entry([ 'cookbooks' ]) do |entry|
+ result = with_entry([ "cookbooks" ]) do |entry|
# list /cookbooks/name = filter /cookbooks/name-version down to name
entry.children.map { |child| split_name_version(child.name) }.
select { |name, version| name == path[1] }.
@@ -476,13 +476,13 @@ class Chef
def exists_dir?(path)
if use_memory_store?(path)
@memory_store.exists_dir?(path)
- elsif path[0] == 'cookbooks' && path.length == 2
+ elsif path[0] == "cookbooks" && path.length == 2
list([ path[0] ]).include?(path[1])
# /policy_groups/NAME/policies
- elsif path[0] == 'policy_groups' && path[2] == 'policies' && path.length == 3
+ elsif path[0] == "policy_groups" && path[2] == "policies" && path.length == 3
exists_dir?(path[0..1])
# /policy_groups/NAME/policies/POLICYNAME
- elsif path[0] == 'policy_groups' && path[2] == 'policies' && path.length == 4
+ elsif path[0] == "policy_groups" && path[2] == "policies" && path.length == 4
exists_dir?(path[0..1]) && list(path[0..2]).include?(path[3])
else
Chef::ChefFS::FileSystem.resolve_path(chef_fs, to_chef_fs_path(path)).exists?
@@ -492,34 +492,34 @@ class Chef
private
def use_memory_store?(path)
- return path[0] == 'sandboxes' || path[0] == 'file_store' && path[1] == 'checksums' || path == [ 'environments', '_default' ]
+ return path[0] == "sandboxes" || path[0] == "file_store" && path[1] == "checksums" || path == [ "environments", "_default" ]
end
def write_cookbook(path, data, *options)
if chef_fs.versioned_cookbooks
- cookbook_path = File.join('cookbooks', "#{path[1]}-#{path[2]}")
+ cookbook_path = File.join("cookbooks", "#{path[1]}-#{path[2]}")
else
- cookbook_path = File.join('cookbooks', path[1])
+ cookbook_path = File.join("cookbooks", path[1])
end
# Create a little Chef::ChefFS memory filesystem with the data
- cookbook_fs = Chef::ChefFS::FileSystem::Memory::MemoryRoot.new('uploading')
+ cookbook_fs = Chef::ChefFS::FileSystem::Memory::MemoryRoot.new("uploading")
cookbook = Chef::JSONCompat.parse(data)
cookbook.each_pair do |key, value|
if value.is_a?(Array)
value.each do |file|
- if file.is_a?(Hash) && file.has_key?('checksum')
- file_data = @memory_store.get(['file_store', 'checksums', file['checksum']])
- cookbook_fs.add_file(File.join(cookbook_path, file['path']), file_data)
+ if file.is_a?(Hash) && file.has_key?("checksum")
+ file_data = @memory_store.get(["file_store", "checksums", file["checksum"]])
+ cookbook_fs.add_file(File.join(cookbook_path, file["path"]), file_data)
end
end
end
end
# Create the .uploaded-cookbook-version.json
- cookbooks = chef_fs.child('cookbooks')
+ cookbooks = chef_fs.child("cookbooks")
if !cookbooks.exists?
- cookbooks = chef_fs.create_child('cookbooks')
+ cookbooks = chef_fs.create_child("cookbooks")
end
# We are calling a cookbooks-specific API, so get multiplexed_dirs out of the way if it is there
if cookbooks.respond_to?(:multiplexed_dirs)
@@ -529,14 +529,14 @@ class Chef
end
def split_name_version(entry_name)
- name_version = entry_name.split('-')
- name = name_version[0..-2].join('-')
+ name_version = entry_name.split("-")
+ name = name_version[0..-2].join("-")
version = name_version[-1]
[name,version]
end
def to_chef_fs_path(path)
- _to_chef_fs_path(path).join('/')
+ _to_chef_fs_path(path).join("/")
end
def chef_fs_filename(path)
@@ -544,18 +544,18 @@ class Chef
end
def _to_chef_fs_path(path)
- if path[0] == 'data'
+ if path[0] == "data"
path = path.dup
- path[0] = 'data_bags'
+ path[0] = "data_bags"
if path.length >= 3
path[2] = "#{path[2]}.json"
end
- elsif path[0] == 'policies'
+ elsif path[0] == "policies"
path = path.dup
if path.length >= 3
path[2] = "#{path[2]}.json"
end
- elsif path[0] == 'cookbooks'
+ elsif path[0] == "cookbooks"
if path.length == 2
raise ChefZero::DataStore::DataNotFoundError.new(path)
elsif chef_fs.versioned_cookbooks
@@ -575,10 +575,10 @@ class Chef
end
end
- elsif path[0] == 'acls'
+ elsif path[0] == "acls"
# /acls/containers|nodes|.../x.json
# /acls/organization.json
- if path.length == 3 || path == [ 'acls', 'organization' ]
+ if path.length == 3 || path == [ "acls", "organization" ]
path = path.dup
path[-1] = "#{path[-1]}.json"
end
@@ -595,15 +595,15 @@ class Chef
end
def to_zero_path(entry)
- path = entry.path.split('/')[1..-1]
- if path[0] == 'data_bags'
+ path = entry.path.split("/")[1..-1]
+ if path[0] == "data_bags"
path = path.dup
- path[0] = 'data'
+ path[0] = "data"
if path.length >= 3
path[2] = path[2][0..-6]
end
- elsif path[0] == 'cookbooks'
+ elsif path[0] == "cookbooks"
if chef_fs.versioned_cookbooks
# cookbooks/name-version/... -> cookbooks/name/version/...
if path.length >= 2
@@ -618,7 +618,7 @@ class Chef
end
end
- elsif path.length == 2 && path[0] != 'cookbooks'
+ elsif path.length == 2 && path[0] != "cookbooks"
path = path.dup
path[1] = path[1][0..-6]
end
@@ -643,7 +643,7 @@ class Chef
def with_dir(path)
# Do not automatically create data bags
- create = !(path[0] == 'data' && path.size >= 2)
+ create = !(path[0] == "data" && path.size >= 2)
begin
yield get_dir(_to_chef_fs_path(path), create)
@@ -655,7 +655,7 @@ class Chef
end
def get_dir(path, create=false)
- result = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path.join('/'))
+ result = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path.join("/"))
if result.exists?
result
elsif create
@@ -666,9 +666,9 @@ class Chef
end
def get_single_cookbook_version(path)
- dir = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path[0..1].join('/'))
+ dir = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path[0..1].join("/"))
metadata = ChefZero::CookbookData.metadata_from(dir, path[1], nil, [])
- metadata[:version] || '0.0.0'
+ metadata[:version] || "0.0.0"
end
def update_json(path, default_value)
@@ -694,7 +694,7 @@ class Chef
end
def is_org?
- repo_mode == 'hosted_everything'
+ repo_mode == "hosted_everything"
end
end
end
diff --git a/lib/chef/chef_fs/command_line.rb b/lib/chef/chef_fs/command_line.rb
index 8a205eef78..e48d5d67cd 100644
--- a/lib/chef/chef_fs/command_line.rb
+++ b/lib/chef/chef_fs/command_line.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system'
-require 'chef/chef_fs/file_system/operation_failed_error'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
-require 'chef/util/diff'
+require "chef/chef_fs/file_system"
+require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/util/diff"
class Chef
module ChefFS
@@ -72,7 +72,7 @@ class Chef
elsif old_value
result = "diff --knife #{old_path} #{new_path}\n"
result << "deleted file\n"
- result << diff_text(old_path, '/dev/null', old_value, '')
+ result << diff_text(old_path, "/dev/null", old_value, "")
yield result
else
yield "Only in #{format_path.call(old_entry.parent)}: #{old_entry.name}\n"
@@ -87,7 +87,7 @@ class Chef
elsif new_value
result = "diff --knife #{old_path} #{new_path}\n"
result << "new file\n"
- result << diff_text('/dev/null', new_path, '', new_value)
+ result << diff_text("/dev/null", new_path, "", new_value)
yield result
else
yield "Only in #{format_path.call(new_entry.parent)}: #{new_entry.name}\n"
diff --git a/lib/chef/chef_fs/config.rb b/lib/chef/chef_fs/config.rb
index 29c9d3b879..dbba396ebb 100644
--- a/lib/chef/chef_fs/config.rb
+++ b/lib/chef/chef_fs/config.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/chef_fs/path_utils'
+require "chef/log"
+require "chef/chef_fs/path_utils"
class Chef
module ChefFS
@@ -115,7 +115,7 @@ class Chef
@cwd = File.expand_path(cwd)
@cookbook_version = options[:cookbook_version]
- if @chef_config[:repo_mode] == 'everything' && is_hosted? && !ui.nil?
+ if @chef_config[:repo_mode] == "everything" && is_hosted? && !ui.nil?
ui.warn %Q{You have repo_mode set to 'everything', but your chef_server_url
looks like it might be a hosted setup. If this is the case please use
hosted_everything or allow repo_mode to default}
@@ -123,9 +123,9 @@ class Chef
# Default to getting *everything* from the server.
if !@chef_config[:repo_mode]
if is_hosted?
- @chef_config[:repo_mode] = 'hosted_everything'
+ @chef_config[:repo_mode] = "hosted_everything"
else
- @chef_config[:repo_mode] = 'everything'
+ @chef_config[:repo_mode] = "everything"
end
end
end
@@ -143,7 +143,7 @@ class Chef
end
def create_chef_fs
- require 'chef/chef_fs/file_system/chef_server/chef_server_root_dir'
+ require "chef/chef_fs/file_system/chef_server/chef_server_root_dir"
Chef::ChefFS::FileSystem::ChefServer::ChefServerRootDir.new("remote", @chef_config, :cookbook_version => @cookbook_version)
end
@@ -152,7 +152,7 @@ class Chef
end
def create_local_fs
- require 'chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir'
+ require "chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir"
Chef::ChefFS::FileSystem::Repository::ChefRepositoryFileSystemRootDir.new(object_paths, Array(chef_config[:chef_repo_path]).flatten, @chef_config)
end
@@ -198,7 +198,7 @@ class Chef
# path and use realpath because a repo_path if provided *must* exist.
realest_chef_repo_path = Chef::ChefFS::PathUtils.realest_path(chef_repo_path, @cwd)
if Chef::ChefFS::PathUtils.os_path_eq?(target_path, realest_chef_repo_path)
- return '/'
+ return "/"
end
end
@@ -216,10 +216,10 @@ class Chef
server_path = entry.path
if base_path && server_path[0,base_path.length] == base_path
if server_path == base_path
- return '.'
- elsif server_path[base_path.length,1] == '/'
+ return "."
+ elsif server_path[base_path.length,1] == "/"
return server_path[base_path.length + 1, server_path.length - base_path.length - 1]
- elsif base_path == '/' && server_path[0,1] == '/'
+ elsif base_path == "/" && server_path[0,1] == "/"
return server_path[1, server_path.length - 1]
end
end
@@ -232,9 +232,9 @@ class Chef
@object_paths ||= begin
result = {}
case @chef_config[:repo_mode]
- when 'static'
+ when "static"
object_names = %w(cookbooks data_bags environments roles)
- when 'hosted_everything'
+ when "hosted_everything"
object_names = %w(acls clients cookbooks containers data_bags environments groups nodes roles policies policy_groups)
else
object_names = %w(clients cookbooks data_bags environments nodes roles users)
diff --git a/lib/chef/chef_fs/data_handler/acl_data_handler.rb b/lib/chef/chef_fs/data_handler/acl_data_handler.rb
index 6096b6e43c..91e48101c4 100644
--- a/lib/chef/chef_fs/data_handler/acl_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/acl_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -7,16 +7,16 @@ class Chef
def normalize(acl, entry)
# Normalize the order of the keys for easier reading
result = normalize_hash(acl, {
- 'create' => {},
- 'read' => {},
- 'update' => {},
- 'delete' => {},
- 'grant' => {},
+ "create" => {},
+ "read" => {},
+ "update" => {},
+ "delete" => {},
+ "grant" => {},
},)
result.keys.each do |key|
- result[key] = normalize_hash(result[key], { 'actors' => [], 'groups' => [] })
- result[key]['actors'] = result[key]['actors'].sort
- result[key]['groups'] = result[key]['groups'].sort
+ result[key] = normalize_hash(result[key], { "actors" => [], "groups" => [] })
+ result[key]["actors"] = result[key]["actors"].sort
+ result[key]["groups"] = result[key]["groups"].sort
end
result
end
diff --git a/lib/chef/chef_fs/data_handler/client_data_handler.rb b/lib/chef/chef_fs/data_handler/client_data_handler.rb
index 421a463c2f..5e120035ac 100644
--- a/lib/chef/chef_fs/data_handler/client_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/client_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/api_client'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/api_client"
class Chef
module ChefFS
@@ -7,25 +7,25 @@ class Chef
class ClientDataHandler < DataHandlerBase
def normalize(client, entry)
defaults = {
- 'name' => remove_dot_json(entry.name),
- 'clientname' => remove_dot_json(entry.name),
- 'admin' => false,
- 'validator' => false,
- 'chef_type' => 'client',
+ "name" => remove_dot_json(entry.name),
+ "clientname" => remove_dot_json(entry.name),
+ "admin" => false,
+ "validator" => false,
+ "chef_type" => "client",
}
# Handle the fact that admin/validator have changed type from string -> boolean
- client['admin'] = (client['admin'] == 'true') if client['admin'].is_a?(String)
- client['validator'] = (client['validator'] == 'true') if client['validator'].is_a?(String)
+ client["admin"] = (client["admin"] == "true") if client["admin"].is_a?(String)
+ client["validator"] = (client["validator"] == "true") if client["validator"].is_a?(String)
if entry.respond_to?(:org) && entry.org
- defaults['orgname'] = entry.org
+ defaults["orgname"] = entry.org
end
result = normalize_hash(client, defaults)
- result.delete('json_class')
+ result.delete("json_class")
result
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/container_data_handler.rb b/lib/chef/chef_fs/data_handler/container_data_handler.rb
index f03005f947..d1e8d2f3af 100644
--- a/lib/chef/chef_fs/data_handler/container_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/container_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -6,18 +6,18 @@ class Chef
class ContainerDataHandler < DataHandlerBase
def normalize(container, entry)
normalize_hash(container, {
- 'containername' => remove_dot_json(entry.name),
- 'containerpath' => remove_dot_json(entry.name),
+ "containername" => remove_dot_json(entry.name),
+ "containerpath" => remove_dot_json(entry.name),
},)
end
def preserve_key?(key)
- return key == 'containername'
+ return key == "containername"
end
def verify_integrity(object, entry, &on_error)
base_name = remove_dot_json(entry.name)
- if object['containername'] != base_name
+ if object["containername"] != base_name
on_error.call("Name in #{entry.path_for_printing} must be '#{base_name}' (is '#{object['name']}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb b/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
index 0f2cad7983..f75f96f773 100644
--- a/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/cookbook/metadata'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/cookbook/metadata"
class Chef
module ChefFS
@@ -9,22 +9,22 @@ class Chef
version = entry.name
name = entry.parent.name
result = normalize_hash(cookbook, {
- 'name' => "#{name}-#{version}",
- 'version' => version,
- 'cookbook_name' => name,
- 'json_class' => 'Chef::CookbookVersion',
- 'chef_type' => 'cookbook_version',
- 'frozen?' => false,
- 'metadata' => {},
+ "name" => "#{name}-#{version}",
+ "version" => version,
+ "cookbook_name" => name,
+ "json_class" => "Chef::CookbookVersion",
+ "chef_type" => "cookbook_version",
+ "frozen?" => false,
+ "metadata" => {},
},)
- result['metadata'] = normalize_hash(result['metadata'], {
- 'version' => version,
- 'name' => name,
+ result["metadata"] = normalize_hash(result["metadata"], {
+ "version" => version,
+ "name" => name,
},)
end
def preserve_key?(key)
- return key == 'cookbook_name' || key == 'version'
+ return key == "cookbook_name" || key == "version"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb b/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
index e2d0f43de2..d56f662c5c 100644
--- a/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/data_bag_item'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/data_bag_item"
class Chef
module ChefFS
@@ -7,19 +7,19 @@ class Chef
class DataBagItemDataHandler < DataHandlerBase
def normalize(data_bag_item, entry)
# If it's wrapped with raw_data, unwrap it.
- if data_bag_item['json_class'] == 'Chef::DataBagItem' && data_bag_item['raw_data']
- data_bag_item = data_bag_item['raw_data']
+ if data_bag_item["json_class"] == "Chef::DataBagItem" && data_bag_item["raw_data"]
+ data_bag_item = data_bag_item["raw_data"]
end
# chef_type and data_bag come back in PUT and POST results, but we don't
# use those in knife-essentials.
normalize_hash(data_bag_item, {
- 'id' => remove_dot_json(entry.name)
+ "id" => remove_dot_json(entry.name)
},)
end
def normalize_for_post(data_bag_item, entry)
- if data_bag_item['json_class'] == 'Chef::DataBagItem' && data_bag_item['raw_data']
- data_bag_item = data_bag_item['raw_data']
+ if data_bag_item["json_class"] == "Chef::DataBagItem" && data_bag_item["raw_data"]
+ data_bag_item = data_bag_item["raw_data"]
end
{
"name" => "data_bag_item_#{entry.parent.name}_#{remove_dot_json(entry.name)}",
@@ -35,7 +35,7 @@ class Chef
end
def preserve_key?(key)
- return key == 'id'
+ return key == "id"
end
def chef_class
@@ -44,7 +44,7 @@ class Chef
def verify_integrity(object, entry, &on_error)
base_name = remove_dot_json(entry.name)
- if object['raw_data']['id'] != base_name
+ if object["raw_data"]["id"] != base_name
on_error.call("ID in #{entry.path_for_printing} must be '#{base_name}' (is '#{object['raw_data']['id']}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/data_handler_base.rb b/lib/chef/chef_fs/data_handler/data_handler_base.rb
index a3dc92405c..53936979e3 100644
--- a/lib/chef/chef_fs/data_handler/data_handler_base.rb
+++ b/lib/chef/chef_fs/data_handler/data_handler_base.rb
@@ -147,7 +147,7 @@ class Chef
# environment "desert"'
#
def to_ruby_keys(object, keys)
- result = ''
+ result = ""
keys.each do |key|
if object[key]
if object[key].is_a?(Hash)
@@ -158,7 +158,7 @@ class Chef
if first
first = false
else
- result << ' '*key.length
+ result << " "*key.length
end
result << " #{k.inspect} => #{v.inspect}\n"
end
@@ -191,7 +191,7 @@ class Chef
#
def verify_integrity(object, entry, &on_error)
base_name = remove_dot_json(entry.name)
- if object['name'] != base_name
+ if object["name"] != base_name
on_error.call("Name must be '#{base_name}' (is '#{object['name']}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/environment_data_handler.rb b/lib/chef/chef_fs/data_handler/environment_data_handler.rb
index 5152a01e39..2480415f85 100644
--- a/lib/chef/chef_fs/data_handler/environment_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/environment_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/environment'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/environment"
class Chef
module ChefFS
@@ -7,18 +7,18 @@ class Chef
class EnvironmentDataHandler < DataHandlerBase
def normalize(environment, entry)
normalize_hash(environment, {
- 'name' => remove_dot_json(entry.name),
- 'description' => '',
- 'cookbook_versions' => {},
- 'default_attributes' => {},
- 'override_attributes' => {},
- 'json_class' => 'Chef::Environment',
- 'chef_type' => 'environment',
+ "name" => remove_dot_json(entry.name),
+ "description" => "",
+ "cookbook_versions" => {},
+ "default_attributes" => {},
+ "override_attributes" => {},
+ "json_class" => "Chef::Environment",
+ "chef_type" => "environment",
},)
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
@@ -27,8 +27,8 @@ class Chef
def to_ruby(object)
result = to_ruby_keys(object, %w(name description default_attributes override_attributes))
- if object['cookbook_versions']
- object['cookbook_versions'].each_pair do |name, version|
+ if object["cookbook_versions"]
+ object["cookbook_versions"].each_pair do |name, version|
result << "cookbook #{name.inspect}, #{version.inspect}"
end
end
diff --git a/lib/chef/chef_fs/data_handler/group_data_handler.rb b/lib/chef/chef_fs/data_handler/group_data_handler.rb
index 40cb57b78a..7f38784826 100644
--- a/lib/chef/chef_fs/data_handler/group_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/group_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/api_client'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/api_client"
class Chef
module ChefFS
@@ -7,32 +7,32 @@ class Chef
class GroupDataHandler < DataHandlerBase
def normalize(group, entry)
defaults = {
- 'name' => remove_dot_json(entry.name),
- 'groupname' => remove_dot_json(entry.name),
- 'users' => [],
- 'clients' => [],
- 'groups' => [],
+ "name" => remove_dot_json(entry.name),
+ "groupname" => remove_dot_json(entry.name),
+ "users" => [],
+ "clients" => [],
+ "groups" => [],
}
if entry.org
- defaults['orgname'] = entry.org
+ defaults["orgname"] = entry.org
end
result = normalize_hash(group, defaults)
- if result['actors'] && result['actors'].sort.uniq == (result['users'] + result['clients']).sort.uniq
- result.delete('actors')
+ if result["actors"] && result["actors"].sort.uniq == (result["users"] + result["clients"]).sort.uniq
+ result.delete("actors")
end
result
end
def normalize_for_put(group, entry)
result = super(group, entry)
- result['actors'] = {
- 'users' => result['users'],
- 'clients' => result['clients'],
- 'groups' => result['groups'],
+ result["actors"] = {
+ "users" => result["users"],
+ "clients" => result["clients"],
+ "groups" => result["groups"],
}
- result.delete('users')
- result.delete('clients')
- result.delete('groups')
+ result.delete("users")
+ result.delete("clients")
+ result.delete("groups")
result
end
@@ -41,7 +41,7 @@ class Chef
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/node_data_handler.rb b/lib/chef/chef_fs/data_handler/node_data_handler.rb
index c4910b55b9..fcec74d2fb 100644
--- a/lib/chef/chef_fs/data_handler/node_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/node_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/node'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/node"
class Chef
module ChefFS
@@ -7,22 +7,22 @@ class Chef
class NodeDataHandler < DataHandlerBase
def normalize(node, entry)
result = normalize_hash(node, {
- 'name' => remove_dot_json(entry.name),
- 'json_class' => 'Chef::Node',
- 'chef_type' => 'node',
- 'chef_environment' => '_default',
- 'override' => {},
- 'normal' => {},
- 'default' => {},
- 'automatic' => {},
- 'run_list' => [],
+ "name" => remove_dot_json(entry.name),
+ "json_class" => "Chef::Node",
+ "chef_type" => "node",
+ "chef_environment" => "_default",
+ "override" => {},
+ "normal" => {},
+ "default" => {},
+ "automatic" => {},
+ "run_list" => [],
},)
- result['run_list'] = normalize_run_list(result['run_list'])
+ result["run_list"] = normalize_run_list(result["run_list"])
result
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/organization_data_handler.rb b/lib/chef/chef_fs/data_handler/organization_data_handler.rb
index 7b1bcc4c6c..d9f97b29ac 100644
--- a/lib/chef/chef_fs/data_handler/organization_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/organization_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -6,21 +6,21 @@ class Chef
class OrganizationDataHandler < DataHandlerBase
def normalize(organization, entry)
result = normalize_hash(organization, {
- 'name' => entry.org,
- 'full_name' => entry.org,
- 'org_type' => 'Business',
- 'clientname' => "#{entry.org}-validator",
- 'billing_plan' => 'platform-free',
+ "name" => entry.org,
+ "full_name" => entry.org,
+ "org_type" => "Business",
+ "clientname" => "#{entry.org}-validator",
+ "billing_plan" => "platform-free",
},)
result
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def verify_integrity(object, entry, &on_error)
- if entry.org != object['name']
+ if entry.org != object["name"]
on_error.call("Name must be '#{entry.org}' (is '#{object['name']}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb b/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb
index db56ecc504..c5a5f873c5 100644
--- a/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb
@@ -1,11 +1,11 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
module DataHandler
class OrganizationInvitesDataHandler < DataHandlerBase
def normalize(invites, entry)
- invites.map { |invite| invite.is_a?(Hash) ? invite['username'] : invite }.sort.uniq
+ invites.map { |invite| invite.is_a?(Hash) ? invite["username"] : invite }.sort.uniq
end
def minimize(invites, entry)
diff --git a/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb b/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb
index afa331775c..8e452a413c 100644
--- a/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb
@@ -1,11 +1,11 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
module DataHandler
class OrganizationMembersDataHandler < DataHandlerBase
def normalize(members, entry)
- members.map { |member| member.is_a?(Hash) ? member['user']['username'] : member }.sort.uniq
+ members.map { |member| member.is_a?(Hash) ? member["user"]["username"] : member }.sort.uniq
end
def minimize(members, entry)
diff --git a/lib/chef/chef_fs/data_handler/policy_data_handler.rb b/lib/chef/chef_fs/data_handler/policy_data_handler.rb
index 32a7a791f7..477d2bf637 100644
--- a/lib/chef/chef_fs/data_handler/policy_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/policy_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -10,7 +10,7 @@ class Chef
if name =~ /^(.*)-([^-]*)$/
name, revision_id = $1, $2
end
- revision_id ||= '0.0.0'
+ revision_id ||= "0.0.0"
[ name, revision_id ]
end
@@ -18,21 +18,21 @@ class Chef
# foo-1.0.0 = foo, 1.0.0
name, revision_id = name_and_revision(entry.name)
defaults = {
- 'name' => name,
- 'revision_id' => revision_id,
- 'run_list' => [],
- 'cookbook_locks' => {},
+ "name" => name,
+ "revision_id" => revision_id,
+ "run_list" => [],
+ "cookbook_locks" => {},
}
normalize_hash(policy, defaults)
end
def verify_integrity(object_data, entry, &on_error)
name, revision = name_and_revision(entry.name)
- if object_data['name'] != name
+ if object_data["name"] != name
on_error.call("Object name '#{object_data['name']}' doesn't match entry '#{entry.name}'.")
end
- if object_data['revision_id'] != revision
+ if object_data["revision_id"] != revision
on_error.call("Object revision ID '#{object_data['revision']}' doesn't match entry '#{entry.name}'.")
end
end
diff --git a/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb b/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
index 10de6abb42..e5c430ab64 100644
--- a/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/data_handler/role_data_handler.rb b/lib/chef/chef_fs/data_handler/role_data_handler.rb
index d7530f0b9b..a3a1a31dc7 100644
--- a/lib/chef/chef_fs/data_handler/role_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/role_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/role'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/role"
class Chef
module ChefFS
@@ -7,24 +7,24 @@ class Chef
class RoleDataHandler < DataHandlerBase
def normalize(role, entry)
result = normalize_hash(role, {
- 'name' => remove_dot_json(entry.name),
- 'description' => '',
- 'json_class' => 'Chef::Role',
- 'chef_type' => 'role',
- 'default_attributes' => {},
- 'override_attributes' => {},
- 'run_list' => [],
- 'env_run_lists' => {},
+ "name" => remove_dot_json(entry.name),
+ "description" => "",
+ "json_class" => "Chef::Role",
+ "chef_type" => "role",
+ "default_attributes" => {},
+ "override_attributes" => {},
+ "run_list" => [],
+ "env_run_lists" => {},
},)
- result['run_list'] = normalize_run_list(result['run_list'])
- result['env_run_lists'].each_pair do |env, run_list|
- result['env_run_lists'][env] = normalize_run_list(run_list)
+ result["run_list"] = normalize_run_list(result["run_list"])
+ result["env_run_lists"].each_pair do |env, run_list|
+ result["env_run_lists"][env] = normalize_run_list(run_list)
end
result
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/user_data_handler.rb b/lib/chef/chef_fs/data_handler/user_data_handler.rb
index 01c673b460..392e67f822 100644
--- a/lib/chef/chef_fs/data_handler/user_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/user_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -6,20 +6,20 @@ class Chef
class UserDataHandler < DataHandlerBase
def normalize(user, entry)
normalize_hash(user, {
- 'name' => remove_dot_json(entry.name),
- 'username' => remove_dot_json(entry.name),
- 'display_name' => remove_dot_json(entry.name),
- 'admin' => false,
- 'json_class' => 'Chef::WebUIUser',
- 'chef_type' => 'webui_user',
- 'salt' => nil,
- 'password' => nil,
- 'openid' => nil,
+ "name" => remove_dot_json(entry.name),
+ "username" => remove_dot_json(entry.name),
+ "display_name" => remove_dot_json(entry.name),
+ "admin" => false,
+ "json_class" => "Chef::WebUIUser",
+ "chef_type" => "webui_user",
+ "salt" => nil,
+ "password" => nil,
+ "openid" => nil,
},)
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
# There is no chef_class for users, nor does to_ruby work.
diff --git a/lib/chef/chef_fs/file_pattern.rb b/lib/chef/chef_fs/file_pattern.rb
index b2351dac68..f6081a5f33 100644
--- a/lib/chef/chef_fs/file_pattern.rb
+++ b/lib/chef/chef_fs/file_pattern.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs'
-require 'chef/chef_fs/path_utils'
+require "chef/chef_fs"
+require "chef/chef_fs/path_utils"
class Chef
module ChefFS
@@ -70,7 +70,7 @@ class Chef
# abc/def.could_match_children?('x') == false
# a**z.could_match_children?('ab/cd') == true
def could_match_children?(path)
- return false if path == '' # Empty string is not a path
+ return false if path == "" # Empty string is not a path
argument_is_absolute = Chef::ChefFS::PathUtils::is_absolute?(path)
return false if is_absolute != argument_is_absolute
@@ -125,7 +125,7 @@ class Chef
def exact_path
return nil if has_double_star || exact_parts.any? { |part| part.nil? }
result = Chef::ChefFS::PathUtils::join(*exact_parts)
- is_absolute ? Chef::ChefFS::PathUtils::join('', result) : result
+ is_absolute ? Chef::ChefFS::PathUtils::join("", result) : result
end
# Returns the normalized version of the pattern, with / as the directory
@@ -199,12 +199,12 @@ class Chef
end
# Skip // and /./ (pretend it's not there)
- if exact == '' || exact == '.'
+ if exact == "" || exact == "."
next
end
# Back up when you see .. (unless the prior part has ** in it, in which case .. must be preserved)
- if exact == '..'
+ if exact == ".."
if @is_absolute && normalized_parts.length == 0
# If we are at the root, just pretend the .. isn't there
next
@@ -234,7 +234,7 @@ class Chef
@regexp = Regexp.new("^#{full_regexp_parts.join(Chef::ChefFS::PathUtils::regexp_path_separator)}$")
@normalized_pattern = Chef::ChefFS::PathUtils.join(*normalized_parts)
- @normalized_pattern = Chef::ChefFS::PathUtils.join('', @normalized_pattern) if @is_absolute
+ @normalized_pattern = Chef::ChefFS::PathUtils.join("", @normalized_pattern) if @is_absolute
end
end
@@ -249,7 +249,7 @@ class Chef
end
def self.regexp_escape_characters
- [ '[', '\\', '^', '$', '.', '|', '?', '*', '+', '(', ')', '{', '}' ]
+ [ "[", '\\', "^", "$", ".", "|", "?", "*", "+", "(", ")", "{", "}" ]
end
def self.pattern_to_regexp(pattern)
@@ -264,16 +264,16 @@ class Chef
else
case part
# **, * and ? happen on both platforms.
- when '**'
+ when "**"
exact = nil
has_double_star = true
- regexp << '.*'
- when '*'
+ regexp << ".*"
+ when "*"
exact = nil
regexp << '[^\/]*'
- when '?'
+ when "?"
exact = nil
- regexp << '.'
+ regexp << "."
else
if part[0,1] == '\\' && part.length == 2
# backslash escapes are only supported on Unix, and are handled here by leaving the escape on (it means the same thing in a regex)
@@ -283,7 +283,7 @@ class Chef
else
regexp << part[1,1]
end
- elsif part[0,1] == '[' && part.length > 1
+ elsif part[0,1] == "[" && part.length > 1
# [...] happens only on Unix, and is handled here by *not* backslashing (it means the same thing in and out of regex)
exact = nil
regexp << part
diff --git a/lib/chef/chef_fs/file_system.rb b/lib/chef/chef_fs/file_system.rb
index 3ab59046cc..f2d6fe1026 100644
--- a/lib/chef/chef_fs/file_system.rb
+++ b/lib/chef/chef_fs/file_system.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/chef_fs/path_utils'
-require 'chef/chef_fs/file_system/default_environment_cannot_be_modified_error'
-require 'chef/chef_fs/file_system/operation_failed_error'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
-require 'chef/chef_fs/parallelizer'
+require "chef/chef_fs/path_utils"
+require "chef/chef_fs/file_system/default_environment_cannot_be_modified_error"
+require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/chef_fs/parallelizer"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/already_exists_error.rb b/lib/chef/chef_fs/file_system/already_exists_error.rb
index e6d4a8fa2c..ef93ed7729 100644
--- a/lib/chef/chef_fs/file_system/already_exists_error.rb
+++ b/lib/chef/chef_fs/file_system/already_exists_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/operation_failed_error'
+require "chef/chef_fs/file_system/operation_failed_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/base_fs_dir.rb b/lib/chef/chef_fs/file_system/base_fs_dir.rb
index 47e33f961a..2c3f0bf5ae 100644
--- a/lib/chef/chef_fs/file_system/base_fs_dir.rb
+++ b/lib/chef/chef_fs/file_system/base_fs_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/chef_fs/file_system/nonexistent_fs_object'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/chef_fs/file_system/nonexistent_fs_object"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/base_fs_object.rb b/lib/chef/chef_fs/file_system/base_fs_object.rb
index 916ab8297d..5af8a99dd3 100644
--- a/lib/chef/chef_fs/file_system/base_fs_object.rb
+++ b/lib/chef/chef_fs/file_system/base_fs_object.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/path_utils'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
+require "chef/chef_fs/path_utils"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
class Chef
module ChefFS
@@ -29,10 +29,10 @@ class Chef
if parent
@path = Chef::ChefFS::PathUtils::join(parent.path, name)
else
- if name != ''
+ if name != ""
raise ArgumentError, "Name of root object must be empty string: was '#{name}' instead"
end
- @path = '/'
+ @path = "/"
end
end
@@ -146,7 +146,7 @@ class Chef
def path_for_printing
if parent
parent_path = parent.path_for_printing
- if parent_path == '.'
+ if parent_path == "."
name
else
Chef::ChefFS::PathUtils::join(parent.path_for_printing, name)
@@ -180,4 +180,4 @@ class Chef
end
end
-require 'chef/chef_fs/file_system/nonexistent_fs_object'
+require "chef/chef_fs/file_system/nonexistent_fs_object"
diff --git a/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb b/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
index fff47c986d..65d21a90b0 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/acl_entry'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/acl_entry"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
index f87a7eaca9..4a602ba66d 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
-require 'chef/chef_fs/file_system/operation_failed_error'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/chef_fs/file_system/operation_failed_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb b/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb
index bc7168e31d..aa1ebf159e 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/acl_dir'
-require 'chef/chef_fs/file_system/chef_server/cookbooks_acl_dir'
-require 'chef/chef_fs/file_system/chef_server/acl_entry'
-require 'chef/chef_fs/data_handler/acl_data_handler'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/acl_dir"
+require "chef/chef_fs/file_system/chef_server/cookbooks_acl_dir"
+require "chef/chef_fs/file_system/chef_server/acl_entry"
+require "chef/chef_fs/data_handler/acl_data_handler"
class Chef
module ChefFS
@@ -42,20 +42,20 @@ class Chef
end
def can_have_child?(name, is_dir)
- is_dir ? ENTITY_TYPES.include?(name) : name == 'organization.json'
+ is_dir ? ENTITY_TYPES.include?(name) : name == "organization.json"
end
def children
if @children.nil?
@children = ENTITY_TYPES.map do |entity_type|
case entity_type
- when 'cookbooks'
+ when "cookbooks"
CookbooksAclDir.new(entity_type, self)
else
AclDir.new(entity_type, self)
end
end
- @children << AclEntry.new('organization.json', self, true) # the org acl is retrieved as GET /organizations/ORGNAME/ANYTHINGATALL/_acl
+ @children << AclEntry.new("organization.json", self, true) # the org acl is retrieved as GET /organizations/ORGNAME/ANYTHINGATALL/_acl
end
@children
end
diff --git a/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb b/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb
index 38abd60668..4a45d218d1 100644
--- a/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb
@@ -16,29 +16,29 @@
# limitations under the License.
#
-require 'chef/server_api'
-require 'chef/chef_fs/file_system/chef_server/acls_dir'
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/cookbooks_dir'
-require 'chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir'
-require 'chef/chef_fs/file_system/chef_server/data_bags_dir'
-require 'chef/chef_fs/file_system/chef_server/nodes_dir'
-require 'chef/chef_fs/file_system/chef_server/org_entry'
-require 'chef/chef_fs/file_system/chef_server/organization_invites_entry'
-require 'chef/chef_fs/file_system/chef_server/organization_members_entry'
-require 'chef/chef_fs/file_system/chef_server/policies_dir'
-require 'chef/chef_fs/file_system/chef_server/policy_groups_dir'
-require 'chef/chef_fs/file_system/chef_server/environments_dir'
-require 'chef/chef_fs/data_handler/acl_data_handler'
-require 'chef/chef_fs/data_handler/client_data_handler'
-require 'chef/chef_fs/data_handler/environment_data_handler'
-require 'chef/chef_fs/data_handler/node_data_handler'
-require 'chef/chef_fs/data_handler/role_data_handler'
-require 'chef/chef_fs/data_handler/user_data_handler'
-require 'chef/chef_fs/data_handler/group_data_handler'
-require 'chef/chef_fs/data_handler/container_data_handler'
-require 'chef/chef_fs/data_handler/policy_group_data_handler'
+require "chef/server_api"
+require "chef/chef_fs/file_system/chef_server/acls_dir"
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/cookbooks_dir"
+require "chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir"
+require "chef/chef_fs/file_system/chef_server/data_bags_dir"
+require "chef/chef_fs/file_system/chef_server/nodes_dir"
+require "chef/chef_fs/file_system/chef_server/org_entry"
+require "chef/chef_fs/file_system/chef_server/organization_invites_entry"
+require "chef/chef_fs/file_system/chef_server/organization_members_entry"
+require "chef/chef_fs/file_system/chef_server/policies_dir"
+require "chef/chef_fs/file_system/chef_server/policy_groups_dir"
+require "chef/chef_fs/file_system/chef_server/environments_dir"
+require "chef/chef_fs/data_handler/acl_data_handler"
+require "chef/chef_fs/data_handler/client_data_handler"
+require "chef/chef_fs/data_handler/environment_data_handler"
+require "chef/chef_fs/data_handler/node_data_handler"
+require "chef/chef_fs/data_handler/role_data_handler"
+require "chef/chef_fs/data_handler/user_data_handler"
+require "chef/chef_fs/data_handler/group_data_handler"
+require "chef/chef_fs/data_handler/container_data_handler"
+require "chef/chef_fs/data_handler/policy_group_data_handler"
class Chef
module ChefFS
@@ -125,11 +125,11 @@ class Chef
def org
@org ||= begin
path = Pathname.new(URI.parse(chef_server_url).path).cleanpath
- if File.dirname(path) == '/organizations'
+ if File.dirname(path) == "/organizations"
File.basename(path)
else
# In Chef 12, everything is in an org.
- 'chef'
+ "chef"
end
end
end
@@ -150,7 +150,7 @@ class Chef
# /roles
RestListDir.new("roles", self, nil, Chef::ChefFS::DataHandler::RoleDataHandler.new),
]
- if repo_mode == 'hosted_everything'
+ if repo_mode == "hosted_everything"
result += [
# /acls
AclsDir.new("acls", self),
@@ -173,7 +173,7 @@ class Chef
# /policy_groups
PolicyGroupsDir.new("policy_groups", self, nil, Chef::ChefFS::DataHandler::PolicyGroupDataHandler.new),
]
- elsif repo_mode != 'static'
+ elsif repo_mode != "static"
result += [
# /clients
RestListDir.new("clients", self, nil, Chef::ChefFS::DataHandler::ClientDataHandler.new),
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
index 433f1a009d..18bf748d87 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/chef_fs/command_line'
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/cookbook_subdir'
-require 'chef/chef_fs/file_system/chef_server/cookbook_file'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/cookbook_version'
-require 'chef/cookbook_uploader'
+require "chef/chef_fs/command_line"
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/cookbook_subdir"
+require "chef/chef_fs/file_system/chef_server/cookbook_file"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/cookbook_version"
+require "chef/cookbook_uploader"
class Chef
module ChefFS
@@ -82,7 +82,7 @@ class Chef
def can_have_child?(name, is_dir)
# A cookbook's root may not have directories unless they are segment directories
- return name != 'root_files' && COOKBOOK_SEGMENT_INFO.keys.include?(name.to_sym) if is_dir
+ return name != "root_files" && COOKBOOK_SEGMENT_INFO.keys.include?(name.to_sym) if is_dir
return true
end
@@ -96,7 +96,7 @@ class Chef
# Go through each file in the manifest for the segment, and
# add cookbook subdirs and files for it.
manifest[segment].each do |segment_file|
- parts = segment_file[:path].split('/')
+ parts = segment_file[:path].split("/")
# Get or create the path to the file
container = self
parts[0,parts.length-1].each do |part|
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb
index 721c5092cf..fc9ad46d71 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/http/simple'
-require 'openssl'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/http/simple"
+require "openssl"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb
index 55c0168077..9bc1821c48 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
+require "chef/chef_fs/file_system/base_fs_dir"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb
index 999fb58f79..2460aba47f 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/acl_dir'
-require 'chef/chef_fs/file_system/chef_server/acl_entry'
+require "chef/chef_fs/file_system/chef_server/acl_dir"
+require "chef/chef_fs/file_system/chef_server/acl_entry"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
index 5fd8111d7a..660cc95734 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/cookbook_dir'
-require 'chef/chef_fs/file_system/operation_failed_error'
-require 'chef/chef_fs/file_system/cookbook_frozen_error'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir'
-require 'chef/mixin/file_class'
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/cookbook_dir"
+require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/chef_fs/file_system/cookbook_frozen_error"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir"
+require "chef/mixin/file_class"
-require 'tmpdir'
+require "tmpdir"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb b/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
index b657243d64..60875d7b4c 100644
--- a/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/must_delete_recursively_error'
-require 'chef/chef_fs/data_handler/data_bag_item_data_handler'
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/must_delete_recursively_error"
+require "chef/chef_fs/data_handler/data_bag_item_data_handler"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb b/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb
index 50952cfc1b..710c8f0a72 100644
--- a/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/data_bag_dir'
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/data_bag_dir"
class Chef
module ChefFS
@@ -49,7 +49,7 @@ class Chef
def create_child(name, file_contents)
begin
- rest.post(api_path, { 'name' => name })
+ rest.post(api_path, { "name" => name })
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating child '#{name}': #{e}")
rescue Net::HTTPServerException => e
diff --git a/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb b/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb
index 721c8a38d4..aa9423a43d 100644
--- a/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/default_environment_cannot_be_modified_error'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/default_environment_cannot_be_modified_error"
class Chef
module ChefFS
@@ -27,7 +27,7 @@ class Chef
module ChefServer
class EnvironmentsDir < RestListDir
def make_child_entry(name, exists = nil)
- if name == '_default.json'
+ if name == "_default.json"
DefaultEnvironmentEntry.new(name, self, exists)
else
super
diff --git a/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb b/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
index c0728fbe1f..596a63b0b8 100644
--- a/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/data_handler/node_data_handler'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/data_handler/node_data_handler"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/org_entry.rb b/lib/chef/chef_fs/file_system/chef_server/org_entry.rb
index 82c5764b42..87be36b932 100644
--- a/lib/chef/chef_fs/file_system/chef_server/org_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/org_entry.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/data_handler/organization_data_handler'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/data_handler/organization_data_handler"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb b/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb
index cf276c6466..986a04ff4a 100644
--- a/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb
@@ -1,6 +1,6 @@
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/data_handler/organization_invites_data_handler'
-require 'chef/json_compat'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/data_handler/organization_invites_data_handler"
+require "chef/json_compat"
class Chef
module ChefFS
@@ -24,7 +24,7 @@ class Chef
# /organizations/foo/invites.json -> /organizations/foo/association_requests
def api_path
- File.join(parent.api_path, 'association_requests')
+ File.join(parent.api_path, "association_requests")
end
def exists?
@@ -37,13 +37,13 @@ class Chef
def write(contents)
desired_invites = minimize_value(Chef::JSONCompat.parse(contents, :create_additions => false))
- actual_invites = _read_json.inject({}) { |h,val| h[val['username']] = val['id']; h }
+ actual_invites = _read_json.inject({}) { |h,val| h[val["username"]] = val["id"]; h }
invites = actual_invites.keys
(desired_invites - invites).each do |invite|
begin
- rest.post(api_path, { 'user' => invite })
+ rest.post(api_path, { "user" => invite })
rescue Net::HTTPServerException => e
- if e.response.code == '409'
+ if e.response.code == "409"
Chef::Log.warn("Could not invite #{invite} to organization #{org}: #{api_error_text(e.response)}")
else
raise
diff --git a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
index 1c1c231643..00c1c71b71 100644
--- a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
@@ -1,6 +1,6 @@
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/data_handler/organization_members_data_handler'
-require 'chef/json_compat'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/data_handler/organization_members_data_handler"
+require "chef/json_compat"
class Chef
module ChefFS
@@ -24,7 +24,7 @@ class Chef
# /organizations/foo/members.json -> /organizations/foo/users
def api_path
- File.join(parent.api_path, 'users')
+ File.join(parent.api_path, "users")
end
def exists?
@@ -40,7 +40,7 @@ class Chef
members = minimize_value(_read_json)
(desired_members - members).each do |member|
begin
- rest.post(api_path, 'username' => member)
+ rest.post(api_path, "username" => member)
rescue Net::HTTPServerException => e
if %w(404 405).include?(e.response.code)
raise "Chef server at #{api_path} does not allow you to directly add members. Please either upgrade your Chef server or move the users you want into invitations.json instead of members.json."
diff --git a/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb b/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
index b6c34cfee7..ea2a048fbf 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/policy_revision_entry'
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/policy_revision_entry"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb b/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
index 76ececbd5b..3858ef66c4 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/already_exists_error'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/operation_failed_error'
+require "chef/chef_fs/file_system/already_exists_error"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/operation_failed_error"
class Chef
module ChefFS
@@ -107,8 +107,8 @@ class Chef
end
# Now we need to remove any policies that are *not* in our current group.
- if existing_group && existing_group['policies']
- (existing_group['policies'].keys - policy_datas.keys).each do |policy_name|
+ if existing_group && existing_group["policies"]
+ (existing_group["policies"].keys - policy_datas.keys).each do |policy_name|
rest.delete("#{api_path}/policies/#{policy_name}")
end
end
diff --git a/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb b/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb
index 0c061ebdb2..71e0fc4579 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/chef_server/policy_group_entry'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/chef_server/policy_group_entry"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb b/lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
index 7ea93278d0..a51a1ff5c9 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/data_handler/policy_data_handler'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/data_handler/policy_data_handler"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
index 84790190d1..573f107e54 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
index 4ceab42c1b..692b6cfc73 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/operation_failed_error'
-require 'chef/role'
-require 'chef/node'
-require 'chef/json_compat'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/role"
+require "chef/node"
+require "chef/json_compat"
class Chef
module ChefFS
@@ -174,7 +174,7 @@ class Chef
def api_error_text(response)
begin
- Chef::JSONCompat.parse(response.body)['error'].join("\n")
+ Chef::JSONCompat.parse(response.body)["error"].join("\n")
rescue
response.body
end
diff --git a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb
index 25b3fa38cc..ddc3e7a049 100644
--- a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/versioned_cookbook_dir'
+require "chef/chef_fs/file_system/chef_server/versioned_cookbook_dir"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
index bccb34bb37..c22723d1e2 100644
--- a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/cookbooks_dir'
-require 'chef/chef_fs/file_system/chef_server/versioned_cookbook_dir'
+require "chef/chef_fs/file_system/chef_server/cookbooks_dir"
+require "chef/chef_fs/file_system/chef_server/versioned_cookbook_dir"
class Chef
module ChefFS
@@ -42,7 +42,7 @@ class Chef
@children ||= begin
result = []
root.get_json("#{api_path}/?num_versions=all").each_pair do |cookbook_name, cookbooks|
- cookbooks['versions'].each do |cookbook_version|
+ cookbooks["versions"].each do |cookbook_version|
result << VersionedCookbookDir.new("#{cookbook_name}-#{cookbook_version['version']}", self)
end
end
diff --git a/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb b/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
index cbb25cd03a..d081249b24 100644
--- a/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
+++ b/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/already_exists_error'
+require "chef/chef_fs/file_system/already_exists_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb b/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
index a077474da8..da5ed90710 100644
--- a/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
+++ b/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
+require "chef/chef_fs/file_system/operation_not_allowed_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/memory/memory_dir.rb b/lib/chef/chef_fs/file_system/memory/memory_dir.rb
index b571a6f469..beb661448d 100644
--- a/lib/chef/chef_fs/file_system/memory/memory_dir.rb
+++ b/lib/chef/chef_fs/file_system/memory/memory_dir.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/memory/memory_file'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/memory/memory_file"
class Chef
module ChefFS
@@ -26,15 +26,15 @@ class Chef
end
def add_file(path, value)
- path_parts = path.split('/')
- dir = add_dir(path_parts[0..-2].join('/'))
+ path_parts = path.split("/")
+ dir = add_dir(path_parts[0..-2].join("/"))
file = MemoryFile.new(path_parts[-1], dir, value)
dir.add_child(file)
file
end
def add_dir(path)
- path_parts = path.split('/')
+ path_parts = path.split("/")
dir = self
path_parts.each do |path_part|
subdir = dir.child(path_part)
diff --git a/lib/chef/chef_fs/file_system/memory/memory_file.rb b/lib/chef/chef_fs/file_system/memory/memory_file.rb
index 8b280eeb7d..644273fa9f 100644
--- a/lib/chef/chef_fs/file_system/memory/memory_file.rb
+++ b/lib/chef/chef_fs/file_system/memory/memory_file.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/file_system/base_fs_object'
+require "chef/chef_fs/file_system/base_fs_object"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/memory/memory_root.rb b/lib/chef/chef_fs/file_system/memory/memory_root.rb
index f4a7b5208b..4881b3d951 100644
--- a/lib/chef/chef_fs/file_system/memory/memory_root.rb
+++ b/lib/chef/chef_fs/file_system/memory/memory_root.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/file_system/memory/memory_dir'
+require "chef/chef_fs/file_system/memory/memory_dir"
class Chef
module ChefFS
@@ -6,7 +6,7 @@ class Chef
module Memory
class MemoryRoot < MemoryDir
def initialize(pretty_name, cannot_be_in_regex = nil)
- super('', nil)
+ super("", nil)
@pretty_name = pretty_name
@cannot_be_in_regex = cannot_be_in_regex
end
diff --git a/lib/chef/chef_fs/file_system/multiplexed_dir.rb b/lib/chef/chef_fs/file_system/multiplexed_dir.rb
index 70b827f85f..e143dde9e8 100644
--- a/lib/chef/chef_fs/file_system/multiplexed_dir.rb
+++ b/lib/chef/chef_fs/file_system/multiplexed_dir.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/chef_fs/file_system/nonexistent_fs_object'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/chef_fs/file_system/nonexistent_fs_object"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb b/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
index 11b26e514e..b54af68587 100644
--- a/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
+++ b/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/file_system_error'
+require "chef/chef_fs/file_system/file_system_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb b/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
index a587ab47a4..7a09c8fd0b 100644
--- a/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
+++ b/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/chef_fs/file_system/not_found_error'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/chef_fs/file_system/not_found_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/not_found_error.rb b/lib/chef/chef_fs/file_system/not_found_error.rb
index 088c38cc64..76b8076da1 100644
--- a/lib/chef/chef_fs/file_system/not_found_error.rb
+++ b/lib/chef/chef_fs/file_system/not_found_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/file_system_error'
+require "chef/chef_fs/file_system/file_system_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/operation_failed_error.rb b/lib/chef/chef_fs/file_system/operation_failed_error.rb
index 70461e082e..886a9982bf 100644
--- a/lib/chef/chef_fs/file_system/operation_failed_error.rb
+++ b/lib/chef/chef_fs/file_system/operation_failed_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/file_system_error'
+require "chef/chef_fs/file_system/file_system_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb b/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
index e756cc76a3..130c10ed5b 100644
--- a/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
+++ b/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/file_system_error'
+require "chef/chef_fs/file_system/file_system_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb
index 7d647c0fc3..888ef6d3be 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/file_system/chef_server/acls_dir'
-require 'chef/chef_fs/data_handler/acl_data_handler'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/file_system/chef_server/acls_dir"
+require "chef/chef_fs/data_handler/acl_data_handler"
class Chef
module ChefFS
@@ -30,7 +30,7 @@ class Chef
end
def can_have_child?(name, is_dir)
- is_dir ? Chef::ChefFS::FileSystem::ChefServer::AclsDir::ENTITY_TYPES.include?(name) : name == 'organization.json'
+ is_dir ? Chef::ChefFS::FileSystem::ChefServer::AclsDir::ENTITY_TYPES.include?(name) : name == "organization.json"
end
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
index e6557bd05d..17a84ff2bc 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry'
-require 'chef/chef_fs/file_system/chef_server/cookbook_dir'
-require 'chef/chef_fs/file_system/chef_server/versioned_cookbook_dir'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/cookbook/chefignore'
-require 'chef/cookbook/cookbook_version_loader'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry"
+require "chef/chef_fs/file_system/chef_server/cookbook_dir"
+require "chef/chef_fs/file_system/chef_server/versioned_cookbook_dir"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/cookbook/chefignore"
+require "chef/cookbook/cookbook_version_loader"
class Chef
module ChefFS
@@ -50,7 +50,7 @@ class Chef
def can_have_child?(name, is_dir)
if is_dir
# Only the given directories will be uploaded.
- return Chef::ChefFS::FileSystem::ChefServer::CookbookDir::COOKBOOK_SEGMENT_INFO.keys.include?(name.to_sym) && name != 'root_files'
+ return Chef::ChefFS::FileSystem::ChefServer::CookbookDir::COOKBOOK_SEGMENT_INFO.keys.include?(name.to_sym) && name != "root_files"
elsif name == Chef::Cookbook::CookbookVersionLoader::UPLOADED_COOKBOOK_VERSION_FILE
return false
end
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
index 574ed44828..ce11849d42 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir'
-require 'chef/chef_fs/file_system/not_found_error'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir"
+require "chef/chef_fs/file_system/not_found_error"
class Chef
module ChefFS
@@ -40,9 +40,9 @@ class Chef
def can_have_child?(name, is_dir)
if is_dir
- return recursive && name != '.' && name != '..'
+ return recursive && name != "." && name != ".."
elsif ruby_only
- return false if name[-3..-1] != '.rb'
+ return false if name[-3..-1] != ".rb"
end
# Check chefignore
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb
index 5c88aa2aa1..1ed9d6ee0b 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir'
-require 'chef/cookbook/chefignore'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir"
+require "chef/cookbook/chefignore"
class Chef
module ChefFS
@@ -50,7 +50,7 @@ class Chef
end
def can_have_child?(name, is_dir)
- is_dir && !name.start_with?('.')
+ is_dir && !name.start_with?(".")
end
def write_cookbook(cookbook_path, cookbook_version_json, from_fs)
@@ -67,7 +67,7 @@ class Chef
FileUtils.mkdir_p(cookbook_file_path)
end
uploaded_cookbook_version_path = File.join(cookbook_file_path, Chef::Cookbook::CookbookVersionLoader::UPLOADED_COOKBOOK_VERSION_FILE)
- File.open(uploaded_cookbook_version_path, 'w') do |file|
+ File.open(uploaded_cookbook_version_path, "w") do |file|
file.write(cookbook_version_json)
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb
index a0d564704a..0476d78794 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/data_handler/data_bag_item_data_handler'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/data_handler/data_bag_item_data_handler"
class Chef
module ChefFS
@@ -29,7 +29,7 @@ class Chef
end
def can_have_child?(name, is_dir)
- is_dir && !name.start_with?('.')
+ is_dir && !name.start_with?(".")
end
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
index 92658c07fa..91813452aa 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/file_system_entry'
-require 'chef/chef_fs/file_system/not_found_error'
+require "chef/chef_fs/file_system/repository/file_system_entry"
+require "chef/chef_fs/file_system/not_found_error"
class Chef
module ChefFS
@@ -54,11 +54,11 @@ class Chef
end
def can_have_child?(name, is_dir)
- !is_dir && name[-5..-1] == '.json'
+ !is_dir && name[-5..-1] == ".json"
end
def write(file_contents)
- if file_contents && write_pretty_json && name[-5..-1] == '.json'
+ if file_contents && write_pretty_json && name[-5..-1] == ".json"
file_contents = minimize(file_contents, self)
end
super(file_contents)
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
index 2e9eeea0ee..3cb3c914b2 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
@@ -16,22 +16,22 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir'
-require 'chef/chef_fs/file_system/multiplexed_dir'
-require 'chef/chef_fs/data_handler/client_data_handler'
-require 'chef/chef_fs/data_handler/environment_data_handler'
-require 'chef/chef_fs/data_handler/node_data_handler'
-require 'chef/chef_fs/data_handler/policy_data_handler'
-require 'chef/chef_fs/data_handler/policy_group_data_handler'
-require 'chef/chef_fs/data_handler/role_data_handler'
-require 'chef/chef_fs/data_handler/user_data_handler'
-require 'chef/chef_fs/data_handler/group_data_handler'
-require 'chef/chef_fs/data_handler/container_data_handler'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir"
+require "chef/chef_fs/file_system/multiplexed_dir"
+require "chef/chef_fs/data_handler/client_data_handler"
+require "chef/chef_fs/data_handler/environment_data_handler"
+require "chef/chef_fs/data_handler/node_data_handler"
+require "chef/chef_fs/data_handler/policy_data_handler"
+require "chef/chef_fs/data_handler/policy_group_data_handler"
+require "chef/chef_fs/data_handler/role_data_handler"
+require "chef/chef_fs/data_handler/user_data_handler"
+require "chef/chef_fs/data_handler/group_data_handler"
+require "chef/chef_fs/data_handler/container_data_handler"
class Chef
module ChefFS
@@ -113,7 +113,7 @@ class Chef
# Used to print out a human-readable file system description
def fs_description
- repo_paths = root_paths || [ File.dirname(child_paths['cookbooks'][0]) ]
+ repo_paths = root_paths || [ File.dirname(child_paths["cookbooks"][0]) ]
result = "repository at #{repo_paths.join(', ')}\n"
if versioned_cookbooks
result << " Multiple versions per cookbook\n"
@@ -162,35 +162,35 @@ class Chef
return NonexistentFSObject.new(name, self)
end
case name
- when 'cookbooks'
+ when "cookbooks"
if versioned_cookbooks
dirs = paths.map { |path| ChefRepositoryFileSystemVersionedCookbooksDir.new(name, self, path) }
else
dirs = paths.map { |path| ChefRepositoryFileSystemCookbooksDir.new(name, self, path) }
end
- when 'data_bags'
+ when "data_bags"
dirs = paths.map { |path| ChefRepositoryFileSystemDataBagsDir.new(name, self, path) }
- when 'acls'
+ when "acls"
dirs = paths.map { |path| ChefRepositoryFileSystemAclsDir.new(name, self, path) }
else
data_handler = case name
- when 'clients'
+ when "clients"
Chef::ChefFS::DataHandler::ClientDataHandler.new
- when 'environments'
+ when "environments"
Chef::ChefFS::DataHandler::EnvironmentDataHandler.new
- when 'nodes'
+ when "nodes"
Chef::ChefFS::DataHandler::NodeDataHandler.new
- when 'policies'
+ when "policies"
Chef::ChefFS::DataHandler::PolicyDataHandler.new
- when 'policy_groups'
+ when "policy_groups"
Chef::ChefFS::DataHandler::PolicyGroupDataHandler.new
- when 'roles'
+ when "roles"
Chef::ChefFS::DataHandler::RoleDataHandler.new
- when 'users'
+ when "users"
Chef::ChefFS::DataHandler::UserDataHandler.new
- when 'groups'
+ when "groups"
Chef::ChefFS::DataHandler::GroupDataHandler.new
- when 'containers'
+ when "containers"
Chef::ChefFS::DataHandler::ContainerDataHandler.new
else
raise "Unknown top level path #{name}"
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb
index cf9378dbf9..f1dbef8195 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb
index 322944fc82..b791957d66 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
index f8c8d490d2..1e64a41b44 100644
--- a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/already_exists_error'
-require 'chef/chef_fs/file_system/must_delete_recursively_error'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/path_utils'
-require 'fileutils'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/already_exists_error"
+require "chef/chef_fs/file_system/must_delete_recursively_error"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/path_utils"
+require "fileutils"
class Chef
module ChefFS
@@ -100,7 +100,7 @@ class Chef
end
def write(content)
- File.open(file_path, 'wb') do |file|
+ File.open(file_path, "wb") do |file|
file.write(content)
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb
index e4c9a455e3..037f9a8446 100644
--- a/lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/file_system_entry'
+require "chef/chef_fs/file_system/repository/file_system_entry"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/knife.rb b/lib/chef/chef_fs/knife.rb
index 9101e455f8..83adf6a495 100644
--- a/lib/chef/chef_fs/knife.rb
+++ b/lib/chef/chef_fs/knife.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'pathname'
+require "chef/knife"
+require "pathname"
class Chef
module ChefFS
@@ -25,11 +25,11 @@ class Chef
# Workaround for CHEF-3932
def self.deps
super do
- require 'chef/config'
- require 'chef/chef_fs/parallelizer'
- require 'chef/chef_fs/config'
- require 'chef/chef_fs/file_pattern'
- require 'chef/chef_fs/path_utils'
+ require "chef/config"
+ require "chef/chef_fs/parallelizer"
+ require "chef/chef_fs/config"
+ require "chef/chef_fs/file_pattern"
+ require "chef/chef_fs/path_utils"
yield
end
end
@@ -45,16 +45,16 @@ class Chef
end
option :repo_mode,
- :long => '--repo-mode MODE',
+ :long => "--repo-mode MODE",
:description => "Specifies the local repository layout. Values: static, everything, hosted_everything. Default: everything/hosted_everything"
option :chef_repo_path,
- :long => '--chef-repo-path PATH',
- :description => 'Overrides the location of chef repo. Default is specified by chef_repo_path in the config'
+ :long => "--chef-repo-path PATH",
+ :description => "Overrides the location of chef repo. Default is specified by chef_repo_path in the config"
option :concurrency,
- :long => '--concurrency THREADS',
- :description => 'Maximum number of simultaneous requests to send (default: 10)'
+ :long => "--concurrency THREADS",
+ :description => "Maximum number of simultaneous requests to send (default: 10)"
def configure_chef
super
@@ -111,7 +111,7 @@ class Chef
end
# Use the original path because we can't be sure.
inferred_path = arg
- elsif arg[0,1] == '~'
+ elsif arg[0,1] == "~"
# Let's be nice and fix it if possible - but warn the user.
ui.warn("A path relative to a user home directory has been provided: #{arg}")
ui.warn("Paths provided need to be rooted at the chef-repo being considered or be relative paths.")
diff --git a/lib/chef/chef_fs/parallelizer.rb b/lib/chef/chef_fs/parallelizer.rb
index 116a626869..6590431d91 100644
--- a/lib/chef/chef_fs/parallelizer.rb
+++ b/lib/chef/chef_fs/parallelizer.rb
@@ -1,5 +1,5 @@
-require 'thread'
-require 'chef/chef_fs/parallelizer/parallel_enumerable'
+require "thread"
+require "chef/chef_fs/parallelizer/parallel_enumerable"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb b/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb
index 26dd30592c..60f283eabe 100644
--- a/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb
+++ b/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/parallelizer/flatten_enumerable'
+require "chef/chef_fs/parallelizer/flatten_enumerable"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/path_utils.rb b/lib/chef/chef_fs/path_utils.rb
index 595f966378..6ac106fa40 100644
--- a/lib/chef/chef_fs/path_utils.rb
+++ b/lib/chef/chef_fs/path_utils.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs'
-require 'pathname'
+require "chef/chef_fs"
+require "pathname"
class Chef
module ChefFS
@@ -45,9 +45,9 @@ class Chef
# Determine if it started with a slash
absolute = parts[0].length == 0 || parts[0].length > 0 && parts[0] =~ /^#{regexp_path_separator}/
# Remove leading and trailing slashes from each part so that the join will work (and the slash at the end will go away)
- parts = parts.map { |part| part.gsub(/^#{regexp_path_separator}+|#{regexp_path_separator}+$/, '') }
+ parts = parts.map { |part| part.gsub(/^#{regexp_path_separator}+|#{regexp_path_separator}+$/, "") }
# Don't join empty bits
- result = parts.select { |part| part != '' }.join('/')
+ result = parts.select { |part| part != "" }.join("/")
# Put the / back on
absolute ? "/#{result}" : result
end
@@ -57,7 +57,7 @@ class Chef
end
def self.regexp_path_separator
- Chef::ChefFS::windows? ? '[\/\\\\]' : '/'
+ Chef::ChefFS::windows? ? '[\/\\\\]' : "/"
end
# Given a server path, determines if it is absolute.
@@ -113,7 +113,7 @@ class Chef
candidate_fragment = path[0, ancestor.length]
return nil unless PathUtils.os_path_eq?(candidate_fragment, ancestor)
if ancestor.length == path.length
- ''
+ ""
elsif path[ancestor.length,1] =~ /#{PathUtils.regexp_path_separator}/
path[ancestor.length+1..-1]
else