summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-09-02 15:50:36 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-09-02 15:51:33 -0700
commit9f9ceec96a463099c7a724e6097a96a1171d9838 (patch)
tree38783d62679989b490865d591b066886b382190c
parentc3a79237eb34266d948bb780b36f7865a9322544 (diff)
downloadchef-zero-lcg/remove-create-additions.tar.gz
remove create additions flaglcg/remove-create-additions
FFI_Yajl has never implemented this flag Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef_zero/chef_data/default_creator.rb10
-rw-r--r--lib/chef_zero/endpoints/acl_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/acls_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/actor_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/authenticate_user_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/container_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/cookbook_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/cookbook_version_endpoint.rb8
-rw-r--r--lib/chef_zero/endpoints/data_bag_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/data_bag_item_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/data_bags_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/environment_cookbook_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb8
-rw-r--r--lib/chef_zero/endpoints/environment_cookbooks_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/environment_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/environment_nodes_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/environment_recipes_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/environment_role_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/group_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/node_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/nodes_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/organization_association_request_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/organization_association_requests_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/organization_authenticate_user_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/organization_endpoint.rb6
-rw-r--r--lib/chef_zero/endpoints/organization_user_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/organization_users_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/organization_validator_key_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/organizations_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/rest_list_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/rest_object_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/role_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/role_environments_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/sandbox_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/sandboxes_endpoint.rb2
-rw-r--r--lib/chef_zero/endpoints/search_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/system_recovery_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/user_association_request_endpoint.rb4
-rw-r--r--lib/chef_zero/endpoints/user_organizations_endpoint.rb2
-rw-r--r--lib/chef_zero/rest_base.rb2
40 files changed, 63 insertions, 63 deletions
diff --git a/lib/chef_zero/chef_data/default_creator.rb b/lib/chef_zero/chef_data/default_creator.rb
index 0618176..51872d5 100644
--- a/lib/chef_zero/chef_data/default_creator.rb
+++ b/lib/chef_zero/chef_data/default_creator.rb
@@ -240,11 +240,11 @@ module ChefZero
when "groups/admins"
admins = data.list(path[0..1] + [ "users" ]).select do |name|
- user = FFI_Yajl::Parser.parse(data.get(path[0..1] + [ "users", name ]), :create_additions => false)
+ user = FFI_Yajl::Parser.parse(data.get(path[0..1] + [ "users", name ]))
user["admin"]
end
admins += data.list(path[0..1] + [ "clients" ]).select do |name|
- client = FFI_Yajl::Parser.parse(data.get(path[0..1] + [ "clients", name ]), :create_additions => false)
+ client = FFI_Yajl::Parser.parse(data.get(path[0..1] + [ "clients", name ]))
client["admin"]
end
admins += @creators[path[0..1]] if @creators[path[0..1]]
@@ -353,7 +353,7 @@ module ChefZero
# Non-validator clients own themselves.
if path.size == 4 && path[0] == "organizations" && path[2] == "clients"
begin
- client = FFI_Yajl::Parser.parse(data.get(path), :create_additions => false)
+ client = FFI_Yajl::Parser.parse(data.get(path))
if !client["validator"]
unknown_owners |= [ path[3] ]
end
@@ -365,7 +365,7 @@ module ChefZero
if @creators[path]
@creators[path].each do |creator|
begin
- client = FFI_Yajl::Parser.parse(data.get(path[0..2] + [ creator ]), :create_additions => false)
+ client = FFI_Yajl::Parser.parse(data.get(path[0..2] + [ creator ]))
next if client["validator"]
rescue
end
@@ -440,7 +440,7 @@ module ChefZero
def get_container_acl(acl_path)
parent_path = AclPath.parent_acl_data_path(acl_path)
if parent_path
- FFI_Yajl::Parser.parse(data.get(parent_path), :create_additions => false)
+ FFI_Yajl::Parser.parse(data.get(parent_path))
else
nil
end
diff --git a/lib/chef_zero/endpoints/acl_endpoint.rb b/lib/chef_zero/endpoints/acl_endpoint.rb
index 366bb89..527ba17 100644
--- a/lib/chef_zero/endpoints/acl_endpoint.rb
+++ b/lib/chef_zero/endpoints/acl_endpoint.rb
@@ -28,8 +28,8 @@ module ChefZero
def put(request)
path, perm = validate_request(request)
- acls = FFI_Yajl::Parser.parse(get_data(request, path), :create_additions => false)
- acls[perm] = FFI_Yajl::Parser.parse(request.body, :create_additions => false)[perm]
+ acls = FFI_Yajl::Parser.parse(get_data(request, path))
+ acls[perm] = FFI_Yajl::Parser.parse(request.body)[perm]
set_data(request, path, FFI_Yajl::Encoder.encode(acls, :pretty => true))
json_response(200, { "uri" => "#{build_uri(request.base_uri, request.rest_path)}" })
end
diff --git a/lib/chef_zero/endpoints/acls_endpoint.rb b/lib/chef_zero/endpoints/acls_endpoint.rb
index f0ca047..64840cd 100644
--- a/lib/chef_zero/endpoints/acls_endpoint.rb
+++ b/lib/chef_zero/endpoints/acls_endpoint.rb
@@ -20,7 +20,7 @@ module ChefZero
if !acl_path
raise RestErrorResponse.new(404, "Object not found: #{build_uri(request.base_uri, request.rest_path)}")
end
- acls = FFI_Yajl::Parser.parse(get_data(request, acl_path), :create_additions => false)
+ acls = FFI_Yajl::Parser.parse(get_data(request, acl_path))
acls = ChefData::DataNormalizer.normalize_acls(acls)
if request.query_params["detail"] == "granular"
acls.each do |perm, ace|
diff --git a/lib/chef_zero/endpoints/actor_endpoint.rb b/lib/chef_zero/endpoints/actor_endpoint.rb
index ea5284e..8d90c13 100644
--- a/lib/chef_zero/endpoints/actor_endpoint.rb
+++ b/lib/chef_zero/endpoints/actor_endpoint.rb
@@ -36,7 +36,7 @@ module ChefZero
def put(request)
# Find out if we're updating the public key.
- request_body = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ request_body = FFI_Yajl::Parser.parse(request.body)
if request_body["public_key"].nil?
# If public_key is null, then don't overwrite it. Weird patchiness.
diff --git a/lib/chef_zero/endpoints/authenticate_user_endpoint.rb b/lib/chef_zero/endpoints/authenticate_user_endpoint.rb
index fd26798..e54b8f1 100644
--- a/lib/chef_zero/endpoints/authenticate_user_endpoint.rb
+++ b/lib/chef_zero/endpoints/authenticate_user_endpoint.rb
@@ -6,7 +6,7 @@ module ChefZero
# /authenticate_user
class AuthenticateUserEndpoint < RestBase
def post(request)
- request_json = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ request_json = FFI_Yajl::Parser.parse(request.body)
name = request_json["username"]
password = request_json["password"]
begin
@@ -14,7 +14,7 @@ module ChefZero
rescue ChefZero::DataStore::DataNotFoundError
raise RestErrorResponse.new(401, "Bad username or password")
end
- user = FFI_Yajl::Parser.parse(user, :create_additions => false)
+ user = FFI_Yajl::Parser.parse(user)
user = ChefData::DataNormalizer.normalize_user(user, name, [ "username" ], server.options[:osc_compat])
if user["password"] != password
raise RestErrorResponse.new(401, "Bad username or password")
diff --git a/lib/chef_zero/endpoints/container_endpoint.rb b/lib/chef_zero/endpoints/container_endpoint.rb
index 588d787..098f9a4 100644
--- a/lib/chef_zero/endpoints/container_endpoint.rb
+++ b/lib/chef_zero/endpoints/container_endpoint.rb
@@ -13,7 +13,7 @@ module ChefZero
undef_method(:put)
def populate_defaults(request, response_json)
- container = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
+ container = FFI_Yajl::Parser.parse(response_json)
container = ChefData::DataNormalizer.normalize_container(container, request.rest_path[3])
FFI_Yajl::Encoder.encode(container, :pretty => true)
end
diff --git a/lib/chef_zero/endpoints/cookbook_endpoint.rb b/lib/chef_zero/endpoints/cookbook_endpoint.rb
index 7dce172..8c4d49d 100644
--- a/lib/chef_zero/endpoints/cookbook_endpoint.rb
+++ b/lib/chef_zero/endpoints/cookbook_endpoint.rb
@@ -19,7 +19,7 @@ module ChefZero
result = []
filter_cookbooks(all_cookbooks_list(request), {}, 1) do |name, versions|
if versions.size > 0
- cookbook = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", name, versions[0]]), :create_additions => false)
+ cookbook = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", name, versions[0]]))
result += recipe_names(name, cookbook)
end
end
diff --git a/lib/chef_zero/endpoints/cookbook_version_endpoint.rb b/lib/chef_zero/endpoints/cookbook_version_endpoint.rb
index e2dc726..d22e5d9 100644
--- a/lib/chef_zero/endpoints/cookbook_version_endpoint.rb
+++ b/lib/chef_zero/endpoints/cookbook_version_endpoint.rb
@@ -22,13 +22,13 @@ module ChefZero
# Honor frozen
if existing_cookbook
- existing_cookbook_json = FFI_Yajl::Parser.parse(existing_cookbook, :create_additions => false)
+ existing_cookbook_json = FFI_Yajl::Parser.parse(existing_cookbook)
if existing_cookbook_json["frozen?"]
if request.query_params["force"] != "true"
raise RestErrorResponse.new(409, "The cookbook #{name} at version #{version} is frozen. Use the 'force' option to override.")
end
# For some reason, you are forever unable to modify "frozen?" on a frozen cookbook.
- request_body = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ request_body = FFI_Yajl::Parser.parse(request.body)
if !request_body["frozen?"]
request_body["frozen?"] = true
request.body = FFI_Yajl::Encoder.encode(request_body, :pretty => true)
@@ -71,7 +71,7 @@ module ChefZero
def get_checksums(cookbook)
result = []
- FFI_Yajl::Parser.parse(cookbook, :create_additions => false).each_pair do |key, value|
+ FFI_Yajl::Parser.parse(cookbook).each_pair do |key, value|
if value.is_a?(Array)
value.each do |file|
if file.is_a?(Hash) && file.has_key?("checksum")
@@ -118,7 +118,7 @@ module ChefZero
def populate_defaults(request, response_json)
# Inject URIs into each cookbook file
- cookbook = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
+ cookbook = FFI_Yajl::Parser.parse(response_json)
cookbook = ChefData::DataNormalizer.normalize_cookbook(self, request.rest_path[0..1], cookbook, request.rest_path[3], request.rest_path[4], request.base_uri, request.method)
FFI_Yajl::Encoder.encode(cookbook, :pretty => true)
end
diff --git a/lib/chef_zero/endpoints/data_bag_endpoint.rb b/lib/chef_zero/endpoints/data_bag_endpoint.rb
index 2f754cf..8d1a96f 100644
--- a/lib/chef_zero/endpoints/data_bag_endpoint.rb
+++ b/lib/chef_zero/endpoints/data_bag_endpoint.rb
@@ -12,7 +12,7 @@ module ChefZero
end
def post(request)
- json = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ json = FFI_Yajl::Parser.parse(request.body)
key = identity_keys.map { |k| json[k] }.select { |v| v }.first
response = super(request)
if response[0] == 201
@@ -23,7 +23,7 @@ module ChefZero
end
def get_key(contents)
- data_bag_item = FFI_Yajl::Parser.parse(contents, :create_additions => false)
+ data_bag_item = FFI_Yajl::Parser.parse(contents)
if data_bag_item["json_class"] == "Chef::DataBagItem" && data_bag_item["raw_data"]
data_bag_item["raw_data"]["id"]
else
diff --git a/lib/chef_zero/endpoints/data_bag_item_endpoint.rb b/lib/chef_zero/endpoints/data_bag_item_endpoint.rb
index 79bfedd..915e9ad 100644
--- a/lib/chef_zero/endpoints/data_bag_item_endpoint.rb
+++ b/lib/chef_zero/endpoints/data_bag_item_endpoint.rb
@@ -16,7 +16,7 @@ module ChefZero
end
def self.populate_defaults(request, response_json, data_bag, data_bag_item)
- response = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
+ response = FFI_Yajl::Parser.parse(response_json)
response = ChefData::DataNormalizer.normalize_data_bag_item(response, data_bag, data_bag_item, request.method)
FFI_Yajl::Encoder.encode(response, :pretty => true)
end
diff --git a/lib/chef_zero/endpoints/data_bags_endpoint.rb b/lib/chef_zero/endpoints/data_bags_endpoint.rb
index 03791b0..0ddb34e 100644
--- a/lib/chef_zero/endpoints/data_bags_endpoint.rb
+++ b/lib/chef_zero/endpoints/data_bags_endpoint.rb
@@ -7,7 +7,7 @@ module ChefZero
class DataBagsEndpoint < RestListEndpoint
def post(request)
contents = request.body
- json = FFI_Yajl::Parser.parse(contents, :create_additions => false)
+ json = FFI_Yajl::Parser.parse(contents)
name = identity_keys.map { |k| json[k] }.select { |v| v }.first
if name.nil?
error(400, "Must specify #{identity_keys.map { |k| k.inspect }.join(' or ')} in JSON")
diff --git a/lib/chef_zero/endpoints/environment_cookbook_endpoint.rb b/lib/chef_zero/endpoints/environment_cookbook_endpoint.rb
index 692244d..3e4bb61 100644
--- a/lib/chef_zero/endpoints/environment_cookbook_endpoint.rb
+++ b/lib/chef_zero/endpoints/environment_cookbook_endpoint.rb
@@ -7,7 +7,7 @@ module ChefZero
class EnvironmentCookbookEndpoint < CookbooksBase
def get(request)
cookbook_name = request.rest_path[5]
- environment = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]), :create_additions => false)
+ environment = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]))
constraints = environment["cookbook_versions"] || {}
cookbook_versions = list_data(request, request.rest_path[0..1] + request.rest_path[4..5])
if request.query_params["num_versions"] == "all"
diff --git a/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb b/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb
index 8e693b5..f1f38fe 100644
--- a/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb
+++ b/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb
@@ -12,7 +12,7 @@ module ChefZero
# Get the list of cookbooks and versions desired by the runlist
desired_versions = {}
- run_list = FFI_Yajl::Parser.parse(request.body, :create_additions => false)["run_list"]
+ run_list = FFI_Yajl::Parser.parse(request.body)["run_list"]
run_list.each do |run_list_entry|
if run_list_entry =~ /(.+)::.+\@(.+)/ || run_list_entry =~ /(.+)\@(.+)/
raise RestErrorResponse.new(412, "No such cookbook: #{$1}") if !cookbook_names.include?($1)
@@ -26,7 +26,7 @@ module ChefZero
end
# Filter by environment constraints
- environment = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]), :create_additions => false)
+ environment = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]))
environment_constraints = environment["cookbook_versions"] || {}
desired_versions.each_key do |name|
@@ -48,7 +48,7 @@ module ChefZero
result = {}
solved.each_pair do |name, versions|
- cookbook = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", name, versions[0]]), :create_additions => false)
+ cookbook = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", name, versions[0]]))
result[name] = ChefData::DataNormalizer.normalize_cookbook(self, request.rest_path[0..1], cookbook, name, versions[0], request.base_uri, "MIN")
end
json_response(200, result)
@@ -74,7 +74,7 @@ module ChefZero
new_unsolved = unsolved[1..-1]
# Pick this cookbook, and add dependencies
- cookbook_obj = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", solve_for, desired_version]), :create_additions => false)
+ cookbook_obj = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", solve_for, desired_version]))
cookbook_metadata = cookbook_obj["metadata"] || {}
cookbook_dependencies = cookbook_metadata["dependencies"] || {}
dep_not_found = false
diff --git a/lib/chef_zero/endpoints/environment_cookbooks_endpoint.rb b/lib/chef_zero/endpoints/environment_cookbooks_endpoint.rb
index c243bd0..ced6345 100644
--- a/lib/chef_zero/endpoints/environment_cookbooks_endpoint.rb
+++ b/lib/chef_zero/endpoints/environment_cookbooks_endpoint.rb
@@ -6,7 +6,7 @@ module ChefZero
# /environments/NAME/cookbooks
class EnvironmentCookbooksEndpoint < CookbooksBase
def get(request)
- environment = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]), :create_additions => false)
+ environment = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]))
constraints = environment["cookbook_versions"] || {}
if request.query_params["num_versions"] == "all"
num_versions = nil
diff --git a/lib/chef_zero/endpoints/environment_endpoint.rb b/lib/chef_zero/endpoints/environment_endpoint.rb
index 6d256e8..4f07a72 100644
--- a/lib/chef_zero/endpoints/environment_endpoint.rb
+++ b/lib/chef_zero/endpoints/environment_endpoint.rb
@@ -24,7 +24,7 @@ module ChefZero
end
def populate_defaults(request, response_json)
- response = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
+ response = FFI_Yajl::Parser.parse(response_json)
response = ChefData::DataNormalizer.normalize_environment(response, request.rest_path[3])
FFI_Yajl::Encoder.encode(response, :pretty => true)
end
diff --git a/lib/chef_zero/endpoints/environment_nodes_endpoint.rb b/lib/chef_zero/endpoints/environment_nodes_endpoint.rb
index cffe596..55e1877 100644
--- a/lib/chef_zero/endpoints/environment_nodes_endpoint.rb
+++ b/lib/chef_zero/endpoints/environment_nodes_endpoint.rb
@@ -11,7 +11,7 @@ module ChefZero
result = {}
list_data(request, request.rest_path[0..1] + ["nodes"]).each do |name|
- node = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["nodes", name]), :create_additions => false)
+ node = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["nodes", name]))
if node["chef_environment"] == request.rest_path[3]
result[name] = build_uri(request.base_uri, request.rest_path[0..1] + ["nodes", name])
end
diff --git a/lib/chef_zero/endpoints/environment_recipes_endpoint.rb b/lib/chef_zero/endpoints/environment_recipes_endpoint.rb
index 8165a68..d79660e 100644
--- a/lib/chef_zero/endpoints/environment_recipes_endpoint.rb
+++ b/lib/chef_zero/endpoints/environment_recipes_endpoint.rb
@@ -6,12 +6,12 @@ module ChefZero
# /environment/NAME/recipes
class EnvironmentRecipesEndpoint < CookbooksBase
def get(request)
- environment = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]), :create_additions => false)
+ environment = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]))
constraints = environment["cookbook_versions"] || {}
result = []
filter_cookbooks(all_cookbooks_list(request), constraints, 1) do |name, versions|
if versions.size > 0
- cookbook = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", name, versions[0]]), :create_additions => false)
+ cookbook = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + ["cookbooks", name, versions[0]]))
result += recipe_names(name, cookbook)
end
end
diff --git a/lib/chef_zero/endpoints/environment_role_endpoint.rb b/lib/chef_zero/endpoints/environment_role_endpoint.rb
index b05f28a..9d3ce3e 100644
--- a/lib/chef_zero/endpoints/environment_role_endpoint.rb
+++ b/lib/chef_zero/endpoints/environment_role_endpoint.rb
@@ -18,7 +18,7 @@ module ChefZero
# Verify that the environment exists
get_data(request, environment_path)
- role = FFI_Yajl::Parser.parse(get_data(request, role_path), :create_additions => false)
+ role = FFI_Yajl::Parser.parse(get_data(request, role_path))
environment_name = environment_path[3]
if environment_name == "_default"
run_list = role["run_list"]
diff --git a/lib/chef_zero/endpoints/group_endpoint.rb b/lib/chef_zero/endpoints/group_endpoint.rb
index fc21946..7855e98 100644
--- a/lib/chef_zero/endpoints/group_endpoint.rb
+++ b/lib/chef_zero/endpoints/group_endpoint.rb
@@ -11,7 +11,7 @@ module ChefZero
end
def populate_defaults(request, response_json)
- group = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
+ group = FFI_Yajl::Parser.parse(response_json)
group = ChefData::DataNormalizer.normalize_group(group, request.rest_path[3], request.rest_path[1])
FFI_Yajl::Encoder.encode(group, :pretty => true)
end
diff --git a/lib/chef_zero/endpoints/node_endpoint.rb b/lib/chef_zero/endpoints/node_endpoint.rb
index af0e9e0..98e88a0 100644
--- a/lib/chef_zero/endpoints/node_endpoint.rb
+++ b/lib/chef_zero/endpoints/node_endpoint.rb
@@ -21,7 +21,7 @@ module ChefZero
end
def populate_defaults(request, response_json)
- node = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
+ node = FFI_Yajl::Parser.parse(response_json)
node = ChefData::DataNormalizer.normalize_node(node, request.rest_path[3])
FFI_Yajl::Encoder.encode(node, :pretty => true)
end
diff --git a/lib/chef_zero/endpoints/nodes_endpoint.rb b/lib/chef_zero/endpoints/nodes_endpoint.rb
index 6011506..42539e1 100644
--- a/lib/chef_zero/endpoints/nodes_endpoint.rb
+++ b/lib/chef_zero/endpoints/nodes_endpoint.rb
@@ -25,7 +25,7 @@ module ChefZero
end
def populate_defaults(request, response_json)
- node = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
+ node = FFI_Yajl::Parser.parse(response_json)
node = ChefData::DataNormalizer.normalize_node(node, request.rest_path[3])
FFI_Yajl::Encoder.encode(node, :pretty => true)
end
diff --git a/lib/chef_zero/endpoints/organization_association_request_endpoint.rb b/lib/chef_zero/endpoints/organization_association_request_endpoint.rb
index 09be738..0402893 100644
--- a/lib/chef_zero/endpoints/organization_association_request_endpoint.rb
+++ b/lib/chef_zero/endpoints/organization_association_request_endpoint.rb
@@ -13,7 +13,7 @@ module ChefZero
end
username = $1
path = request.rest_path[0..-2] + [username]
- data = FFI_Yajl::Parser.parse(get_data(request, path), :create_additions => false)
+ data = FFI_Yajl::Parser.parse(get_data(request, path))
delete_data(request, path)
json_response(200, { "id" => id, "username" => username })
end
diff --git a/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb b/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb
index aeba290..cb4005d 100644
--- a/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb
+++ b/lib/chef_zero/endpoints/organization_association_requests_endpoint.rb
@@ -6,7 +6,7 @@ module ChefZero
# /organizations/ORG/association_requests
class OrganizationAssociationRequestsEndpoint < RestBase
def post(request)
- json = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ json = FFI_Yajl::Parser.parse(request.body)
username = json["user"]
orgname = request.rest_path[1]
id = "#{username}-#{orgname}"
diff --git a/lib/chef_zero/endpoints/organization_authenticate_user_endpoint.rb b/lib/chef_zero/endpoints/organization_authenticate_user_endpoint.rb
index 174235e..8a7abf7 100644
--- a/lib/chef_zero/endpoints/organization_authenticate_user_endpoint.rb
+++ b/lib/chef_zero/endpoints/organization_authenticate_user_endpoint.rb
@@ -6,12 +6,12 @@ module ChefZero
# /organizations/NAME/authenticate_user
class OrganizationAuthenticateUserEndpoint < RestBase
def post(request)
- request_json = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ request_json = FFI_Yajl::Parser.parse(request.body)
name = request_json["name"]
password = request_json["password"]
begin
user = data_store.get(request.rest_path[0..-2] + ["users", name])
- user = FFI_Yajl::Parser.parse(user, :create_additions => false)
+ user = FFI_Yajl::Parser.parse(user)
verified = user["password"] == password
rescue DataStore::DataNotFoundError
verified = false
diff --git a/lib/chef_zero/endpoints/organization_endpoint.rb b/lib/chef_zero/endpoints/organization_endpoint.rb
index 108073d..55bd686 100644
--- a/lib/chef_zero/endpoints/organization_endpoint.rb
+++ b/lib/chef_zero/endpoints/organization_endpoint.rb
@@ -11,8 +11,8 @@ module ChefZero
end
def put(request)
- org = FFI_Yajl::Parser.parse(get_data(request, request.rest_path + [ "org" ]), :create_additions => false)
- new_org = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ org = FFI_Yajl::Parser.parse(get_data(request, request.rest_path + [ "org" ]))
+ new_org = FFI_Yajl::Parser.parse(request.body)
new_org.each do |key, value|
org[key] = value
end
@@ -37,7 +37,7 @@ module ChefZero
end
def populate_defaults(request, response_json)
- org = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
+ org = FFI_Yajl::Parser.parse(response_json)
org = ChefData::DataNormalizer.normalize_organization(org, request.rest_path[1])
FFI_Yajl::Encoder.encode(org, :pretty => true)
end
diff --git a/lib/chef_zero/endpoints/organization_user_endpoint.rb b/lib/chef_zero/endpoints/organization_user_endpoint.rb
index 9418e53..7e69439 100644
--- a/lib/chef_zero/endpoints/organization_user_endpoint.rb
+++ b/lib/chef_zero/endpoints/organization_user_endpoint.rb
@@ -9,14 +9,14 @@ module ChefZero
username = request.rest_path[3]
get_data(request) # 404 if user is not in org
user = get_data(request, [ "users", username ])
- user = FFI_Yajl::Parser.parse(user, :create_additions => false)
+ user = FFI_Yajl::Parser.parse(user)
json_response(200, ChefData::DataNormalizer.normalize_user(user, username, ["username"], server.options[:osc_compat], request.method))
end
def delete(request)
user = get_data(request)
delete_data(request)
- user = FFI_Yajl::Parser.parse(user, :create_additions => false)
+ user = FFI_Yajl::Parser.parse(user)
json_response(200, ChefData::DataNormalizer.normalize_user(user, request.rest_path[3], ["username"], server.options[:osc_compat]))
end
diff --git a/lib/chef_zero/endpoints/organization_users_endpoint.rb b/lib/chef_zero/endpoints/organization_users_endpoint.rb
index 7473776..67161b1 100644
--- a/lib/chef_zero/endpoints/organization_users_endpoint.rb
+++ b/lib/chef_zero/endpoints/organization_users_endpoint.rb
@@ -8,7 +8,7 @@ module ChefZero
class OrganizationUsersEndpoint < RestBase
def post(request)
orgname = request.rest_path[1]
- json = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ json = FFI_Yajl::Parser.parse(request.body)
username = json["username"]
if exists_data?(request, [ "organizations", orgname, "users", username ])
@@ -16,7 +16,7 @@ module ChefZero
end
users = get_data(request, [ "organizations", orgname, "groups", "users" ])
- users = FFI_Yajl::Parser.parse(users, :create_additions => false)
+ users = FFI_Yajl::Parser.parse(users)
create_data(request, request.rest_path, username, "{}")
diff --git a/lib/chef_zero/endpoints/organization_validator_key_endpoint.rb b/lib/chef_zero/endpoints/organization_validator_key_endpoint.rb
index d9bac29..ff1ac3b 100644
--- a/lib/chef_zero/endpoints/organization_validator_key_endpoint.rb
+++ b/lib/chef_zero/endpoints/organization_validator_key_endpoint.rb
@@ -9,7 +9,7 @@ module ChefZero
def post(request)
org_name = request.rest_path[-2]
validator_path = [ "organizations", org_name, "clients", "#{org_name}-validator"]
- validator = FFI_Yajl::Parser.parse(get_data(request, validator_path), :create_additions => false)
+ validator = FFI_Yajl::Parser.parse(get_data(request, validator_path))
private_key, public_key = server.gen_key_pair
validator["public_key"] = public_key
set_data(request, validator_path, FFI_Yajl::Encoder.encode(validator, :pretty => true))
diff --git a/lib/chef_zero/endpoints/organizations_endpoint.rb b/lib/chef_zero/endpoints/organizations_endpoint.rb
index 52fca5f..268b533 100644
--- a/lib/chef_zero/endpoints/organizations_endpoint.rb
+++ b/lib/chef_zero/endpoints/organizations_endpoint.rb
@@ -15,7 +15,7 @@ module ChefZero
end
def post(request)
- contents = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ contents = FFI_Yajl::Parser.parse(request.body)
name = contents["name"]
full_name = contents["full_name"]
if name.nil?
diff --git a/lib/chef_zero/endpoints/rest_list_endpoint.rb b/lib/chef_zero/endpoints/rest_list_endpoint.rb
index 0f01a68..b1e3d5c 100644
--- a/lib/chef_zero/endpoints/rest_list_endpoint.rb
+++ b/lib/chef_zero/endpoints/rest_list_endpoint.rb
@@ -34,7 +34,7 @@ module ChefZero
end
def get_key(contents)
- json = FFI_Yajl::Parser.parse(contents, :create_additions => false)
+ json = FFI_Yajl::Parser.parse(contents)
identity_keys.map { |k| json[k] }.select { |v| v }.first
end
end
diff --git a/lib/chef_zero/endpoints/rest_object_endpoint.rb b/lib/chef_zero/endpoints/rest_object_endpoint.rb
index 1f0e9ce..c35133f 100644
--- a/lib/chef_zero/endpoints/rest_object_endpoint.rb
+++ b/lib/chef_zero/endpoints/rest_object_endpoint.rb
@@ -48,8 +48,8 @@ module ChefZero
def patch_request_body(request)
existing_value = get_data(request, nil, :nil)
if existing_value
- request_json = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
- existing_json = FFI_Yajl::Parser.parse(existing_value, :create_additions => false)
+ request_json = FFI_Yajl::Parser.parse(request.body)
+ existing_json = FFI_Yajl::Parser.parse(existing_value)
merged_json = existing_json.merge(request_json)
if merged_json.size > request_json.size
return FFI_Yajl::Encoder.encode(merged_json, :pretty => true)
diff --git a/lib/chef_zero/endpoints/role_endpoint.rb b/lib/chef_zero/endpoints/role_endpoint.rb
index 654afca..d4bc4cd 100644
--- a/lib/chef_zero/endpoints/role_endpoint.rb
+++ b/lib/chef_zero/endpoints/role_endpoint.rb
@@ -7,7 +7,7 @@ module ChefZero
# /roles/NAME
class RoleEndpoint < RestObjectEndpoint
def populate_defaults(request, response_json)
- role = FFI_Yajl::Parser.parse(response_json, :create_additions => false)
+ role = FFI_Yajl::Parser.parse(response_json)
role = ChefData::DataNormalizer.normalize_role(role, request.rest_path[3])
FFI_Yajl::Encoder.encode(role, :pretty => true)
end
diff --git a/lib/chef_zero/endpoints/role_environments_endpoint.rb b/lib/chef_zero/endpoints/role_environments_endpoint.rb
index a408138..625e13a 100644
--- a/lib/chef_zero/endpoints/role_environments_endpoint.rb
+++ b/lib/chef_zero/endpoints/role_environments_endpoint.rb
@@ -6,7 +6,7 @@ module ChefZero
# /roles/NAME/environments
class RoleEnvironmentsEndpoint < RestBase
def get(request)
- role = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]), :create_additions => false)
+ role = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..3]))
json_response(200, [ "_default" ] + (role["env_run_lists"].keys || []))
end
end
diff --git a/lib/chef_zero/endpoints/sandbox_endpoint.rb b/lib/chef_zero/endpoints/sandbox_endpoint.rb
index b83a4ca..a35af2c 100644
--- a/lib/chef_zero/endpoints/sandbox_endpoint.rb
+++ b/lib/chef_zero/endpoints/sandbox_endpoint.rb
@@ -7,7 +7,7 @@ module ChefZero
# /sandboxes/ID
class SandboxEndpoint < RestBase
def put(request)
- existing_sandbox = FFI_Yajl::Parser.parse(get_data(request), :create_additions => false)
+ existing_sandbox = FFI_Yajl::Parser.parse(get_data(request))
existing_sandbox["checksums"].each do |checksum|
if !exists_data?(request, request.rest_path[0..1] + ["file_store", "checksums", checksum])
raise RestErrorResponse.new(503, "Checksum not uploaded: #{checksum}")
diff --git a/lib/chef_zero/endpoints/sandboxes_endpoint.rb b/lib/chef_zero/endpoints/sandboxes_endpoint.rb
index 815ff14..888b72a 100644
--- a/lib/chef_zero/endpoints/sandboxes_endpoint.rb
+++ b/lib/chef_zero/endpoints/sandboxes_endpoint.rb
@@ -13,7 +13,7 @@ module ChefZero
def post(request)
sandbox_checksums = []
- needed_checksums = FFI_Yajl::Parser.parse(request.body, :create_additions => false)["checksums"]
+ needed_checksums = FFI_Yajl::Parser.parse(request.body)["checksums"]
result_checksums = {}
needed_checksums.keys.each do |needed_checksum|
if list_data(request, request.rest_path[0..1] + %w{file_store checksums}).include?(needed_checksum)
diff --git a/lib/chef_zero/endpoints/search_endpoint.rb b/lib/chef_zero/endpoints/search_endpoint.rb
index 01cfc56..1e20025 100644
--- a/lib/chef_zero/endpoints/search_endpoint.rb
+++ b/lib/chef_zero/endpoints/search_endpoint.rb
@@ -21,7 +21,7 @@ module ChefZero
def post(request)
orgname = request.rest_path[1]
full_results = search(request, orgname)
- keys = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ keys = FFI_Yajl::Parser.parse(request.body)
partial_results = full_results["rows"].map do |name, uri, doc, search_value|
data = {}
keys.each_pair do |key, path|
@@ -124,7 +124,7 @@ module ChefZero
result = []
list_data(request, container).each do |name|
value = get_data(request, container + [name])
- expanded = expander.call(FFI_Yajl::Parser.parse(value, :create_additions => false), name)
+ expanded = expander.call(FFI_Yajl::Parser.parse(value), name)
result << [ name, build_uri(request.base_uri, container + [name]), expanded, expand_for_indexing(expanded, index, name) ]
end
result = result.select do |name, uri, value, search_value|
diff --git a/lib/chef_zero/endpoints/system_recovery_endpoint.rb b/lib/chef_zero/endpoints/system_recovery_endpoint.rb
index 385101d..0ad2293 100644
--- a/lib/chef_zero/endpoints/system_recovery_endpoint.rb
+++ b/lib/chef_zero/endpoints/system_recovery_endpoint.rb
@@ -6,7 +6,7 @@ module ChefZero
# /system_recovery
class SystemRecoveryEndpoint < RestBase
def post(request)
- request_json = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ request_json = FFI_Yajl::Parser.parse(request.body)
name = request_json["username"]
password = request_json["password"]
user = get_data(request, request.rest_path[0..-2] + ["users", name], :nil)
@@ -14,7 +14,7 @@ module ChefZero
raise RestErrorResponse.new(403, "Nonexistent user")
end
- user = FFI_Yajl::Parser.parse(user, :create_additions => false)
+ user = FFI_Yajl::Parser.parse(user)
user = ChefData::DataNormalizer.normalize_user(user, name, [ "username" ], server.options[:osc_compat])
if !user["recovery_authentication_enabled"]
raise RestErrorResponse.new(403, "Only users with recovery_authentication_enabled=true may use /system_recovery to log in")
diff --git a/lib/chef_zero/endpoints/user_association_request_endpoint.rb b/lib/chef_zero/endpoints/user_association_request_endpoint.rb
index 424557e..9433202 100644
--- a/lib/chef_zero/endpoints/user_association_request_endpoint.rb
+++ b/lib/chef_zero/endpoints/user_association_request_endpoint.rb
@@ -13,11 +13,11 @@ module ChefZero
end
orgname = $1
- json = FFI_Yajl::Parser.parse(request.body, :create_additions => false)
+ json = FFI_Yajl::Parser.parse(request.body)
association_request_path = [ "organizations", orgname, "association_requests", username ]
if json["response"] == "accept"
users = get_data(request, [ "organizations", orgname, "groups", "users" ])
- users = FFI_Yajl::Parser.parse(users, :create_additions => false)
+ users = FFI_Yajl::Parser.parse(users)
delete_data(request, association_request_path)
create_data(request, [ "organizations", orgname, "users" ], username, "{}")
diff --git a/lib/chef_zero/endpoints/user_organizations_endpoint.rb b/lib/chef_zero/endpoints/user_organizations_endpoint.rb
index 03eae68..4e40eb0 100644
--- a/lib/chef_zero/endpoints/user_organizations_endpoint.rb
+++ b/lib/chef_zero/endpoints/user_organizations_endpoint.rb
@@ -12,7 +12,7 @@ module ChefZero
end
result = result.map do |orgname|
org = get_data(request, [ "organizations", orgname, "org" ])
- org = FFI_Yajl::Parser.parse(org, :create_additions => false)
+ org = FFI_Yajl::Parser.parse(org)
{ "organization" => ChefData::DataNormalizer.normalize_organization(org, orgname) }
end
json_response(200, result)
diff --git a/lib/chef_zero/rest_base.rb b/lib/chef_zero/rest_base.rb
index c2bc5ee..976fade 100644
--- a/lib/chef_zero/rest_base.rb
+++ b/lib/chef_zero/rest_base.rb
@@ -285,7 +285,7 @@ module ChefZero
end
def parse_json(json)
- FFI_Yajl::Parser.parse(json, create_additions: false)
+ FFI_Yajl::Parser.parse(json)
end
def to_json(data)