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
Additional roledefs keys beyond 'hosts' not loading into env #1276
Comments
you can use below example as configure file , then add some internal function to handle fabfiles.py like: list.db |
There are several env keys used by fabric to determine which host(s) to connect to for each session, i.e. roles, effective_roles, hosts, host_string. And of course decorators as well. That said, the roledefs is only a name mapping for grouping hosts, not necessary merged into env.hosts. Defining the roledefs as a dict helps you organize other custom settings, next to hosts, that are role specific. You can access them via full env path, i.e. env.roledefs.web.foo But, like you issue, and maybe expect, is that a role defined as a dict should get merged to the env root. |
env.roledefs.web.foo produces the error: I mean you could access it like a regular dict, env.roledefs['web']['foo'] but then I don't see why this functionality exists at all in Fabric, it's just a plain dict. It seems like this feature was implemented for a more useful reason? |
Sorry, you're right, you have to access it like you say. Currently theres no other reason than allowing you to group more role settings next to hosts. Also #1088 is part of 1.11 which is similar to what your describing/expecting. But I haven't found a nice way, as i said, to implement merging of roledefs yet. Only proof-of-cocept in fork using "ugly" deep monkey-patching. |
Ah alright that makes, I was beating my head against the wall thinking I was missing something :) Those referenced issue numbers look like they will help quite a bit whenever they roll. Thanks Jonas! |
This is confusing and I think it should be noted in the documentation that these additional variables are not accessible outside of the roledefs. |
@bitprophet Why has this been closed? The behavior of additional roledef keys hasn't changed, so is this a "won't fix"? |
This snippet from the docs doesn't make the example keys 'foo' available to the user via env, only the 'hosts' key is subsequently loaded by Fabric (into env.hosts)
Documented further on this stackoverlow question
The text was updated successfully, but these errors were encountered: