Open jmp242 opened 8 years ago
I'm seeing this too, and I'm wondering two things: first, it's trying to invoke "IntialSize=" on the provider, where it should be looking "initialsize=", but that might be a red herring. The bigger deal is that it's trying to call that method on a nil object, not an instance of the provider. I'm going to try and debug further if I have access to this machine. I'm running on Windows Server 2012 R2
Yeah, it looks like it might be here: https://github.com/ptierno/puppet-windowspagefile/blob/master/lib/puppet/provider/pagefile/wmi.rb#L118-L122
It looks like the pagefile variable is probably being returned as nil, and it looks like that variable comes from doing a search for instances of the pagefile.
So I'm assuming this needs some sort of code fixes.
I'm working with an organization and haven't been able to spin up a windows node for test independently - I'd like to do that and try to find out what's going on. Basically, I need to set pagefiles at C:\ and D:\ and so was doing something like:
if $::is_virtual {
$initial_size = 1024
$maximum_size = 1024
} else {
$initial_size = 4096
$maximum_size = 4096
}
pagefile { 'c:\\pagefile.sys':
initialsize => $initial_size,
maximumsize => $maximum_size,
}
pagefile { 'D:\\pagefile.sys':
initialsize => $initial_size,
maximumsize => $maximum_size,
}
I'm guessing that the search at https://github.com/ptierno/puppet-windowspagefile/blob/master/lib/puppet/provider/pagefile/wmi.rb#L116 isn't returning an instance of the pagefile, but is instead returning nil...then you're trying to call methods on that object at https://github.com/ptierno/puppet-windowspagefile/blob/master/lib/puppet/provider/pagefile/wmi.rb#L119-L120 but it's throwing an error about trying to call InitialSize= on that nil object (again, guessing based on the code). I'd imagine we need a check for the event that the search returns back a nil object, then we can instantiate a new object.
My apologies. This provider has been unmaintained for quite a while as I have not had the time to maintain it. Any PR's would be accepted (bonus points for some acceptance and unit tests :smile: ).
I am going to be merging #6 some time next week. I would appreciate if both @glarizza and @jmp242 would be able to re-test it after that with the updated code before a forge release. I'm thinking @glarizza mention of https://github.com/ptierno/puppet-windowspagefile/blob/master/lib/puppet/provider/pagefile/wmi.rb#L116 might be accurate considering the casing of the drive letter issue that #6 should resolve.
I commented on the other Pull Request. The gist is that I don't have access to that customer's environment anymore, so I can't test for that specific issue, but I am working with another customer this week and the code did work for us. Based on the code I pasted above, I think the case of the drive letter could have played a part.
I'm willing to test if there's a zip I can download the new module version from.
James Pulver CLASSE Computer Group Cornell University
On 12/07/2016 01:33 PM, Gary Larizza wrote:
I commented on the Pull Request, but I don't have access to that customer's environment anymore, so I can't test for that specific issue, but I am working with another customer this week and the code did work for us. Based on the code I pasted above, I think the case of the drive letter could have played a part.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ptierno/puppet-windowspagefile/issues/7#issuecomment-265531503, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVyuj1BWNmONJAYbD5GrTZ-x1j9FMv9ks5rFvvzgaJpZM4ISSSA.
I have a manifest with: pagefile { 'c:\pagefile.sys': maximumsize => 8192, }
and get errors: Could not set 'present' on ensure: undefined method
InitialSize=' for nil:NilClass at 64:/mnt/puppet/etc/environments/production/modules/config/manifests/init.pp Wrapped exception: undefined method
InitialSize=' for nil:NilClass