RamblingCookieMonster / PSDeploy

Simple PowerShell based deployments
http://ramblingcookiemonster.github.io/PSDeploy-Take-Two/
MIT License
347 stars 69 forks source link

Deployment fails on Linux #105

Closed juanfperezperez closed 6 years ago

juanfperezperez commented 6 years ago

While trying to use PSDeploy on Linux (Ubuntu 16.04) the deployment fails because it cannot find certain files. The issue seems to stem from a case mismatch. File: this.PSDeploy.ps1

Deploy SomeDeploymentName {
    By noop {
        FromSource MyModule
        To C:\PSDeployTo
        WithOptions @{
            Mirror = $True
            Environment = $Environment
            StringParameter = "This String"
        }
    }
}

Expected: no errors.

Actual:

PS /home/juan> Invoke-PSDeploy -Path ./this.PSDeploy.ps1                                                
Get-PSDeploymentScript : Could not find path '/usr/local/share/powershell/Modules/PSDeploy/0.2.3/PSDeployScripts/Filesystem.ps1' for deployment Filesystem. Origin: Filesystem.ps1
At /usr/local/share/powershell/Modules/PSDeploy/0.2.3/Public/Invoke-PSDeploy.ps1:202 char:30
+         $DeploymentScripts = Get-PSDeploymentScript
+                              ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-PSDeploymentScript

Get-PSDeploymentScript : Could not find path '/usr/local/share/powershell/Modules/PSDeploy/0.2.3/PSDeployScripts/noop.ps1' for deployment Noop. Origin: noop.ps1
At /usr/local/share/powershell/Modules/PSDeploy/0.2.3/Public/Invoke-PSDeploy.ps1:202 char:30
+         $DeploymentScripts = Get-PSDeploymentScript
+                              ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-PSDeploymentScript

Get-Item : Cannot find drive. A drive with the name 'C' does not exist.
At /home/juan/this.PSDeploy.ps1:3 char:24
+         if($Explorer = Get-Item C:\Windows\explorer.exe)
+                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:String) [Get-Item], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetItemCommand

Processing deployment
Process the deployment 'SomeDeploymentName'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
Get-PSDeploymentScript : Could not find path '/usr/local/share/powershell/Modules/PSDeploy/0.2.3/PSDeployScripts/Filesystem.ps1' for deployment Filesystem. Origin: Filesystem.ps1
At /usr/local/share/powershell/Modules/PSDeploy/0.2.3/Public/Invoke-PSDeployment.ps1:157 char:31
+             $DeploymentDefs = Get-PSDeploymentScript
+                               ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-PSDeploymentScript

Get-PSDeploymentScript : Could not find path '/usr/local/share/powershell/Modules/PSDeploy/0.2.3/PSDeployScripts/noop.ps1' for deployment Noop. Origin: noop.ps1
At /usr/local/share/powershell/Modules/PSDeploy/0.2.3/Public/Invoke-PSDeployment.ps1:157 char:31
+             $DeploymentDefs = Get-PSDeploymentScript
+                               ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-PSDeploymentScript

Sort : The term 'Sort' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At /usr/local/share/powershell/Modules/PSDeploy/0.2.3/Public/Invoke-PSDeployment.ps1:158 char:69
+ ...  $TheseDeploymentTypes = @( $Deployment.DeploymentType | Sort -Unique ...
+                                                              ~~~~
+ CategoryInfo          : ObjectNotFound: (Sort:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

PS /home/juan>
RamblingCookieMonster commented 6 years ago

Hiyo!

Yeahhh : ) I'm guessing there's going to be a good deal of work to do:

I'll be tied up until mid April or so, but this is definitely on my radar - if you're interested in helping, it would be awesome! Just... beware of the 'get-it-working' code style you might find

Cheers!

juanfperezperez commented 6 years ago

I'll take a look.

juanfperezperez commented 6 years ago

Hello,

As I'm working through the tests I noticed that the FileSystem deployment tests are inside the Invoke-PSDeployment test file. I was thinking of extracting those tests into their own file. Noop and Task are also included in there, but there is logic in Invoke-PSDeployment to accommodate Task, so that one belongs there. Will this work, or am I missing something?