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

PSDesiredStateConfiguration exporting internal functions #7209

Closed
joeyaiello opened this issue Jun 29, 2018 · 1 comment
Closed

PSDesiredStateConfiguration exporting internal functions #7209

joeyaiello opened this issue Jun 29, 2018 · 1 comment
Labels
Area-DSC Desired State Configuration issues Issue-Bug Issue has been identified as a bug in the product Resolution-Fixed The issue is fixed.

Comments

@joeyaiello
Copy link
Contributor

The PSDesiredStateConfiguration modules shipping in PowerShell Core exports every function defined in the module instead of the smaller set that gets exported on Windows PowerShell.

Even if this owned by the DSC team, we should track it here until it's fixed in our shipping product.

Steps to reproduce

Get-Command -Module PSDesiredStateConfiguration

Expected behavior

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Configuration                                      1.1        psdesiredstateconfiguration
Function        Disable-DscDebug                                   1.1        psdesiredstateconfiguration
Function        Enable-DscDebug                                    1.1        psdesiredstateconfiguration
Function        Get-DscConfiguration                               1.1        psdesiredstateconfiguration
Function        Get-DscConfigurationStatus                         1.1        psdesiredstateconfiguration
Function        Get-DscLocalConfigurationManager                   1.1        psdesiredstateconfiguration
Function        Get-DscResource                                    1.1        psdesiredstateconfiguration
Function        New-DscChecksum                                    1.1        psdesiredstateconfiguration
Function        Remove-DscConfigurationDocument                    1.1        psdesiredstateconfiguration
Function        Restore-DscConfiguration                           1.1        psdesiredstateconfiguration
Function        Stop-DscConfiguration                              1.1        psdesiredstateconfiguration
Cmdlet          Invoke-DscResource                                 1.1        psdesiredstateconfiguration
Cmdlet          Publish-DscConfiguration                           1.1        psdesiredstateconfiguration
Cmdlet          Set-DscLocalConfigurationManager                   1.1        psdesiredstateconfiguration
Cmdlet          Start-DscConfiguration                             1.1        psdesiredstateconfiguration
Cmdlet          Test-DscConfiguration                              1.1        psdesiredstateconfiguration
Cmdlet          Update-DscConfiguration                            1.1        psdesiredstateconfiguration

