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

Issue with setting env variables that have multiple values separated by ";" #30

Closed
qaaditya opened this issue Mar 24, 2017 · 2 comments
Closed

Comments

@qaaditya
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: v4.7.0
  • Ruby: 2.1.9
  • Distribution:
  • Module version: 2.2.2

How to reproduce (e.g Puppet code you use)

windows_env { 'CMS_STORAGE_CONNECTION_STRING':
ensure => present,
variable => 'CMS_STORAGE_CONNECTION_STRING',
value => 'DefaultEndpointsProtocol=https;AccountName=produssccms01;AccountKey=7pAHD8y',
mergemode => clobber,
}

What are you seeing

The multiple values separated by the ";" is causing the puppet to set the env variable on EVERY run.

What behaviour did you expect instead

Puppet should set the value ONLY once.

Output log

2017-03-24
14:18 Z
notice
created
Source: /Stage[main]/Profile::Windows::Set_cms_storage_conn_string_env/Windows_env[CMS_STORAGE_CONNECTION_STRING]/ensureFile: /etc/puppetlabs/code/environments/intjp/modules/profile/manifests/windows/set_cms_storage_conn_string_env.ppLine: 13

Any additional information you'd like to impart

";" is causing the issue and it is a bug in the module.

@badgerious
Copy link
Contributor

Without having looked at this too closely, I would expect changing:

value => 'DefaultEndpointsProtocol=https;AccountName=produssccms01;AccountKey=7pAHD8y',

to

value => ['DefaultEndpointsProtocol=https', 'AccountName=produssccms01', 'AccountKey=7pAHD8y'],

would resolve this. If managing each of the elements of the connection string as separate entries is the wrong semantics for this environment variable, then setting separator to a value other than ; and leaving the value as it was originally should also resolve it. I think a change to the module that detects when you've included the separator character in the value string and advises would be reasonable too. Allowing nil separators could be useful too, when you want the module to just leave the string alone.

@qaaditya
Copy link
Author

The resolution to the issue was to put any separator other than the default “;”. That ways, puppet takes the whole string as one single-value.

            windows_env { 'CMS_STORAGE_CONNECTION_STRING':
                ensure    => present,
                variable  => 'CMS_STORAGE_CONNECTION_STRING',
                value     => 'DefaultEndpointsProtocol=https;AccountName=intjpussccms01;AccountKey=hHkZSt4O',
                separator => '|',
            }

Thanks for the quick help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants