From 0ec934ec780bd4de22ad6a7d756e370578322da9 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 30 Oct 2019 13:39:55 -0700 Subject: [PATCH] Cookstyle 5.10 fixes Signed-off-by: Tim Smith --- attributes/default.rb | 2 +- attributes/executor.rb | 2 +- attributes/master.rb | 2 +- libraries/_executor.rb | 2 +- libraries/_helper.rb | 2 +- libraries/_params_validate.rb | 2 +- libraries/command.rb | 11 +---------- libraries/credentials.rb | 11 +---------- libraries/credentials_file.rb | 1 - libraries/credentials_password.rb | 3 +-- libraries/credentials_private_key.rb | 3 +-- libraries/credentials_secret_text.rb | 2 -- libraries/credentials_user.rb | 1 - libraries/job.rb | 12 +----------- libraries/plugin.rb | 1 - libraries/proxy.rb | 10 +--------- libraries/script.rb | 11 +---------- libraries/slave.rb | 11 +---------- libraries/slave_jnlp.rb | 4 +--- libraries/slave_ssh.rb | 4 +--- libraries/slave_windows.rb | 6 ++---- libraries/user.rb | 12 ++---------- libraries/view.rb | 8 -------- metadata.rb | 4 +--- recipes/_master_package.rb | 2 +- recipes/_master_war.rb | 2 +- recipes/java.rb | 4 ++-- recipes/master.rb | 2 +- .../jenkins_inspec/libraries/jenkins_credentials.rb | 2 +- 29 files changed, 27 insertions(+), 112 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 8439d7254a..1afae2709c 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -8,7 +8,7 @@ # Author: Seth Vargo # # Copyright:: 2010-2016, VMware, Inc. -# Copyright:: 2012-2017, Chef Software, Inc. +# Copyright:: 2012-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/attributes/executor.rb b/attributes/executor.rb index c1e2b0dcea..8c7b535421 100644 --- a/attributes/executor.rb +++ b/attributes/executor.rb @@ -4,7 +4,7 @@ # # Author: Seth Vargo # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/attributes/master.rb b/attributes/master.rb index 360279aa6e..630f14a9fd 100644 --- a/attributes/master.rb +++ b/attributes/master.rb @@ -8,7 +8,7 @@ # Author: Seth Vargo # # Copyright:: 2010-2016, VMware, Inc. -# Copyright:: 2012-2017, Chef Software, Inc. +# Copyright:: 2012-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/_executor.rb b/libraries/_executor.rb index c181f43505..acbce33b1d 100644 --- a/libraries/_executor.rb +++ b/libraries/_executor.rb @@ -4,7 +4,7 @@ # # Author:: Seth Vargo # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/_helper.rb b/libraries/_helper.rb index 1e1aa4177c..440c6d6749 100644 --- a/libraries/_helper.rb +++ b/libraries/_helper.rb @@ -4,7 +4,7 @@ # # Author:: Seth Vargo # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/_params_validate.rb b/libraries/_params_validate.rb index 4c97853cdb..562ed195e8 100644 --- a/libraries/_params_validate.rb +++ b/libraries/_params_validate.rb @@ -4,7 +4,7 @@ # # Author:: Seth Vargo # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/libraries/command.rb b/libraries/command.rb index 7115323fba..882a6a76ba 100644 --- a/libraries/command.rb +++ b/libraries/command.rb @@ -4,7 +4,7 @@ # # Author:: Seth Vargo # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,7 +29,6 @@ class Resource::JenkinsCommand < Resource::LWRPBase identity_attr :command # Actions - actions :execute default_action :execute # Attributes @@ -41,7 +40,6 @@ class Resource::JenkinsCommand < Resource::LWRPBase class Chef class Provider::JenkinsCommand < Provider::LWRPBase - use_inline_resources # ~FC113 include Jenkins::Helper provides :jenkins_command @@ -50,13 +48,6 @@ def load_current_resource @current_resource ||= Resource::JenkinsCommand.new(new_resource.command) end - # - # This provider supports why-run mode. - # - def whyrun_supported? - true - end - action :execute do converge_by("Execute #{new_resource}") do executor.execute!(new_resource.command) diff --git a/libraries/credentials.rb b/libraries/credentials.rb index 4655375bc8..51fba5d7e5 100644 --- a/libraries/credentials.rb +++ b/libraries/credentials.rb @@ -4,7 +4,7 @@ # # Author:: Seth Chisamore # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,7 +35,6 @@ def initialize(name, run_context = nil) end # Actions - actions :create, :delete default_action :create # Attributes @@ -59,7 +58,6 @@ def exists? class Chef class Provider::JenkinsCredentials < Provider::LWRPBase - use_inline_resources # ~FC113 include Jenkins::Helper def load_current_resource @@ -74,13 +72,6 @@ def load_current_resource @current_resource end - # - # This provider supports why-run mode. - # - def whyrun_supported? - true - end - # # Create the given credentials. # diff --git a/libraries/credentials_file.rb b/libraries/credentials_file.rb index e1ab801188..b48ec84ee0 100644 --- a/libraries/credentials_file.rb +++ b/libraries/credentials_file.rb @@ -42,7 +42,6 @@ class Resource::JenkinsFileCredentials < Resource::JenkinsCredentials class Chef class Provider::JenkinsFileCredentials < Provider::JenkinsCredentials - use_inline_resources include Jenkins::Helper provides :jenkins_file_credentials diff --git a/libraries/credentials_password.rb b/libraries/credentials_password.rb index b06c9eddf8..6c6bad373b 100644 --- a/libraries/credentials_password.rb +++ b/libraries/credentials_password.rb @@ -4,7 +4,7 @@ # # Author:: Seth Chisamore # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -38,7 +38,6 @@ class Resource::JenkinsPasswordCredentials < Resource::JenkinsUserCredentials class Chef class Provider::JenkinsPasswordCredentials < Provider::JenkinsUserCredentials - use_inline_resources # ~FC113 provides :jenkins_password_credentials def load_current_resource diff --git a/libraries/credentials_private_key.rb b/libraries/credentials_private_key.rb index c6c4dc3ecf..754a98eb5b 100644 --- a/libraries/credentials_private_key.rb +++ b/libraries/credentials_private_key.rb @@ -4,7 +4,7 @@ # # Author:: Seth Chisamore # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,7 +71,6 @@ def pem_private_key class Chef class Provider::JenkinsPrivateKeyCredentials < Provider::JenkinsUserCredentials - use_inline_resources # ~FC113 provides :jenkins_private_key_credentials def load_current_resource diff --git a/libraries/credentials_secret_text.rb b/libraries/credentials_secret_text.rb index 9822a15d24..34c613b97f 100644 --- a/libraries/credentials_secret_text.rb +++ b/libraries/credentials_secret_text.rb @@ -40,8 +40,6 @@ class Resource::JenkinsSecretTextCredentials < Resource::JenkinsCredentials class Chef class Provider::JenkinsSecretTextCredentials < Provider::JenkinsCredentials - use_inline_resources # ~FC113 - provides :jenkins_secret_text_credentials def load_current_resource diff --git a/libraries/credentials_user.rb b/libraries/credentials_user.rb index 5d6763070a..682acad749 100644 --- a/libraries/credentials_user.rb +++ b/libraries/credentials_user.rb @@ -33,7 +33,6 @@ class Resource::JenkinsUserCredentials < Resource::JenkinsCredentials class Chef class Provider::JenkinsUserCredentials < Provider::JenkinsCredentials - use_inline_resources # ~FC113 include Jenkins::Helper def load_current_resource diff --git a/libraries/job.rb b/libraries/job.rb index 2801325b99..e7e0803915 100644 --- a/libraries/job.rb +++ b/libraries/job.rb @@ -4,7 +4,7 @@ # # Author:: Seth Vargo # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ class Resource::JenkinsJob < Resource::LWRPBase identity_attr :name # Actions - actions :build, :create, :delete, :disable, :enable default_action :create # Attributes @@ -78,8 +77,6 @@ def enabled? class Chef class Provider::JenkinsJob < Provider::LWRPBase - use_inline_resources # ~FC113 - include Jenkins::Helper provides :jenkins_job @@ -112,13 +109,6 @@ def load_current_resource @current_resource end - # - # This provider supports why-run mode. - # - def whyrun_supported? - true - end - # # Executes a Jenkins job. # diff --git a/libraries/plugin.rb b/libraries/plugin.rb index ebcff4eb66..aa8a1d7736 100644 --- a/libraries/plugin.rb +++ b/libraries/plugin.rb @@ -32,7 +32,6 @@ class Resource::JenkinsPlugin < Resource::LWRPBase identity_attr :name # Actions - actions :install, :uninstall, :enable, :disable default_action :install # Attributes diff --git a/libraries/proxy.rb b/libraries/proxy.rb index 6cb105a535..bdbd56f97c 100644 --- a/libraries/proxy.rb +++ b/libraries/proxy.rb @@ -4,7 +4,7 @@ # # Author:: Stephan Linz # -# Copyright 2014, Li-Pro.Net +# Copyright:: 2014-2019, Li-Pro.Net # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ class Resource::JenkinsProxy < Resource::LWRPBase identity_attr :proxy # Actions - actions :config, :remove default_action :config # Attributes @@ -75,13 +74,6 @@ def load_current_resource @current_resource end - # - # This provider supports why-run mode. - # - def whyrun_supported? - true - end - action(:config) do if current_resource.configured? && current_resource.proxy == new_resource.proxy && diff --git a/libraries/script.rb b/libraries/script.rb index 3bd9575b25..034b735057 100644 --- a/libraries/script.rb +++ b/libraries/script.rb @@ -4,7 +4,7 @@ # # Author:: Seth Vargo # -# Copyright:: 2014-2017, Chef Software, Inc. +# Copyright:: 2014-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,14 +37,12 @@ class Resource::JenkinsScript < Resource::JenkinsCommand required: false # Actions - actions :execute default_action :execute end end class Chef class Provider::JenkinsScript < Provider::JenkinsCommand - use_inline_resources # ~FC113 provides :jenkins_script def load_current_resource @@ -58,13 +56,6 @@ def load_current_resource super end - # - # This provider supports why-run mode. - # - def whyrun_supported? - true - end - action :execute do converge_by("Execute script #{new_resource}") do if new_resource.groovy_path diff --git a/libraries/slave.rb b/libraries/slave.rb index cb7ecef31c..813baaf70e 100644 --- a/libraries/slave.rb +++ b/libraries/slave.rb @@ -4,7 +4,7 @@ # # Author:: Seth Chisamore # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ class Resource::JenkinsSlave < Resource::LWRPBase identity_attr :slave_name # Actions - actions :create, :delete, :connect, :disconnect, :online, :offline default_action :create # Attributes @@ -115,7 +114,6 @@ def online? class Chef class Provider::JenkinsSlave < Provider::LWRPBase provides :jenkins_slave - use_inline_resources # ~FC113 include Jenkins::Helper @@ -139,13 +137,6 @@ def load_current_resource @current_resource end - # - # This provider supports why-run mode. - # - def whyrun_supported? - true - end - action :create do do_create end diff --git a/libraries/slave_jnlp.rb b/libraries/slave_jnlp.rb index 7aae896d56..cc52ccae1b 100644 --- a/libraries/slave_jnlp.rb +++ b/libraries/slave_jnlp.rb @@ -4,7 +4,7 @@ # # Author:: Seth Chisamore # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ class Resource::JenkinsJnlpSlave < Resource::JenkinsSlave resource_name :jenkins_jnlp_slave # Actions - actions :create, :delete, :connect, :disconnect, :online, :offline default_action :create # Attributes @@ -45,7 +44,6 @@ class Resource::JenkinsJnlpSlave < Resource::JenkinsSlave class Chef class Provider::JenkinsJnlpSlave < Provider::JenkinsSlave - use_inline_resources # ~FC113 provides :jenkins_jnlp_slave def load_current_resource diff --git a/libraries/slave_ssh.rb b/libraries/slave_ssh.rb index 4b9fd983b2..80fdf2694b 100644 --- a/libraries/slave_ssh.rb +++ b/libraries/slave_ssh.rb @@ -4,7 +4,7 @@ # # Author:: Seth Chisamore # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ class Resource::JenkinsSshSlave < Resource::JenkinsSlave resource_name :jenkins_ssh_slave # Actions - actions :create, :delete, :connect, :disconnect, :online, :offline default_action :create # Attributes @@ -71,7 +70,6 @@ def parsed_credentials class Chef class Provider::JenkinsSshSlave < Provider::JenkinsSlave - use_inline_resources # ~FC113 provides :jenkins_ssh_slave def load_current_resource diff --git a/libraries/slave_windows.rb b/libraries/slave_windows.rb index 7a76093551..479d688a85 100644 --- a/libraries/slave_windows.rb +++ b/libraries/slave_windows.rb @@ -4,7 +4,7 @@ # # Author:: Seth Chisamore # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ class Resource::JenkinsWindowsSlave < Resource::JenkinsJnlpSlave resource_name :jenkins_windows_slave # Actions - actions :create, :delete, :connect, :disconnect, :online, :offline default_action :create # Attributes @@ -55,7 +54,6 @@ class Resource::JenkinsWindowsSlave < Resource::JenkinsJnlpSlave class Chef class Provider::JenkinsWindowsSlave < Provider::JenkinsJnlpSlave - use_inline_resources # ~FC113 provides :jenkins_windows_slave, platform: %w(windows) def load_current_resource @@ -76,7 +74,7 @@ def load_current_resource # # The jenkins-slave.exe is needed to get the slave up and running under a windows service. - # However, once it is created Jenkins Master wants to control the version. So we should only + # However, once it is created Jenkins Master wants to control the version. So we should only # create the file if it is missing. slave_exe_resource.run_action(:create_if_missing) slave_jar_resource.run_action(:create) diff --git a/libraries/user.rb b/libraries/user.rb index 8d4558ecce..855ecd505a 100644 --- a/libraries/user.rb +++ b/libraries/user.rb @@ -4,7 +4,7 @@ # # Author:: Seth Vargo # -# Copyright:: 2013-2017, Chef Software, Inc. +# Copyright:: 2013-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ class Resource::JenkinsUser < Resource::LWRPBase identity_attr :id # Actions - actions :create, :delete default_action :create # Attributes @@ -65,7 +64,7 @@ def exists? class Chef class Provider::JenkinsUser < Provider::LWRPBase provides :jenkins_user - use_inline_resources # ~FC113 + include Jenkins::Helper provides :jenkins_user @@ -83,13 +82,6 @@ def load_current_resource @current_resource end - # - # This provider supports why-run mode. - # - def whyrun_supported? - true - end - action :create do if current_resource.exists? && (new_resource.full_name.nil? || current_resource.full_name == new_resource.full_name) && diff --git a/libraries/view.rb b/libraries/view.rb index 9535eed736..4a629e3c7b 100644 --- a/libraries/view.rb +++ b/libraries/view.rb @@ -28,7 +28,6 @@ class Resource::JenkinsView < Resource::LWRPBase identity_attr :name # Actions - actions :create, :delete default_action :create # Attributes @@ -85,13 +84,6 @@ def load_current_resource @current_resource end - # - # This provider supports why-run mode. - # - def whyrun_supported? - true - end - # # Idempotently create a new Jenkins view with the current resource's name # and given configuration. If the view already exists, update it. If the diff --git a/metadata.rb b/metadata.rb index 842a8a3547..6b2a77bbfa 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,10 +3,8 @@ maintainer_email 'cookbooks@chef.io' license 'Apache-2.0' description 'Installs and configures Jenkins CI master & slaves' -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '7.0.0' -recipe 'jenkins::master', 'Installs a Jenkins master' +version '7.0.0' %w(ubuntu debian redhat centos scientific oracle amazon).each do |os| supports os diff --git a/recipes/_master_package.rb b/recipes/_master_package.rb index 90330000b4..7afbc6fcd1 100644 --- a/recipes/_master_package.rb +++ b/recipes/_master_package.rb @@ -6,7 +6,7 @@ # Author: Seth Vargo # # Copyright:: 2013-2016, Youscribe -# Copyright:: 2014-2017, Chef Software, Inc. +# Copyright:: 2014-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recipes/_master_war.rb b/recipes/_master_war.rb index 2c7ac1320c..056aa00bdc 100644 --- a/recipes/_master_war.rb +++ b/recipes/_master_war.rb @@ -9,7 +9,7 @@ # Author: Seth Vargo # # Copyright:: 2010-2016, VMware, Inc. -# Copyright:: 2012-2017, Chef Software, Inc. +# Copyright:: 2012-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recipes/java.rb b/recipes/java.rb index 49cecbc66a..d53db9437e 100644 --- a/recipes/java.rb +++ b/recipes/java.rb @@ -4,7 +4,7 @@ # # Author: Seth Vargo # -# Copyright:: 2014-2017, Chef Software, Inc. +# Copyright:: 2014-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ case node['platform_family'] when 'debian' - if node['platform'] == 'ubuntu' && Chef::VersionConstraint.new('>= 15.10').include?(node['platform_version']) + if platform?('ubuntu') && Chef::VersionConstraint.new('>= 15.10').include?(node['platform_version']) package 'openjdk-8-jdk' else package 'openjdk-7-jdk' diff --git a/recipes/master.rb b/recipes/master.rb index 2f2801dbd0..cd9133cbec 100644 --- a/recipes/master.rb +++ b/recipes/master.rb @@ -11,7 +11,7 @@ # # Copyright:: 2010-2016, VMWare, Inc. # Copyright:: 2013-2016, Youscribe. -# Copyright:: 2012-2017, Chef Software, Inc. +# Copyright:: 2012-2019, Chef Software, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test/integration/helpers/jenkins_inspec/libraries/jenkins_credentials.rb b/test/integration/helpers/jenkins_inspec/libraries/jenkins_credentials.rb index 155f4e8040..1c62822987 100644 --- a/test/integration/helpers/jenkins_inspec/libraries/jenkins_credentials.rb +++ b/test/integration/helpers/jenkins_inspec/libraries/jenkins_credentials.rb @@ -45,7 +45,7 @@ def try(&_block) end end -# rubocop:disable PredicateName +# rubocop:disable Naming/PredicateName class JenkinsUserCredentials < JenkinsCredentials attr_reader :username