-
Notifications
You must be signed in to change notification settings - Fork 108
Modules in DSC_Resorces cant be used to manage machine running invoke-DSCBuild. #107
Comments
it seems to be that line 11 of Test-DscResourceIsValid.ps1 is the point of failure changeing the line to |
Hmm... the way I was using this in testing was to clear out everything in the PSModulePath that wasn't needed prior to running Invoke-DscBuild. Something like this: $dependenciesDirectory = Join-Path $PSScriptRoot Dependencies
$env:PSModulePath = "$dependenciesDirectory;$pshome\Modules"
Invoke-DscBuild # etc It looks like maybe we should make this a parameter to Invoke-DscBuild instead. It would automatically include $pshome\Modules and the DSC_Resources directories on the path when running the build, and you could optionally pass in other paths to Invoke-DscBuild as well (where you have things like Pester, cDscResourceDesigner, etc.) That way you don't run into this problem if the build server happens to have duplicate modules on its normal module path. |
Both Resource build and Configuration build will fail if any resource is both in program files and dsc_Resources. while Resource build gives useful errors, Configuration does not. I also found one of my resources was faulty and was braking configuration build, removing it solved it so now I can build scripts but only if I have my build.ps1 compare dsc_Resources to Program Files and removes resources, then puts them back at the end. This is not a good fix but it's got me working with the latest version. |
I've just pushed a change to the Development branch to try to address this. Here's the new behavior:
The idea here is that everything DscBuild needs in order to do its job should be located somewhere other than the default PSModulePath on the build server. This way, it can run a build and test new versions of these modules without affecting the production state of the build server (which may also be managed by DSC.) Let me know if this makes sense, and if it helps with the problems you were having. |
Thank you, that worked. I had to add the configuration location, in this case dsc_tooling $BaseSettings = @{ |
This is not my day, it initially worked when I just updated the one file. but I thin copied all the Tools back into the module folder just to make sure my poking around was reversed, and now it's broken. I'm going to try to pinpoint the failure to see if it's my config script or Invoke-DscConfiguration. |
You may be hitting a bug with caching of resources. Is the LCM in debug mode? Or have you killed the wmi process hosting the lcm? |
I haven't been using the DSC_Tooling functionality of DscBuild at all yet (and am not really sure what the use case is, there). Do you think $SourceToolDirectory should also be on the default module path when Invoke-DscBuild is running? |
$BaseSettings = @{ $TestInvokeConfig = @{ ...
PS H:> $pathold = $env:PSModulePath PS H:> Import-Module -Name SampleConfiguration -Verbose
Import-Module : The specified module 'SampleConfiguration' was not loaded because no valid module file was found in
PS H:> $env:PSModulePath = $pathold |
think I may have it.
|
Looks like i'm good. all my configurations build, and I got all my configs and updated tools checked into the onprem git. |
when I try to update my tools and it brakes I alwase fall back to a clean seutp and the sample build.
when it Trys to run I get some errors I think is related to the recent change of folders, having the resorces in both the DSC_Resorce folder and C:\Program Files\WindowsPowerShell\Modules (required for ISE to validate SampleConfiguration)
VERBOSE: Performing the operation "Test-DscResourceIsValid" on target "modules from H:\DSC\DSC_Tooling\Examples
DSC_Resources".
ImportCimAndScriptKeywordsFromModule : A second CIM class definition for 'PSHOrg_cSmbShare' was found while
processing the schema file 'C:\Program
Files\WindowsPowerShell\Modules\cSmbShare\DSCResources\PSHOrg_cSmbShare\PSHOrg_cSmbShare.Schema.mof'. This
class was already defined in the file 'H:\DSC\DSC_Tooling\Examples\DSC_Resources\cSmbShare\DSCResources\PSHOrg_
cSmbShare\PSHOrg_cSmbShare.Schema.mof'. Remove the redundant definition, and then try again.
At C:\windows\system32\windowspowershell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.p
sm1:2426 char:29
The text was updated successfully, but these errors were encountered: