-
Notifications
You must be signed in to change notification settings - Fork 26
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
(MODULES-6860) Add dsc_lite
feature for confines
#41
(MODULES-6860) Add dsc_lite
feature for confines
#41
Conversation
dsc_lite
feature for confines
969ad8d
to
995e089
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change manually verified. Running through adhoc.
Previous error messge
New error message
|
995e089
to
4f79735
Compare
if (installed_version >= required_version) | ||
Puppet.features.add(:dsc_lite) | ||
else | ||
Puppet.warn_once( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The definition of warn_once
is at https://github.com/puppetlabs/puppet/blob/80e7948c69b6c2145a709c6e7fc95bd7bb772f26/lib/puppet/util/logging.rb#L167
- Previously when a version of PowerShell older than 5.0.10586.117 was installed, Puppet would return an error message like: Error: Could not find a suitable provider for dsc Unfortunately this message did not yield any useful information, even with --debug and --verbose turned on, because of the way the existing confine check was performed with a confine :true To produce a more useful message that is meaningful to users, introduce a new feature that performs the same check as the confine, but that also will issue an error message (only once) that indicates the installed version / required version constraints for the module, changing the output to:. Error: The dsc_lite module requires PowerShell version 5.0.10586.117 - current version 5.0.10514.6 The cmdlet Invoke-DscResource was introduced in v5.0, and is necessary for the dsc_lite module to function. Further bug fixes, first made available in version 5.0.10586.117 are also necessary for this module to function. To enable this module, please install the latest version of WMF 5+ from Microsoft.\n (file & line not available) - Note that DSC_LITE_MODULE_POWERSHELL_UPGRADE_MSG is never actually shown when the PowerShell version is < 5.0.10586.117 because the check occurs too late in the lifecycle of loading providers. The confine code has already evaluated, preventing the other messsages from being shown. This will be removed in subsequent commit.
de5b11e
to
9222ab4
Compare
- The new feature can be used in place of the previous CompatiblePowerShellVersion.compatible_version? check - The message for DSC_LITE_MODULE_POWERSHELL_UPGRADE_MSG that was intended to be shown inside the provider wasn't, since the checks made in the type for PowerShell compatibility occurred earlier in the Puppet run lifecycle. - This prevents duplication of version checks in multiple locations - Remove compatible_powershell_version_spec.rb given the code has been removed.
9222ab4
to
4b23deb
Compare
Similar to puppetlabs-toy-chest/puppetlabs-dsc#350 this is a quick fix that might require some further thought given there are currently two version checks against PowerShell performed in two different ways at different points in the lifecycle.
This builds on #40, but if this is merged first, #40 can be closed.Previously when a version of PowerShell older than 5.0.10586.117
was installed, Puppet would return an error message like:
Error: Could not find a suitable provider for dsc
Unfortunately this message did not yield any useful information,
even with --debug and --verbose turned on, because of the way the
existing confine check was performed with a confine :true
To produce a more useful message that is meaningful to users,
introduce a new feature that performs the same check as the
confine, but that also will issue an error message (only once)
that indicates the installed version / required version constraints
for the module, changing the output to:.
Error: The dsc_lite module requires PowerShell version 5.0.10586.117 - current version 5.0.10514.6
The cmdlet Invoke-DscResource was introduced in v5.0, and is necessary for the
dsc_lite module to function. Further bug fixes, first made available in version
5.0.10586.117 are also necessary for this module to function.
To enable this module, please install the latest version of WMF 5+ from Microsoft.\n (file & line not available)
Note that
DSC_LITE_MODULE_POWERSHELL_UPGRADE_MSG
is never actuallyshown when the PowerShell version is < 5.0.10586.117 because the
check occurs too late in the lifecycle of loading providers. The
confine code has already evaluated, preventing the other messsages
from being shown. This will be removed in subsequent commit.
The new feature can be used in place of the previous
CompatiblePowerShellVersion.compatible_version? check
The message for
DSC_LITE_MODULE_POWERSHELL_UPGRADE_MSG
that wasintended to be shown inside the provider wasn't, since the
checks made in the type for PowerShell compatibility occurred
earlier in the Puppet run lifecycle.
This prevents duplication of version checks in multiple locations
Remove compatible_powershell_version_spec.rb given the code
has been removed.