PoshCode / Configuration

A module to help other modules have settings
MIT License
176 stars 27 forks source link

No access to Machine scope #14

Closed lipkau closed 6 years ago

lipkau commented 6 years ago

Description

When Import-Configuration tries to load the config from Machine scope, it fails with:

New-Item : Access to the path '/etc/xdg/powershell/AtlassianPS' is denied.
At /Users/travis/.local/share/powershell/Modules/Configuration/1.2.0/Configuration.psm1:209 char:21
+             $null = New-Item $PathRoot -Type Directory -Force
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : PermissionDenied: (/etc/xdg/powershell/AtlassianPS:String) [New-Item], UnauthorizedAccessException
+ FullyQualifiedErrorId : CreateDirectoryUnauthorizedAccessError,Microsoft.PowerShell.Commands.NewItemCommand

See logs at: https://travis-ci.org/AtlassianPS/BitbucketPS/jobs/335077778#L307

Details

On Linux and OSX, the fallback path /etc/xdg/powershell needs sudo permissions. https://github.com/PoshCode/Configuration/blob/master/Source/Configuration.psm1#L209

Jaykul commented 6 years ago

Need to change Configuration module to not create folders when reading values, only when explicitly trying to write.