Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve all cookstyle warnings #541

Merged
merged 12 commits into from
Dec 10, 2019
Merged

Resolve all cookstyle warnings #541

merged 12 commits into from
Dec 10, 2019

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented Dec 10, 2019

There was some very funky stuff going on in this cookbook and a lot of code that could be removed. This resolves all the current Cookstyle warnings with cookstyle on the master branch.

This is unused and there's no point in including it here

Signed-off-by: Tim Smith <tsmith@chef.io>
opensuse has been replaced by opensuseleap which is 42 and 15. There's no support opensuse distro that's supported now

Signed-off-by: Tim Smith <tsmith@chef.io>
ChefSpec generates these automatically now

Signed-off-by: Tim Smith <tsmith@chef.io>
Chef does this for you already

Signed-off-by: Tim Smith <tsmith@chef.io>
This is the default in Chef 13 now and it's an empty method in the chef codebase

Signed-off-by: Tim Smith <tsmith@chef.io>
These were not platform families

Signed-off-by: Tim Smith <tsmith@chef.io>
These were all platforms not platform families

Signed-off-by: Tim Smith <tsmith@chef.io>
Signed-off-by: Tim Smith <tsmith@chef.io>
node.normal doesn't make sense here

Signed-off-by: Tim Smith <tsmith@chef.io>
Signed-off-by: Tim Smith <tsmith@chef.io>
This makes it more clear what you're actually trying to set since 0755 is 755 in ruby land

Signed-off-by: Tim Smith <tsmith@chef.io>
Signed-off-by: Tim Smith <tsmith@chef.io>
@michaelklishin
Copy link
Member

Thank you. Any chance you can also submit a version of this for v5.x?

@@ -17,8 +17,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

actions :add, :delete, :set_permissions, :clear_permissions, :set_tags, :clear_tags, :change_password
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line's removal leads to Kitchen failures:

================================================================================
Recipe Compile Error in /opt/kitchen/cache/cookbooks/rabbitmq/recipes/users.rb
================================================================================

Chef::Exceptions::ValidationFailed
----------------------------------
Option action must be equal to one of: :nothing, :add!  You passed :set_tags.

Cookbook Trace:
---------------
  /opt/kitchen/cache/cookbooks/rabbitmq/recipes/users.rb:38:in `block (2 levels) in from_file'
  /opt/kitchen/cache/cookbooks/rabbitmq/recipes/users.rb:35:in `block in from_file'
  /opt/kitchen/cache/cookbooks/rabbitmq/recipes/users.rb:27:in `each'
  /opt/kitchen/cache/cookbooks/rabbitmq/recipes/users.rb:27:in `from_file'

Relevant File Content:
----------------------
/opt/kitchen/cache/cookbooks/rabbitmq/recipes/users.rb:

 31:      action :add
 32:
 33:      notifies :set_tags, "rabbitmq_user[set-tags-#{user['name']}]", :immediately
 34:    end
 35:    rabbitmq_user "set-tags-#{user['name']}" do
 36:      user user['name']
 37:      tag user['tag']
 38>>     action :set_tags
 39:    end
 40:    user['rights'].each do |r|
 41:      rabbitmq_user "set-perms-#{user['name']}-vhost-#{Array(r['vhost']).join().tr('/', '_')}" do
 42:        user user['name']
 43:        vhost r['vhost']
 44:        permissions "#{r['conf']} #{r['write']} #{r['read']}"
 45:        action :set_permissions
 46:      end
 47:    end

System Info:
------------
chef_version=15.5.17
platform=ubuntu
platform_version=16.04
ruby=ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
program_name=/opt/chef/embedded/bin/chef-client
executable=/opt/chef/embedded/bin/chef-client

@michaelklishin michaelklishin merged commit 7d67691 into rabbitmq:master Dec 10, 2019
@michaelklishin
Copy link
Member

I restored resource actions and tests started passing. Thank you. Would be great to have a version of this (with my patch) for v5.x.

@tas50
Copy link
Contributor Author

tas50 commented Dec 10, 2019

Yep it looks like we need to keep the actions for LWRPs after all. That was the original behavior in cookstyle and I've reverted it here: chef/cookstyle#436

@michaelklishin
Copy link
Member

Cherry-picked to v5.x.

@michaelklishin michaelklishin added this to the 5.8.5 milestone Jul 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants