diff --git a/src/oc-id/app/controllers/profiles_controller.rb b/src/oc-id/app/controllers/profiles_controller.rb index cc51c2dc45..656f4d6502 100644 --- a/src/oc-id/app/controllers/profiles_controller.rb +++ b/src/oc-id/app/controllers/profiles_controller.rb @@ -96,12 +96,15 @@ def regen_key private - def goto_forbidden(message, *args) + def goto_forbidden(message, **args) if signed_in? - flash.now[:alert] = I18n.t(message, *args) + # The I18n.t method uses keyword arguments. + # There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0 + # The "hash" parameter must be passed as keyword argument. + flash.now[:alert] = I18n.t(message, **args) render 'show', status: :forbidden else - redirect_to signin_path, notice: I18n.t(message, *args) + redirect_to signin_path, notice: I18n.t(message, **args) end end diff --git a/src/oc-id/lib/chef/web/core/asset_helpers.rb b/src/oc-id/lib/chef/web/core/asset_helpers.rb index d423aff7d4..5d4135ca4b 100644 --- a/src/oc-id/lib/chef/web/core/asset_helpers.rb +++ b/src/oc-id/lib/chef/web/core/asset_helpers.rb @@ -21,12 +21,12 @@ def chef_logo(element = :div, opts = {}) if opts[:data][:'tag-line'] opts[:svg].css('#chef-logo-tag-line text').first.content = opts[:data][:'tag-line'] end - - attrs = opts[:attributes].map { |k, v| %(#{k}="#{v}") } - attrs << opts[:data].map { |k, v| %(data-#{k}="#{v}") } + + attrs = opts[:attributes].map { |k, v| %Q(#{k}="#{v}") } + attrs << opts[:data].map { |k, v| %Q(data-#{k}="#{v}") } opts[:attributes] = attrs.join(' ') - Chef::Web::Core::Component.new(opts.merge!(element:, type: 'logo')).render + Chef::Web::Core::Component.new(opts.merge!(:element => element, :type => 'logo')).render end end end diff --git a/src/oc-id/lib/health_check.rb b/src/oc-id/lib/health_check.rb index ab1ceb288a..5e02e8fa40 100644 --- a/src/oc-id/lib/health_check.rb +++ b/src/oc-id/lib/health_check.rb @@ -3,13 +3,13 @@ class HealthCheck include ChefResource - OK = 'ok' - NOT_OK = 'not ok' - REACHABLE = 'reachable' - TIMEOUT = 'timeout' - UNREACHABLE = 'unreachable' - ERRORING = 'erroring' - AUTHERROR = 'authentication error' + OK = 'ok'.freeze + NOT_OK = 'not ok'.freeze + REACHABLE = 'reachable'.freeze + TIMEOUT = 'timeout'.freeze + UNREACHABLE = 'unreachable'.freeze + ERRORING = 'erroring'.freeze + AUTHERROR = 'authentication error'.freeze attr_reader :status, :erchef, :postgres diff --git a/src/oc-id/lib/zendesk_sso_url.rb b/src/oc-id/lib/zendesk_sso_url.rb index 7522ff4b2c..60abc8c519 100644 --- a/src/oc-id/lib/zendesk_sso_url.rb +++ b/src/oc-id/lib/zendesk_sso_url.rb @@ -5,7 +5,7 @@ require 'securerandom' require 'uri' -class ZendeskSsoUrl +class ZendeskSSOURL attr_reader :user, :return_to, :settings def initialize(user, return_to, settings) @@ -16,9 +16,9 @@ def initialize(user, return_to, settings) def to_s URI::HTTPS.build( - host:, - path:, - query: query_hash.to_query + host: host, + path: path, + query: query_hash.to_query, ).to_s end @@ -38,11 +38,11 @@ def payload jti = "#{iat}/#{SecureRandom.hex(18)}" JWT.encode({ - iat:, - jti:, - name: [user.first_name, user.last_name].compact.join(' '), - email: user.email - }, settings.shared_secret) + iat: iat, + jti: jti, + name: [user.first_name, user.last_name].compact.join(' '), + email: user.email, + }, settings.shared_secret) end def query_hash @@ -50,4 +50,4 @@ def query_hash q[:return_to] = CGI.escape(return_to) if return_to.present? q end -end +end \ No newline at end of file