Skip to content

[deployment/chef] Fix custom variables handling on Windows #6271

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

Merged
merged 11 commits into from
Jun 3, 2025
5 changes: 5 additions & 0 deletions deployments/chef/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## chef-v0.18.0

- Bug fix: Fix bug that caused custom variables to not be set when running on Windows
with a Splunk OTel Collector version >= `0.98.0`.

## chef-v0.17.0

- Remove the option `with_signalfx_dotnet_auto_instrumentation` used to
Expand Down
2 changes: 1 addition & 1 deletion deployments/chef/kitchen.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ suites:
splunk_memory_total_mib: "256"
splunk_hec_token: fake-hec-token
splunk_listen_interface: "0.0.0.0"
collector_version: 0.48.0
collector_version: 0.126.0
collector_additional_env_vars:
MY_CUSTOM_VAR1: value1
MY_CUSTOM_VAR2: value2
Expand Down
2 changes: 1 addition & 1 deletion deployments/chef/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
maintainer_email '[email protected]'
license 'Apache-2.0'
description 'Install/Configure the Splunk OpenTelemetry Collector'
version '0.16.0'
version '0.18.0'
chef_version '>= 16.0'

supports 'amazon'
Expand Down
5 changes: 3 additions & 2 deletions deployments/chef/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
include_recipe 'splunk_otel_collector::collector_win_config_options'
include_recipe 'splunk_otel_collector::collector_win_install'

# Older MSI versions can't properly setup the collector configuration
# Older MSI versions can't properly setup the collector configuration,
# in this case, we need to use the registry to set the environment variables.
unless node['splunk_otel_collector']['collector_msi_is_configurable']
# Testing also showed custom configuration variables also require this.
if !node['splunk_otel_collector']['collector_msi_is_configurable'] || !node['splunk_otel_collector']['collector_additional_env_vars'].empty?
include_recipe 'splunk_otel_collector::collector_win_registry'
end

Expand Down
1 change: 1 addition & 0 deletions deployments/chef/test/integration/custom_vars/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
end
collector_env_vars_strings.sort!
describe registry_key('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\splunk-otel-collector') do
it { should have_property 'Environment' }
it { should have_property_value('Environment', :multi_string, collector_env_vars_strings) }
end
describe service('fluentdwinsvc') do
Expand Down
Loading