-
Notifications
You must be signed in to change notification settings - Fork 375
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
ENHANCEMENT: ability to switch namespaces after Connection #665
Comments
Exposing an explicit method to allow setting the currently selected namespace seems reasonable. In the meantime, one could accomplish this using a workaround like: |
If you can tell me where (which file) you want it implemented in, I'll try submitting a PR for it. |
if you're already connected, then a context manager could use your current client token and and create a namespace client using the root namespace token until the context ends.
maybe the implementation could leverage contextVars / contextlib |
@devlounge: Oooh, that is a solid suggestion. I like it! In my own experience, referencing different namespaces within the same batch of "config" is often klunky (e.g., in the Vault terraform provider). That context manager idea fits with my own namespace usage patterns at least 😄 @aram535: As pretty much everything in this module goes through the "Client" class, I would vote for making this type of addition there. Adding a " |
Hi, is this now possible to do in hvac ? |
Hi, is this still a feature that is currently scoped for implementation? I have been using the workaround proposed by @jeffwecan without issues, but would still like to see this as a native feature of |
@jeffwecan did the _adapter get removed from hvac in recent versions? The existing code that worked is now failing with "VautClient object has no attribute _adapter". If so, what's the proper way of switching namespaces now? |
@aram535 Were you able to find out the workaround to this ? |
The adapter override still does work. I was incorrectly assigning the client in my module. After connection is established, you can manipulate the namespace with:
|
It would be nice to be able to switch namespaces for administration purpose scripts.
The text was updated successfully, but these errors were encountered: