Skip to content

Commit 0eed307

Browse files
authored
Properly use run_state token (#5473)
1 parent edf3e4f commit 0eed307

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

deployments/chef/recipes/collector_win_config_options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Recipe:: collector_win_config_options
33

44
collector_env_vars = [
5-
{ name: 'SPLUNK_ACCESS_TOKEN', type: :string, data: node['splunk_otel_collector']['splunk_access_token'].to_s },
5+
{ name: 'SPLUNK_ACCESS_TOKEN', type: :string, data: (node['splunk_otel_collector']['splunk_access_token'] || node.run_state['splunk_otel_collector']['splunk_access_token']).to_s },
66
{ name: 'SPLUNK_API_URL', type: :string, data: node['splunk_otel_collector']['splunk_api_url'].to_s },
77
{ name: 'SPLUNK_BUNDLE_DIR', type: :string, data: node['splunk_otel_collector']['splunk_bundle_dir'].to_s },
88
{ name: 'SPLUNK_COLLECTD_DIR', type: :string, data: node['splunk_otel_collector']['splunk_collectd_dir'].to_s },

deployments/chef/recipes/default.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
block do
66
raise "Set ['splunk_otel_collector']['splunk_access_token'] as an attribute or on the node's run_state."
77
end
8-
only_if { node['splunk_otel_collector']['splunk_access_token'].nil? }
8+
only_if { node['splunk_otel_collector']['splunk_access_token'].nil? && node.run_state['splunk_otel_collector']['splunk_access_token'].nil? }
99
end
1010

1111
if platform_family?('windows')

deployments/chef/templates/splunk-otel-collector.conf.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
SPLUNK_CONFIG=<%= node['splunk_otel_collector']['collector_config_dest'] %>
33

44
# Access token to authenticate requests.
5-
SPLUNK_ACCESS_TOKEN=<%= node['splunk_otel_collector']['splunk_access_token'] %>
5+
SPLUNK_ACCESS_TOKEN=<%= node['splunk_otel_collector']['splunk_access_token'] || node.run_state['splunk_otel_collector']['splunk_access_token'] %>
66

77
# Which realm to send the data to.
88
SPLUNK_REALM=<%= node['splunk_otel_collector']['splunk_realm'] %>

0 commit comments

Comments
 (0)