-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously a Powershell exec was used to install packages. This commit converts that task to a package-based resource. It allows cleaner, easier to read code. Switch from download_file to remote_file. This allows for better subscribe/notify of the dotnet defined type as remote_file does not have any intermediate file fragment resources which may be used or changed even if the file to download is not changed. The remote_file resource is also platform agnostic, unlike download_file, more meaning it may be accessible and familar to a wider range of potential users/contributors. Update for Puppet 4 and remove deps Use Puppet 4's type system to deal with validation and remove dependency on stdlib. Use the $::os fact to get Windows release version and remove dependency on windowsfacts. Add logic to prevent incompatible versions Some versions of .NET are in-place upgrades of others. Installation of .NET 4.5, for example, will replace the 4.0 package. In order to disallow Puppet from continuously trying to install .NET 4.0 in the event dotnet resources for both 4.0 and 4.5 have been added to the catalog, create a package=absent resource for each conflicting version. This will cause the conflict to be caught when a catalog is compiled for the node. Add ability to recognize built-in .NET versions Some OSes have some versions of .NET built in and so do not need to have it installed via package. It seems likely this was auto-detected based on registry key presence/absence via exec previously. Because we're now managing the package directly, we should be more explicit about whether or not the package actually needs to be installed. Clean up installation type detection Regex adjustments to make it easier to read which versions support which installation types. Only test on 4.x/future parser Set gemfile to use PUPPET_GEM_VERSION and set default to 4.0 Adjust tests to match updates This is not a comprehensive test overhaul, but does update the functional tests to work with the updated code. Logic correction - For 2008, .NET 3.5 is a package Previously the dotnet define logic would attempt to install .NET 3.5 as a feature on Server 2008. This was incorrect, as in Server 2008 .NET 3.5 was not available as a feature and needed the package installation. Add Dism install type for Windows 7 Windows 7 does not install .NET as a package, nor does it have the ServerManager module. Therefore provide an alternative means of managing the feature via DISM. Fix non-functional onlyif in powershell exec The Puppet Exec resource uses the return code of command, unless, and onlyif to determine success/failure or if action is necessary. Previously, the onlyif in dotnet::install::feature would never exit with a non-zero exit code, even if the Test-Path command returned a False object. Return object and exit code are not the same thing. This commit modifies the onlyif to ensure that if the Test-Path command returns false a non-zero exit code will occur. (style) Line up case blocks Add feature parameter to dotnet::install::feature This will allow specification of different feature names. Necessary specifically because the feature name to install .NET 3.5 on Server 2012 is not the same feature as to install 4.5. The feature name for .NET 3.5 in Server 2012 is not AS-NET-Framework, which we use as the default feature. This commit also updates the dotnet type to attempt installation of the correct feature when 3.5 is specified on Server 2012.
- Loading branch information
Showing
14 changed files
with
351 additions
and
622 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
define dotnet::install::dism ( | ||
$ensure = 'present', | ||
$version = '', | ||
) { | ||
|
||
if $ensure == 'present' { | ||
exec { "install-dotnet-dism-${version}": | ||
command => 'DISM /Online /Enable-Feature /FeatureName:NetFx3 /NoRestart', | ||
creates => "C:/Windows/Microsoft.NET/Framework/v${version}", | ||
provider => powershell, | ||
logoutput => true, | ||
} | ||
} else { | ||
exec { "uninstall-dotnet-dism-${version}": | ||
command => 'DISM /Online /Disable-Feature /FeatureName:NetFx3 /NoRestart', | ||
onlyif => "If (-Not(Test-Path C:/Windows/Microsoft.NET/Framework/v${version})) { Exit 1 }", | ||
provider => powershell, | ||
logoutput => true, | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.