Skip to content

Commit

Permalink
replacing .empty? with .nil? in test for app_key and app_id (#60)
Browse files Browse the repository at this point in the history
* Update ingestor.rb

.empty? cannot be used on nil class, 
becaues of this removing app_key and app_id from the conf to get managed identity breaks.
  • Loading branch information
gbordier authored Nov 24, 2023
1 parent 7f8fcc8 commit 1f94e0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/logstash/outputs/kusto/ingestor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def initialize(ingest_url, app_id, app_key, app_tenant, managed_identity_id, dat
apache_http = Java::org.apache.http
# kusto_connection_string = kusto_java.data.auth.ConnectionStringBuilder.createWithAadApplicationCredentials(ingest_url, app_id, app_key.value, app_tenant)
# If there is managed identity, use it. This means the AppId and AppKey are empty/nil
is_managed_identity = (app_id.nil? && app_key.empty?)
is_managed_identity = (app_id.nil? && app_key.nil?)
# If it is system managed identity, propagate the system identity
is_system_assigned_managed_identity = is_managed_identity && 0 == "system".casecmp(managed_identity_id)
# Is it direct connection
Expand Down Expand Up @@ -78,7 +78,7 @@ def initialize(ingest_url, app_id, app_key, app_tenant, managed_identity_id, dat

def validate_config(database, table, json_mapping, proxy_protocol, app_id, app_key, managed_identity_id)
# Add an additional validation and fail this upfront
if app_id.nil? && app_key.empty? && managed_identity_id.empty?
if app_id.nil? && app_key.nil? && managed_identity_id.nil?
@logger.error('managed_identity_id is not provided and app_id/app_key is empty.')
raise LogStash::ConfigurationError.new('managed_identity_id is not provided and app_id/app_key is empty.')
end
Expand Down

0 comments on commit 1f94e0f

Please sign in to comment.