summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-01-18 09:07:13 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-01-18 09:07:13 -0800
commitccf46bf3055b2a1c06499ec104f3d74c26643395 (patch)
tree6c94e4c86276c998b68b8c352ca1be0b69f670a1
parent808fe8b34254c2747d333205f7f7cdb4224cf8aa (diff)
downloadchef-ccf46bf3055b2a1c06499ec104f3d74c26643395.tar.gz
another chefstyle catchup + pull master
bunch of merges over the weekend need re-fixing again. seems like pointing at master of chefstyle is probably a good idea to start making people fix their code before merging.
-rw-r--r--Gemfile35
-rw-r--r--lib/chef/chef_fs/chef_fs_data_store.rb14
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb10
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb2
-rw-r--r--spec/integration/knife/download_spec.rb4
-rw-r--r--spec/integration/knife/upload_spec.rb4
8 files changed, 37 insertions, 38 deletions
diff --git a/Gemfile b/Gemfile
index cacfa3096c..4809c65216 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,9 +1,9 @@
source "https://rubygems.org"
-gemspec :name => "chef"
+gemspec name: "chef"
-gem "activesupport", "< 4.0.0", :group => :compat_testing, :platform => "ruby"
+gem "activesupport", "< 4.0.0", group: :compat_testing, platform: "ruby"
-gem "chef-config", path: "chef-config" if File.exists?(__FILE__ + "../chef-config")
+gem "chef-config", path: "chef-config" if File.exist?(__FILE__ + "../chef-config")
group(:docgen) do
gem "yard"
@@ -23,32 +23,31 @@ group(:ruby_prof) do
end
group(:development, :test) do
-
gem "simplecov"
gem "rack", "~> 1.5.1"
# for testing new chefstyle rules
# gem 'chefstyle', github: 'chef/chefstyle'
- gem "chefstyle"
+ gem "chefstyle", github: "chef/chefstyle", branch: "master"
- gem "ruby-shadow", :platforms => :ruby unless RUBY_PLATFORM.downcase.match(/(aix|cygwin)/)
+ gem "ruby-shadow", platforms: :ruby unless RUBY_PLATFORM.downcase.match(/(aix|cygwin)/)
# For external tests
-# gem 'chef-zero', github: 'chef/chef-zero'
-# gem 'cheffish', github: 'chef/cheffish'
-# gem 'chef-provisioning'#, github: 'chef/chef-provisioning'
-# gem 'chef-provisioning-aws', github: 'chef/chef-provisioning-aws'
-# gem 'test-kitchen'
-# gem 'chefspec'
-# gem 'chef-sugar'
-# gem 'poise', github: 'poise/poise', branch: 'deeecb890a6a0bc2037dfb09ce0fd0a8931519aa'
-# gem 'halite', github: 'poise/halite'
-# gem 'foodcritic', github: 'acrmp/foodcritic', branch: 'v5.0.0'
-# gem 'chef-rewind'
+ # gem 'chef-zero', github: 'chef/chef-zero'
+ # gem 'cheffish', github: 'chef/cheffish'
+ # gem 'chef-provisioning'#, github: 'chef/chef-provisioning'
+ # gem 'chef-provisioning-aws', github: 'chef/chef-provisioning-aws'
+ # gem 'test-kitchen'
+ # gem 'chefspec'
+ # gem 'chef-sugar'
+ # gem 'poise', github: 'poise/poise', branch: 'deeecb890a6a0bc2037dfb09ce0fd0a8931519aa'
+ # gem 'halite', github: 'poise/halite'
+ # gem 'foodcritic', github: 'acrmp/foodcritic', branch: 'v5.0.0'
+ # gem 'chef-rewind'
end
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
# If you want to load debugging tools into the bundle exec sandbox,
# add these additional dependencies into chef/Gemfile.local
-eval(IO.read(__FILE__ + ".local"), binding) if File.exists?(__FILE__ + ".local")
+eval(IO.read(__FILE__ + ".local"), binding) if File.exist?(__FILE__ + ".local")
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb
index 37f30dde45..6b5bdc62a0 100644
--- a/lib/chef/chef_fs/chef_fs_data_store.rb
+++ b/lib/chef/chef_fs/chef_fs_data_store.rb
@@ -322,8 +322,8 @@ class Chef
result.delete_if do |key,value|
(value == [] && key != "recipes")
end
- result['metadata'] = result['metadata'].to_hash
- result['metadata'].delete_if do |key,value|
+ result["metadata"] = result["metadata"].to_hash
+ result["metadata"].delete_if do |key,value|
value == [] ||
(value == {} && !%w(dependencies attributes recipes).include?(key)) ||
(value == "" && %w(source_url issues_url).include?(key)) ||
@@ -444,7 +444,7 @@ class Chef
found_policy = false
policies.children.each do |policy|
# We want to delete just the ones that == POLICY
- next unless policy.name.rpartition('-')[0] == path[1]
+ next unless policy.name.rpartition("-")[0] == path[1]
policy.delete(false)
found_policy = true
end
@@ -469,7 +469,7 @@ class Chef
# LIST /policies
elsif path == [ "policies" ]
with_entry([ path[0] ]) do |policies|
- policies.children.map { |policy| policy.name[0..-6].rpartition('-')[0] }.uniq
+ policies.children.map { |policy| policy.name[0..-6].rpartition("-")[0] }.uniq
end
# LIST /policies/POLICY/revisions
@@ -481,7 +481,7 @@ class Chef
# - b-2.0.0.json
revisions = []
policies.children.each do |policy|
- name, dash, revision = policy.name[0..-6].rpartition('-')
+ name, dash, revision = policy.name[0..-6].rpartition("-")
revisions << revision if name == path[1]
end
raise ChefZero::DataStore::DataNotFoundError.new(path) if revisions.empty?
@@ -503,7 +503,7 @@ class Chef
with_entry(path) do |entry|
begin
if path[0] == "cookbook_artifacts"
- entry.children.map { |child| child.name.rpartition('-')[0] }.uniq
+ entry.children.map { |child| child.name.rpartition("-")[0] }.uniq
elsif chef_fs.versioned_cookbooks
# /cookbooks/name-version -> /cookbooks/name
entry.children.map { |child| split_name_version(child.name)[0] }.uniq
@@ -725,7 +725,7 @@ class Chef
# /policies/NAME-REVISION.json -> /policies/NAME/revisions/REVISION
elsif path[0] == "policies"
if path.length >= 2
- name, dash, revision = path[1][0..-6].rpartition('-')
+ name, dash, revision = path[1][0..-6].rpartition("-")
path = [ "policies", name, "revisions", revision ]
end
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb
index ff3cde51a8..197e412810 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifact_dir.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/cookbook_dir'
+require "chef/chef_fs/file_system/chef_server/cookbook_dir"
class Chef
module ChefFS
@@ -25,7 +25,7 @@ class Chef
class CookbookArtifactDir < CookbookDir
def initialize(name, parent, options = {})
super(name, parent)
- @cookbook_name, dash, @version = name.rpartition('-')
+ @cookbook_name, dash, @version = name.rpartition("-")
end
def copy_from(other, options = {})
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb
index b001c28dc4..9dbd3fea4d 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_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/cookbook_artifact_dir'
+require "chef/chef_fs/file_system/chef_server/cookbooks_dir"
+require "chef/chef_fs/file_system/chef_server/cookbook_artifact_dir"
class Chef
module ChefFS
@@ -43,7 +43,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 << CookbookArtifactDir.new("#{cookbook_name}-#{cookbook_version['identifier']}", self)
end
end
@@ -56,7 +56,7 @@ class Chef
# to make this work. So instead, we make a temporary cookbook
# symlinking back to real cookbook, and upload the proxy.
def upload_cookbook(other, options)
- cookbook_name, dash, identifier = other.name.rpartition('-')
+ cookbook_name, dash, identifier = other.name.rpartition("-")
Dir.mktmpdir do |temp_cookbooks_path|
proxy_cookbook_path = "#{temp_cookbooks_path}/#{cookbook_name}"
@@ -93,7 +93,7 @@ class Chef
end
def can_have_child?(name, is_dir)
- is_dir && name.include?('-')
+ is_dir && name.include?("-")
end
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb
index da9d74a1df..dbff973f17 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb
@@ -26,7 +26,7 @@ class Chef
# Override from parent
def cookbook_version
loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, parent.chefignore)
- cookbook_name, dash, identifier = name.rpartition('-')
+ cookbook_name, dash, identifier = name.rpartition("-")
# KLUDGE: We shouldn't have to use instance_variable_set
loader.instance_variable_set(:@cookbook_name, cookbook_name)
loader.load_cookbooks
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 a3a3dfc6b9..df06f6d2e8 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
@@ -170,7 +170,7 @@ class Chef
else
dirs = paths.map { |path| ChefRepositoryFileSystemCookbooksDir.new(name, self, path) }
end
- when 'cookbook_artifacts'
+ when "cookbook_artifacts"
dirs = paths.map { |path| ChefRepositoryFileSystemCookbookArtifactsDir.new(name, self, path) }
when "policies"
dirs = paths.map { |path| ChefRepositoryFileSystemPoliciesDir.new(name, self, path) }
diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb
index 57229b915a..86f1d9f4a4 100644
--- a/spec/integration/knife/download_spec.rb
+++ b/spec/integration/knife/download_spec.rb
@@ -1186,7 +1186,7 @@ EOM
policy_group "x", {
"policies" => {
"x" => { "revision_id" => "1.0.0" },
- "blah" => { "revision_id" => "1.0.0" }
+ "blah" => { "revision_id" => "1.0.0" },
}
}
role "x", {}
@@ -1273,7 +1273,7 @@ EOM
file "policy_groups/x.json", {
"policies" => {
"x" => { "revision_id" => "1.0.1" },
- "y" => { "revision_id" => "1.0.0" }
+ "y" => { "revision_id" => "1.0.0" },
}
}
file "roles/x.json", { "run_list" => [ "blah" ] }
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb
index 6ef40a1d98..afedf97459 100644
--- a/spec/integration/knife/upload_spec.rb
+++ b/spec/integration/knife/upload_spec.rb
@@ -1349,7 +1349,7 @@ EOM
policy_group "x", {
"policies" => {
"x" => { "revision_id" => "1.0.0" },
- "blah" => { "revision_id" => "1.0.0" }
+ "blah" => { "revision_id" => "1.0.0" },
}
}
role "x", {}
@@ -1403,7 +1403,7 @@ EOM
policy_group "x", {
"policies" => {
"x" => { "revision_id" => "1.0.1" },
- "y" => { "revision_id" => "1.0.0" }
+ "y" => { "revision_id" => "1.0.0" },
}
}
role "x", { "run_list" => [ "blah" ] }