mirror of
https://github.com/PowerShell/PSDesiredStateConfiguration
synced 2026-06-21 13:45:25 +00:00
Started using Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json namespace
This commit is contained in:
@@ -308,7 +308,7 @@ function ConvertTo-MOFInstance
|
||||
elseif ($Value -is [PSCredential] )
|
||||
{
|
||||
# If the input object is a PSCredential, turn it into an MSFT_Credential with an encrypted password.
|
||||
$clearText = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetStringFromSecureString($Value.Password)
|
||||
$clearText = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.Json.DscClassCache]::GetStringFromSecureString($Value.Password)
|
||||
$newValue = @{
|
||||
UserName = $Value.UserName
|
||||
Password = $clearText
|
||||
@@ -1976,7 +1976,7 @@ function Configuration
|
||||
|
||||
# Load the default CIM keyword/function definitions set, populating the function collection
|
||||
# with the default functions.
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::LoadDefaultCimKeywords($functionsToDefine)
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.Json.DscClassCache]::LoadDefaultCimKeywords($functionsToDefine)
|
||||
|
||||
# Set up the rest of the configuration runtime state.
|
||||
Initialize-ConfigurationRuntimeState $Name
|
||||
@@ -2321,7 +2321,7 @@ function Configuration
|
||||
{
|
||||
Write-Debug -Message " CONFIGURATION $Name : DOING TOP-LEVEL CLEAN UP"
|
||||
[System.Management.Automation.Language.DynamicKeyword]::Reset()
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ClearCache()
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::ClearCache()
|
||||
|
||||
Initialize-ConfigurationRuntimeState
|
||||
}
|
||||
@@ -2498,7 +2498,7 @@ function ImportClassResourcesFromModule
|
||||
$functionsToDefine
|
||||
)
|
||||
|
||||
$resourcesFound = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ImportClassResourcesFromModule($Module, $Resources, $functionsToDefine)
|
||||
$resourcesFound = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::ImportClassResourcesFromModule($Module, $Resources, $functionsToDefine)
|
||||
return ,$resourcesFound
|
||||
}
|
||||
|
||||
@@ -2524,7 +2524,7 @@ function ImportCimAndScriptKeywordsFromModule
|
||||
|
||||
$keywordErrors = New-Object -TypeName 'System.Collections.ObjectModel.Collection[System.Exception]'
|
||||
|
||||
$foundCimSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ImportCimKeywordsFromModule(
|
||||
$foundCimSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::ImportCimKeywordsFromModule(
|
||||
$Module, $resource, [ref] $SchemaFilePath, $functionsToDefine, $keywordErrors)
|
||||
|
||||
foreach($ex in $keywordErrors)
|
||||
@@ -2542,7 +2542,7 @@ function ImportCimAndScriptKeywordsFromModule
|
||||
$SchemaFilePath = $null
|
||||
$oldCount = $functionsToDefine.Count
|
||||
|
||||
$foundScriptSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ImportScriptKeywordsFromModule(
|
||||
$foundScriptSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::ImportScriptKeywordsFromModule(
|
||||
$Module, $resource, [ref] $SchemaFilePath, $functionsToDefine )
|
||||
|
||||
$functionsAdded = $functionsToDefine.Count - $oldCount
|
||||
@@ -3417,7 +3417,7 @@ function Test-MofInstanceText
|
||||
{
|
||||
try
|
||||
{
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ValidateInstanceText($instanceText)
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::ValidateInstanceText($instanceText)
|
||||
}
|
||||
catch [System.Management.Automation.MethodInvocationException]
|
||||
{
|
||||
@@ -3982,12 +3982,12 @@ function ConvertTo-DscJsonSchema
|
||||
}
|
||||
else
|
||||
{
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.Mof.DscClassCache]::Initialize()
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::Initialize()
|
||||
$schemaFilePaths = Get-ChildItem -Recurse -File -Path $dir -Filter '*.schema.mof'
|
||||
|
||||
foreach($mofPath in $schemaFilePaths)
|
||||
{
|
||||
$cimClasses = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.Mof.DscClassCache]::ReadCimSchemaMof($mofPath)
|
||||
$cimClasses = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ReadCimSchemaMof($mofPath)
|
||||
Write-Verbose "Read $($cimClasses.Count) classes from $mofPath"
|
||||
$preprocessedCimClasses = PrepareCimClassesForJsonConvertion $cimClasses
|
||||
|
||||
@@ -4041,7 +4041,7 @@ function Get-DscResource
|
||||
$keywordErrors = New-Object -TypeName 'System.Collections.ObjectModel.Collection[System.Exception]'
|
||||
|
||||
# Load the default Inbox providers (keyword) in cache, also allow caching the resources from multiple versions of modules.
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::LoadDefaultCimKeywords($keywordErrors, $true)
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::LoadDefaultCimKeywords($keywordErrors, $true)
|
||||
|
||||
foreach($ex in $keywordErrors)
|
||||
{
|
||||
@@ -4126,7 +4126,7 @@ function Get-DscResource
|
||||
Write-Progress -Id 3 -Activity $LocalizedData.CreatingResourceList
|
||||
|
||||
# Get resources for CIM cache
|
||||
$keywords = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetCachedKeywords() | Where-Object -FilterScript {
|
||||
$keywords = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::GetCachedKeywords() | Where-Object -FilterScript {
|
||||
(!$_.IsReservedKeyword) -and ($null -ne $_.ResourceName) -and !(IsHiddenResource $_.ResourceName) -and (![bool]$Module -or ($_.ImplementingModule -like $ModuleString))
|
||||
}
|
||||
|
||||
@@ -4156,7 +4156,7 @@ function Get-DscResource
|
||||
if ($initialized)
|
||||
{
|
||||
[System.Management.Automation.Language.DynamicKeyword]::Reset()
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ClearCache()
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::ClearCache()
|
||||
|
||||
$initialized = $false
|
||||
}
|
||||
@@ -4184,7 +4184,7 @@ function Get-DscResource
|
||||
if ($initialized)
|
||||
{
|
||||
[System.Management.Automation.Language.DynamicKeyword]::Reset()
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ClearCache()
|
||||
[Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::ClearCache()
|
||||
|
||||
$initialized = $false
|
||||
}
|
||||
@@ -4235,7 +4235,7 @@ function GetResourceFromKeyword
|
||||
|
||||
$resource.Name = $keyword.Keyword
|
||||
|
||||
$schemaFiles = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetFileDefiningClass($keyword.ResourceName)
|
||||
$schemaFiles = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::GetFileDefiningClass($keyword.ResourceName)
|
||||
|
||||
if ($schemaFiles.Count)
|
||||
{
|
||||
@@ -4251,7 +4251,7 @@ function GetResourceFromKeyword
|
||||
# if the class is not a resource we will ignore it except if it is DSC inbox resource.
|
||||
if(-not $schemaFileName.StartsWith("$env:windir\system32\configuration",[stringComparison]::OrdinalIgnoreCase))
|
||||
{
|
||||
$classesFromSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetCachedClassByFileName($schemaFileName)
|
||||
$classesFromSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.Json.DscClassCache]::GetCachedClassByFileName($schemaFileName)
|
||||
if($null -ne $classesFromSchema)
|
||||
{
|
||||
# check if the resource is proper DSC resource that always derives from OMI_BaseResource.
|
||||
|
||||
Reference in New Issue
Block a user