voxpupuli / puppet-windowsfeature

Library that uses ServerAdministration api that comes with Windows Server 2008 and Windows Server 2012 to add / remove windows features
https://forge.puppet.com/puppet/windowsfeature
MIT License
30 stars 49 forks source link

Includemanagementtools includesubfeatures #13

Closed shoekstra closed 10 years ago

shoekstra commented 10 years ago

Hello,

This adds support for -IncludeManagementTools and -IncludeAllSubFeature when adding new features. Can't think how to make it add sub features or management tools after a feature is already present so have added a known issues note to the README.

Cheers, Stephen

stack72 commented 10 years ago

You, sir, are killing it right now! I love seeing so many PRs :)

shoekstra commented 10 years ago

:) Glad to contribute.

stack72 commented 10 years ago

@shoekstra are you testing these on Windows 2k8 or 2012 only?

shoekstra commented 10 years ago

It's being used against Windows 2008 R2 and Windows 2012 R2.

stack72 commented 10 years ago

for some reason, Windows 2k8 isn't working using the latest version of the module when running against a new box. Is that the same behaviour for you?

shoekstra commented 10 years ago

I'll test it now. How are you applying it and what is the error?

stack72 commented 10 years ago

im just applying as follows:

windowsfeature { 'Web-Mgmt-Tools': }

I don't get an error but I don't get the feature installed either

stack72 commented 10 years ago

ok, i found the issue. we have the following:

Import-Module ServerManager; if((Get-WindowsFeature ${features} | where InstallState -eq 'Available').count -eq 0){ exit 1 }

it should be

Import-Module ServerManager; if((Get-WindowsFeature ${features} | where { \$.InstallState -eq 'Available'}).count -eq 0){ exit 1 }

That allows us to install the feature BUT it still actually does the 'install' on each puppet run. So working on that part right now

shoekstra commented 10 years ago

Yep, working on a fix at the moment :) Will commit shortly, just need to test.

stack72 commented 10 years ago

ok, this works as expected:

onlyif => "Import-Module ServerManager; if((Get-WindowsFeature ${features} | where { \$_.Installed -match 'True'})){ exit 1 }",

I need to test it on an array of Features though

stack72 commented 10 years ago

last thing, my fix above - doesnt work for arrays :( I tried the following declaration:

windowsfeature{'IIS': feature_name => ['Web-Server', 'Web-WebServer', 'Web-ISAPI-Ext', 'Web-ISAPI-Filter', 'Web-Http-Redirect', 'Web-Filtering', 'Web-Mgmt-Console', 'Web-Mgmt-Tools'], }

and I get nothing happening at all

The only thing installed on the box is Web-Mgmt-Tools

shoekstra commented 10 years ago

Give that a whirl, seems to work on my side.

stack72 commented 10 years ago

@shoekstra this works perfectly - nice job