Actual behavior

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        AddDscResourceProperty                             0.0        PSDesiredStateConfiguration
Function        AddDscResourcePropertyFromMetadata                 0.0        PSDesiredStateConfiguration
Function        Add-NodeKeys                                       0.0        PSDesiredStateConfiguration
Function        CheckResourceFound                                 0.0        PSDesiredStateConfiguration
Function        Configuration                                      0.0        PSDesiredStateConfiguration
Function        ConvertTo-MOFInstance                              0.0        PSDesiredStateConfiguration
Function        Generate-VersionInfo                               0.0        PSDesiredStateConfiguration
Function        Get-CompatibleVersionAddtionaPropertiesStr         0.0        PSDesiredStateConfiguration
Function        Get-ComplexResourceQualifier                       0.0        PSDesiredStateConfiguration
Function        GetCompositeResource                               0.0        PSDesiredStateConfiguration
Function        Get-ConfigurationErrorCount                        0.0        PSDesiredStateConfiguration
Function        Get-DscResource                                    0.0        PSDesiredStateConfiguration
Function        Get-DSCResourceModules                             0.0        PSDesiredStateConfiguration
Function        Get-EncryptedPassword                              0.0        PSDesiredStateConfiguration
Function        GetImplementingModulePath                          0.0        PSDesiredStateConfiguration
Function        Get-InnerMostErrorRecord                           0.0        PSDesiredStateConfiguration
Function        GetModule                                          0.0        PSDesiredStateConfiguration
Function        Get-MofInstanceName                                0.0        PSDesiredStateConfiguration
Function        Get-MofInstanceText                                0.0        PSDesiredStateConfiguration
Function        GetPatterns                                        0.0        PSDesiredStateConfiguration
Function        Get-PositionInfo                                   0.0        PSDesiredStateConfiguration
Function        Get-PSCurrentConfigurationNode                     0.0        PSDesiredStateConfiguration
Function        Get-PSDefaultConfigurationDocument                 0.0        PSDesiredStateConfiguration
Function        Get-PSMetaConfigDocumentInstVersionInfo            0.0        PSDesiredStateConfiguration
Function        Get-PSMetaConfigurationProcessed                   0.0        PSDesiredStateConfiguration
Function        Get-PSTopConfigurationName                         0.0        PSDesiredStateConfiguration
Function        Get-PublicKeyFromFile                              0.0        PSDesiredStateConfiguration
Function        Get-PublicKeyFromStore                             0.0        PSDesiredStateConfiguration
Function        GetResourceFromKeyword                             0.0        PSDesiredStateConfiguration
Function        GetSyntax                                          0.0        PSDesiredStateConfiguration
Function        ImportCimAndScriptKeywordsFromModule               0.0        PSDesiredStateConfiguration
Function        ImportClassResourcesFromModule                     0.0        PSDesiredStateConfiguration
Function        Initialize-ConfigurationRuntimeState               0.0        PSDesiredStateConfiguration
Function        IsHiddenResource                                   0.0        PSDesiredStateConfiguration
Function        IsPatternMatched                                   0.0        PSDesiredStateConfiguration
Function        New-DscChecksum                                    0.0        PSDesiredStateConfiguration
Function        Node                                               0.0        PSDesiredStateConfiguration
Function        ReadEnvironmentFile                                0.0        PSDesiredStateConfiguration
Function        Set-NodeExclusiveResources                         0.0        PSDesiredStateConfiguration
Function        Set-NodeManager                                    0.0        PSDesiredStateConfiguration
Function        Set-NodeResources                                  0.0        PSDesiredStateConfiguration
Function        Set-NodeResourceSource                             0.0        PSDesiredStateConfiguration
Function        Set-PSCurrentConfigurationNode                     0.0        PSDesiredStateConfiguration
Function        Set-PSDefaultConfigurationDocument                 0.0        PSDesiredStateConfiguration
Function        Set-PSMetaConfigDocInsProcessedBeforeMeta          0.0        PSDesiredStateConfiguration
Function        Set-PSMetaConfigVersionInfoV2                      0.0        PSDesiredStateConfiguration
Function        Set-PSTopConfigurationName                         0.0        PSDesiredStateConfiguration
Function        StrongConnect                                      0.0        PSDesiredStateConfiguration
Function        Test-ConflictingResources                          0.0        PSDesiredStateConfiguration
Function        Test-ModuleReloadRequired                          0.0        PSDesiredStateConfiguration
Function        Test-MofInstanceText                               0.0        PSDesiredStateConfiguration
Function        Test-NodeManager                                   0.0        PSDesiredStateConfiguration
Function        Test-NodeResources                                 0.0        PSDesiredStateConfiguration
Function        Test-NodeResourceSource                            0.0        PSDesiredStateConfiguration
Function        ThrowError                                         0.0        PSDesiredStateConfiguration
Function        Update-ConfigurationDocumentRef                    0.0        PSDesiredStateConfiguration
Function        Update-ConfigurationErrorCount                     0.0        PSDesiredStateConfiguration
Function        Update-DependsOn                                   0.0        PSDesiredStateConfiguration
Function        Update-LocalConfigManager                          0.0        PSDesiredStateConfiguration
Function        Update-ModuleVersion                               0.0        PSDesiredStateConfiguration
Function        ValidateNoCircleInNodeResources                    0.0        PSDesiredStateConfiguration
Function        ValidateNodeExclusiveResources                     0.0        PSDesiredStateConfiguration
Function        ValidateNodeManager                                0.0        PSDesiredStateConfiguration
Function        ValidateNodeResources                              0.0        PSDesiredStateConfiguration
Function        ValidateNodeResourceSource                         0.0        PSDesiredStateConfiguration
Function        ValidateNoNameNodeResources                        0.0        PSDesiredStateConfiguration
Function        ValidateUpdate-ConfigurationData                   0.0        PSDesiredStateConfiguration
Function        WriteFile                                          0.0        PSDesiredStateConfiguration
Function        Write-Log                                          0.0        PSDesiredStateConfiguration
Function        Write-MetaConfigFile                               0.0        PSDesiredStateConfiguration
Function        Write-NodeMOFFile                                  0.0        PSDesiredStateConfiguration

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.1.0-preview.3
PSEdition                      Core
GitCommitId                    v6.1.0-preview.3
OS                             Microsoft Windows 10.0.17698
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@joeyaiello joeyaiello added Issue-Bug Issue has been identified as a bug in the product Area-DSC Desired State Configuration issues labels Jun 29, 2018
HowardWolosky added a commit to HowardWolosky/PowerShellForGitHub that referenced this issue May 26, 2020
Somehow a number of PSScriptAnalyzer issues snuck in.  This fixes them.

