Skip to content
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

Fix Folder Name for crossplatform use #32

Open
rcfmartin opened this issue Apr 20, 2024 · 0 comments · May be fixed by #33
Open

Fix Folder Name for crossplatform use #32

rcfmartin opened this issue Apr 20, 2024 · 0 comments · May be fixed by #33

Comments

@rcfmartin
Copy link

rcfmartin commented Apr 20, 2024

Problem description

I'm repurposing the dscworkshop project to create linux configuration files as well. Since I'm running the build on a linux computer, the path is case sensitive. The Sampler.DscPipline.psd1 won't import due to tasks\* , being lowercase.

Verbose logs

Importing tasks from module Sampler.DscPipeline
Get-ChildItem: Cannot find path '/home/ricky/git/NixConfigs/output/RequiredModules/Sampler.DscPipeline/0.2.0/tasks' because it
does not exist.
Adding Workflow from configuration:
  +-> pack
  +-> build
  +-> rsop
  +-> .
[build] Executing requested workflow: .
ERROR: Task 'build': Missing task 'LoadDatumConfigData'.
At /home/ricky/git/NixConfigs/build.ps1:331 char:13
+             task $workflow $workflowItem
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build ABORTED /home/ricky/git/NixConfigs/build.ps1. 0 tasks, 1 errors, 0 warnings 00:00:00.4484694
Invoke-Build.ps1: /home/ricky/git/NixConfigs/build.ps1:511:9
Line |
 511 |          Invoke-Build @PSBoundParameters -Task $Tasks -File $MyInvocat …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Task 'build': Missing task 'LoadDatumConfigData'. At /home/ricky/git/NixConfigs/build.ps1:331 char:13 +    
     | task $workflow $workflowItem +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DSC configuration

N/A

Suggested solution

Current Configuration

Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'tasks\*') -Include '*.build.*' |
    ForEach-Object -Process {
        $ModuleName = ([System.IO.FileInfo] $MyInvocation.MyCommand.Name).BaseName
        $taskFileAliasName = "$($_.BaseName).$ModuleName.ib.tasks"

        Set-Alias -Name $taskFileAliasName -Value $_.FullName

        Export-ModuleMember -Alias $taskFileAliasName
    }

Suggested Fix

Line 2 of the Suffix.ps1 file

  • I'm setting the tasks childpath to Tasks so it matches the folder name. After the change, the build completes as normal.
Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'Tasks\*') -Include '*.build.*' |
    ForEach-Object -Process {
        $ModuleName = ([System.IO.FileInfo] $MyInvocation.MyCommand.Name).BaseName
        $taskFileAliasName = "$($_.BaseName).$ModuleName.ib.tasks"

        Set-Alias -Name $taskFileAliasName -Value $_.FullName

        Export-ModuleMember -Alias $taskFileAliasName
    }

Operating system the target node is running

NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Pop!_OS 22.04 LTS
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Sampler.DscPipeline version

Name                Version Path
----                ------- ----
Sampler.DscPipeline 0.2.0   /home/ricky/git/NixConfigs/output/RequiredModules/Sampler.DscPipeline/0.2.0/Sampler.DscPipeline.psd1
@nyanhp nyanhp linked a pull request Jun 3, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant