8000 [design-proposal] Add ability to set attributes based on channel or policy_group · Issue #154 · chef/effortless · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[design-proposal] Add ability to set attributes based on channel or policy_group #154

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

Open
emachnic opened this issue Sep 16, 2019 · 1 comment
Labels
Design Proposal Community survey of a proposal

Comments

@emachnic
Copy link
Contributor
emachnic commented Sep 16, 2019

Add ability to set attributes based on channel or policy_group

This is to formalize the design proposal discussed in #101. For effortless, it would be great to have the ability to specify different attributes based on channel or policy_group

Motivation

As a Habitat node running Chef Infra effortless,
I want to use different attribute values when in a different channel or policy_group,
so that I can write configs with different, dynamic values.

Specification

Currently, one way of writing different config values is by setting the values based on policy_group. These can be set in the Policyfile.rb and then hoisted to the top level. It would be great to be able to do this in effortless config to make it easier to transition. One option could be to utilize the channel that Habitat is subscribed to and somehow switch on that. Refer to #101 for further discussion on this.

Downstream Impact

Should only impact effortless config

@TheLunaticScripter TheLunaticScripter added the Design Proposal Community survey of a proposal label Sep 17, 2019
@emachnic
Copy link
Contributor Author

I was thinking about this a bit and if there was a way to read the Habitat channel that the node is subscribed to from the Chef recipe, then this would probably work pretty easily. I could see having Habitat set an env var, maybe HAB_CHANNEL, and then using that in the Policyfile and recipe like:

# This assumes the Habitat channels "qa" and "prod"
# Policyfile.rb
default['qa']['myattribute'] = '<qa_value>'
default['prod']['myattribute'] = '<prod_value>'

# default.rb
myattribute_value = node["#{ENV['HAB_CHANNEL']}"]['myattribute']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Proposal Community survey of a proposal
Projects
None yet
Development

No branches or pull requests

2 participants
0