Closed jadestorm closed 2 years ago
I think the issue may be a conflict with "jsok/vault". You mentioned you disabled that module, but if it is still present in the environment it will be located by the puppet autoloader. Can you test by removing the "jsok/vault" module from the environment entirely and let me know the results?
I likely introduced this problem when I re-factored the functions contained in "lib/puppet_x/vault_secrets/vault.rb" as a ruby class and named the new class "Vault". This was a poor choice for the class name since I had already re-named the module itself from "vault" to "vault_secrets" to avoid conflict with the same "jsok/vault" module. Depending on the results of your test, it should be pretty easy to rename the Vault ruby class in this module to almost anything else.
Howdy! I'm fairly sure it was purged from the environment. I use r10k to update the environments and update modules and it had fully removed jsok/vault. However, I can try a few more things tomorrow. If you'd like I can also simply fork the module as well and rename the class and references to it and see how that goes, since I can easily test to see if it makes a difference. =) I'll poke around some more tomorrow though, thanks!
I created the "class_rename" branch and changed the name of the "Vault" ruby class to "VaultSession". I haven't actually deployed it anywhere, but it passes PDK validation and unit tests. Try deploying from this branch when you get a chance and let me know what happens.
Renaming the class definitely fixed that error. I'm trying to track down another ism atm -- but I don't think it's due to the module code. =) If I have some time later today or next week I may submit you a PR with a proposal. For now though, the branch seems to have done the trick! That's... interesting. Admittedly I'm not sure why, but I wouldn't have expected a Puppet class and a Ruby class to conflict with each other. (I guess I assumed Puppet classes were namespaced in such a way that that wouldn't happen)
laugh Just in case you are curious what the other issue was --- "pro tip: if you name something with an underscore, it's not gonna work if you type a dash" <_< But yeah awesome this is working great now thank you!
Thanks for confirming the fix. I'll merge this branch and release a new version on forge.
Hi there! I'm trying to transition from vault_lookup to vault_secrets and am running into a ... very difficult to track down issue. When I try to use vault_hash or vault_key, I get: Error for function 'vault_hash': Vault is not a class
Scanning around the code, it's clear to me that both are including the puppet_x file and at least to my eyes it's most certainly "a class" lol. =) So .. I'm at a loss. I am also using jsok/vault but I even temporarily disabled that module to see if that was causing some conflict, but nothing. I still have vault_lookup installed as well, but I can't find any reason why that would conflict.
Any ideas?
Puppet Agent 7.16.0 Puppet Server 7.7.0 Tested on Ubuntu 20.04