-
Notifications
You must be signed in to change notification settings - Fork 76
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
Potential Exit Code Issue #3
Comments
Hi Paul, the Since BitLocker is not installed, the If that resolves the issue, can you close this? |
Hey Thanks for responding so fast, I have tried the following now: exec { 'Import ServerManager Module': Which, to my understanding, means that I should run the command only if BitLocker is not currently installed. If this logic is now correct, then it still doesnt work i'm afraid Paul |
Hi Josh I have manged to get something working here. I have the following init.pp file
I wasn't able to get your puppet provider to do an Import-Module as it wasnt able to find the system modules location and I had to import the x64 version of the module. So I went with an exec and a sysnative location. The trouble here is that this configuration is applied every time. It seems to skip the onlyif clause. Is there any specific things I need to do in order to make the onlyif work? Paul |
That's surprising, because I explicitly check for and use the sysnative version (x64) if it's available. It could be related to me not specifying
Try running
I noticed your |
hey Josh Thanks for coming back to me, I have been able to implement the following solution now: #/modules/manage_windows_feature/manifests/init.pp
#/modules/windowsfeatures_dotnet_3_5/manifests/init.pp
This allows me to easily abstract the exec command away from the user of the system. I reckon we should be able to get the powershell provider working. I think this is something I would like to explore with you further. I'm hoping you will be at puppetconf? I will be there delivering a talk on puppet and windows so id love to be able to talk more about windows automation there Paul |
@stack72 I will definitely be at puppetconf, and awesome to hear you're giving on talk about puppet and windows. If you want to bounce ideas or whatever, let me know, I'd be happy to help. We are planning on an informal hacking on puppet day (or days), so it'd be cool to hack on windows stuff. About windows features, I assume you've seen our dism module? It would be cool to add support for servermanager. From what I understand servermanager handles dependencies, but dism doesn't? |
So where is this at? Does this work now? |
@stack72 I've submitted a PR #8 for comments, and using that was able to shorten your example to: define manage_windows_feature($feature_name = $title) { exec { "install-feature-${feature_name}" : command => "Import-Module ServerManager; Add-WindowsFeature ${feature_name}", onlyif => "Import-Module ServerManager; if((Get-WindowsFeature ${feature_name}).Installed) { exit 1 }", logoutput => true, provider => powershell, } } Comments welcome! |
Hi Josh
I was trying to use this module today and wrote the following in my init.pp
exec { 'Import ServerManager Module':
command => 'Import-Module ServerManager; Add-WindowsFeature BitLocker',
unless => 'Import-Module ServerManager; if((Get-WindowsFeature BitLocker).Installed -eq $true) {exit 1}',
provider => powershell,
}
The issue here is that my machine doesn't have BitLocker installed on it. So the unless should not return exit 1, which would mean that the command itself should run but it never runs.
Do I need to add anything else here? If I can get this module working, then I can basically script the entire installation of a Windows 2008 and 2012 server.
Thoughts here?
Paul
The text was updated successfully, but these errors were encountered: