diff options
-rw-r--r-- | .rubocop.yml | 7 | ||||
-rw-r--r-- | lib/chef_zero/chef_data/default_creator.rb | 28 | ||||
-rw-r--r-- | lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb | 8 | ||||
-rw-r--r-- | lib/chef_zero/endpoints/cookbooks_base.rb | 2 |
4 files changed, 24 insertions, 21 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 5b837e2..f0f0459 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,2 +1,5 @@ -Style/HashSyntax: - Enabled: true +# Feel free to correct anything in this file + +Lint/UselessAccessModifier: + Exclude: + - 'lib/chef_zero/chef_data/acl_path.rb' diff --git a/lib/chef_zero/chef_data/default_creator.rb b/lib/chef_zero/chef_data/default_creator.rb index 0b155f2..5f6cf8b 100644 --- a/lib/chef_zero/chef_data/default_creator.rb +++ b/lib/chef_zero/chef_data/default_creator.rb @@ -278,10 +278,10 @@ module ChefZero when "root", "containers/containers", "containers/groups" { "create" => { "groups" => %w{admins} }, - "read" => { "groups" => %w{admins users} }, + "read" => { "groups" => %w{admins users} }, "update" => { "groups" => %w{admins} }, "delete" => { "groups" => %w{admins} }, - "grant" => { "groups" => %w{admins} }, + "grant" => { "groups" => %w{admins} }, } when "containers/environments", "containers/roles", "containers/policy_groups", "containers/policies", @@ -289,50 +289,50 @@ module ChefZero "containers/data" { "create" => { "groups" => %w{admins users} }, - "read" => { "groups" => %w{admins users clients} }, + "read" => { "groups" => %w{admins users clients} }, "update" => { "groups" => %w{admins users} }, "delete" => { "groups" => %w{admins users} }, - "grant" => { "groups" => %w{admins} }, + "grant" => { "groups" => %w{admins} }, } when "containers/nodes" { "create" => { "groups" => %w{admins users clients} }, - "read" => { "groups" => %w{admins users clients} }, + "read" => { "groups" => %w{admins users clients} }, "update" => { "groups" => %w{admins users} }, "delete" => { "groups" => %w{admins users} }, - "grant" => { "groups" => %w{admins} }, + "grant" => { "groups" => %w{admins} }, } when "containers/clients" { "create" => { "groups" => %w{admins} }, - "read" => { "groups" => %w{admins users} }, + "read" => { "groups" => %w{admins users} }, "update" => { "groups" => %w{admins} }, "delete" => { "groups" => %w{admins users} }, - "grant" => { "groups" => %w{admins} }, + "grant" => { "groups" => %w{admins} }, } when "containers/sandboxes" { "create" => { "groups" => %w{admins users} }, - "read" => { "groups" => %w{admins} }, + "read" => { "groups" => %w{admins} }, "update" => { "groups" => %w{admins} }, "delete" => { "groups" => %w{admins} }, - "grant" => { "groups" => %w{admins} }, + "grant" => { "groups" => %w{admins} }, } when "groups/admins", "groups/clients", "groups/users" { "create" => { "groups" => %w{admins} }, - "read" => { "groups" => %w{admins} }, + "read" => { "groups" => %w{admins} }, "update" => { "groups" => %w{admins} }, "delete" => { "groups" => %w{admins} }, - "grant" => { "groups" => %w{admins} }, + "grant" => { "groups" => %w{admins} }, } when "groups/billing-admins" { "create" => { "groups" => %w{} }, - "read" => { "groups" => %w{billing-admins} }, + "read" => { "groups" => %w{billing-admins} }, "update" => { "groups" => %w{billing-admins} }, "delete" => { "groups" => %w{} }, - "grant" => { "groups" => %w{} }, + "grant" => { "groups" => %w{} }, } else {} diff --git a/lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb b/lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb index bfe2ff5..358637e 100644 --- a/lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb +++ b/lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb @@ -9,10 +9,10 @@ module ChefZero artifacts = begin list_data(request) - rescue Exception => e - if e.response_code == 404 - return already_json_response(200, "{}") - end + rescue Exception => e + if e.response_code == 404 + return already_json_response(200, "{}") + end end artifacts.each do |cookbook_artifact| diff --git a/lib/chef_zero/endpoints/cookbooks_base.rb b/lib/chef_zero/endpoints/cookbooks_base.rb index d8af80a..e515992 100644 --- a/lib/chef_zero/endpoints/cookbooks_base.rb +++ b/lib/chef_zero/endpoints/cookbooks_base.rb @@ -52,7 +52,7 @@ module ChefZero cookbooks_list.keys.sort.each do |name| constraint = Gem::Requirement.new(constraints[name]) versions = [] - cookbooks_list[name].sort_by { |version| Gem::Version.new(version.dup) }.reverse.each do |version| + cookbooks_list[name].sort_by { |version| Gem::Version.new(version.dup) }.reverse_each do |version| break if num_versions && versions.size >= num_versions if constraint.satisfied_by?(Gem::Version.new(version.dup)) versions << version |