zyborg / Zyborg.Vault

PowerShell bindings for HashiCorp Vault
https://zyborg.github.io/Zyborg.Vault/
MIT License
19 stars 5 forks source link

posh 6 (osx) #3

Open Plork opened 6 years ago

Plork commented 6 years ago

Any plans to support this for Powershell 6 on Mac?

For what I can see the module works it just cannot save the "profiles" because of the whole forward / backslack issue.

New-VltAuth : Access to the path '/Users/<username>\.vault-address' is denied.

I am pretty decent in Powershell but this is written in c# so will need to get myself some new skills to work on this myself.

Plork commented 6 years ago

looks hardcoded at the moment:

public const string CliVaultTokenCacheFile = @"$HOME\.vault-token";

public const string VaultAddressCacheFile = @"$HOME\.vault-address";
public const string VaultProfilesDir = @"$HOME\.vault-profiles";

maybe an option to use https://msdn.microsoft.com/en-us/library/system.io.path.combine(v=vs.110).aspx

Plork commented 6 years ago
public static readonly string CliVaultTokenCacheFile = Path.Combine(@"$HOME",".vault-token");
public static readonly string VaultAddressCacheFile = Path.Combine(@"$HOME",".vault-address");
public static readonly string VaultProfilesDir = Path.Combine(@"$HOME",".vault-profiles");

I can't test it unfortunately, since it won't compile on my mac ;)

ebekker commented 6 years ago

Yes, the plan is to migrate it over to PowerShell Standard 5.1 so then it will be compatible with both Windows PowerShell 5.x and PowerShell Core 6. This work might start soon.

Not sure how you mean by hardcoded -- thos constant path strings are fed into the PowerShell library's InvokeCommand.ExpandString which will actually resolve the $HOME variable to the user's home directory.

ebekker commented 6 years ago

In the PowerShell Core variation of ExpandString, either \ or / characters in paths get translated to the platform's native path separator character.

Plork commented 6 years ago

oh the expansion of the $HOME isn't the issue .. its the .vault-address at the end. (the backslash)

But like i said my c# is newb level. So i haven't read and understood your code fully.

nvarscar commented 4 years ago

Yeah. I'm running into this issue too. I'm not seeing this behaviour in my PS console unfortunately:

$ExecutionContext.InvokeCommand.ExpandString('/Users/test\.vault-address')
/Users/test\.vault-address
dconnolly-sfdc commented 2 years ago

any plans to resolve this issue ?