The main PSScriptAnalyzer issues needing to be fixed were:
 * `PSReviewUnusedParameter` - This one came up a lot due to our heavy
    usage of `Resolve-RepositoryElements` and `Resolve-ParameterWithDefaultConfigurationValue`
    which both end up referencing their parameters by grabbing them off
    the stack.  That means that `NoStatus` and `Uri` are frequently
    never directly referenced.  So, exceptions were added.  There were
    two cases (in GitHubAnalytics) where there was a false positive due
    to PowerShell/PSScriptAnalyzer#1472

 * `PSUseProcessBlockForPipelineCommand` - We had a number of functions
   that took pipeline input, but didn't actuall use the `process` block.
   This actually caught a bug with `Group-GitHubIssue` and
   `Group-GitHubPullRequest`.  Added correct `process` block usage for
   most of the functions, but removed pipeline support for those where
   it didn't actually make sense anymore.

 * `PSUseDeclaredVarsMoreThanAssignments` - These are false positives
   in the Pester tests due to the usage of `BeforeAll`.  There wasn't
   an obvious way to use `SuppressMessageAttribute` in the Pester test,
   so I used a hacky workaround to "use" the variable in the `BeforeAll`
   block.  I could have added the suppression to the top of the file,
   but I still want to catch real issues in those files later.

 * `PSAvoidOverwritingBuiltInCmdlets` - It turns out that there's a bug
   with PSDesiredStateConfiguration in PS Core 6.1.0 where it was exporting
   internal functions.  This was thus a false-postive flag for Write-Log.
   See PowerShell/PowerShell#7209 for more info.

Also, it turns out that `Group-GitHubPullRequest` hadn't actually been
exported, so I fixed that too.
HowardWolosky added a commit to microsoft/PowerShellForGitHub that referenced this issue May 26, 2020
Somehow a number of PSScriptAnalyzer issues snuck in.  This fixes them.

The main PSScriptAnalyzer issues needing to be fixed were:
 * `PSReviewUnusedParameter` - This one came up a lot due to our heavy
    usage of `Resolve-RepositoryElements` and `Resolve-ParameterWithDefaultConfigurationValue`
    which both end up referencing their parameters by grabbing them off
    the stack.  That means that `NoStatus` and `Uri` are frequently
    never directly referenced.  So, exceptions were added.  There were
    two cases (in GitHubAnalytics) where there was a false positive due
    to PowerShell/PSScriptAnalyzer#1472

 * `PSUseProcessBlockForPipelineCommand` - We had a number of functions
   that took pipeline input, but didn't actuall use the `process` block.
   This actually caught a bug with `Group-GitHubIssue` and
   `Group-GitHubPullRequest`.  Added correct `process` block usage for
   most of the functions, but removed pipeline support for those where
   it didn't actually make sense anymore.

 * `PSUseDeclaredVarsMoreThanAssignments` - These are false positives
   in the Pester tests due to the usage of `BeforeAll`.  There wasn't
   an obvious way to use `SuppressMessageAttribute` in the Pester test,
   so I used a hacky workaround to "use" the variable in the `BeforeAll`
   block.  I could have added the suppression to the top of the file,
   but I still want to catch real issues in those files later.

 * `PSAvoidOverwritingBuiltInCmdlets` - It turns out that there's a bug
   with PSDesiredStateConfiguration in PS Core 6.1.0 where it was exporting
   internal functions.  This was thus a false-postive flag for Write-Log.
   See PowerShell/PowerShell#7209 for more info.

Also, it turns out that `Group-GitHubPullRequest` hadn't actually been
exported, so I fixed that too.
@joeyaiello joeyaiello added the Resolution-Fixed The issue is fixed. label Dec 17, 2020
@joeyaiello
Copy link
Contributor Author

This has been fixed for a while

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-DSC Desired State Configuration issues Issue-Bug Issue has been identified as a bug in the product Resolution-Fixed The issue is fixed.
Projects
None yet
Development

No branches or pull requests

1 participant