supermarket icon indicating copy to clipboard operation
supermarket copied to clipboard

Default attributes depending on other attributes causing headaches for custom configurations

Open robbkidd opened this issue 8 years ago • 2 comments

The attempts to use node attributes to set other default node attributes within the omnibus internal cookbook is causing some of our configuration headaches.

For example, we set the default value for protocol depending on the value of force_ssl. Because protocol and force_ssl are evaluated and set here in the defaults, the evaluation for protocol never uses an overridden value for force_ssl. And so, ENV['PROTOCOL'] gets set to https all the time and then Supermarket::Host.full_url always returns a URL with https as the scheme.

That and https being hardcoded in the nginx site template are the two things that trip up a non-SSL install. I was able to get non-SSL Supermarket working in a VM by setting "protocol": false directly in supermarket.json and manually changing the nginx site config to httpafter​ a -ctl reconfigure.

robbkidd avatar May 19 '16 16:05 robbkidd

Need to fix defaults - we should never interpolate default values.

nellshamrell avatar Dec 08 '16 21:12 nellshamrell

see also tip 5 here - https://coderanger.net/chef-tips/

nathenharvey avatar Dec 08 '16 21:12 nathenharvey