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

Ruby 3 preparation #4092

Merged
merged 5 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/channels/deploy_notifications_channel.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class DeployNotificationsChannel < ActionCable::Channel::Base
def self.broadcast(count)
ActionCable.server.broadcast channel_name, count: count
ActionCable.server.broadcast(channel_name, {count: count})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The message sent via the the ActionCable::Server::Broadcasting#broadcast method is a Hash.

Explicitly send a hash in this method call.

end

# called when using javascript App.cable.subscriptions.create
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/csv_exports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def new
case params[:type]
when "users"
options = user_filter
send_data UserCsvPresenter.to_csv(options), type: :csv, filename: "Users_#{options[:datetime]}.csv"
send_data UserCsvPresenter.to_csv(**options), type: :csv, filename: "Users_#{options[:datetime]}.csv"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The UserCsvPresenter.to_csv method accepts keyword arguments. Update this method call to match.

def self.to_csv(
inherited: false, deleted: false, project_id: nil, user_id: nil, datetime: (Time.now.strftime "%Y%m%d_%H%M")
)

when "deploy_group_usage"
date_time_now = Time.now.strftime "%Y%m%d_%H%M"
send_data DeployGroupUsageCsvPresenter.to_csv, type: :csv, filename: "DeployGroupUsage_#{date_time_now}.csv"
Expand Down
13 changes: 6 additions & 7 deletions lib/samson/secrets/vault_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ def sync!(other)

def create_client
VaultClientWrapper.new(
DEFAULT_CLIENT_OPTIONS.merge(
address: address,
ssl_cert_store: cert_store,
ssl_verify: tls_verify,
token: token,
versioned_kv: versioned_kv?
)
**DEFAULT_CLIENT_OPTIONS,
address: address,
ssl_cert_store: cert_store,
ssl_verify: tls_verify,
token: token,
versioned_kv: versioned_kv?
Comment on lines 75 to +81
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The VaultClientWrapper class accepts keyword arguments in its initializer. Update this call to match.

def initialize(versioned_kv:, **client_args)

)
end

Expand Down
8 changes: 4 additions & 4 deletions plugins/kubernetes/app/models/kubernetes/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ class Pod < Immutable
end

class PodDisruptionBudget < VersionedUpdate
def initialize(*)
super
def initialize(...)
super(...)
@delete_resource ||= @template[:delete] # allow deletion through release_doc logic
end
end
Expand All @@ -427,9 +427,9 @@ def template_for_update
end
end

def self.build(*args)
def self.build(*args, **kwargs)
klass = "Kubernetes::Resource::#{args.first.fetch(:kind)}".safe_constantize || VersionedUpdate
klass.new(*args)
klass.new(*args, **kwargs)
end
end
end
2 changes: 1 addition & 1 deletion plugins/sentry/lib/samson_sentry/samson_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ class SamsonPlugin < Rails::Engine

Samson::Hooks.callback :error do |exception, **options|
sentry_options = options.slice(:contexts, :extra, :tags, :user, :level, :fingerprint)
Sentry.capture_exception(exception, sentry_options)
Sentry.capture_exception(exception, **sentry_options)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Sentry.capture_exception method accepts keyword arguments. Update this method call to match.

https://github.com/getsentry/sentry-ruby/blob/1d8054837bedda96342c5f7b4bcfe9d87614c4da/sentry-ruby/lib/sentry-ruby.rb#L398

end
Loading