Error: Could not set 'present' on ensure: $_ value need to be String (nil given) at 48:/etc/puppet/manifests/site.pp
Error: Could not set 'present' on ensure: $_ value need to be String (nil given) at 48:/etc/puppet/manifests/site.pp
Wrapped exception:
$_ value need to be String (nil given)
Error: /Stage[main]//Node[actint-star-nactl01]/Netapp_volume_options[v_puppet_test12111508]/ensure: change from absent to present failed: Could not set 'present' on ensure: $_ value need to be String (nil given) at 48:/etc/puppet/manifests/site.pp
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: checking value of Netapp Volume option on Volume v_puppet_test12111508
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: setting Netapp Volume options against volume v_puppet_test12111508.
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Options: x=ay=b
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Option: x=a
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Option: y=b
Afternoon all
Is it possible to pass an array of key=value pairs to a provider param, and have the provider split and handle each key=value pair?
Basically, I've defined a new provider and type as follows: http://pastebin.com/WdekYPAh
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/yDOmbdqEY_sJ.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
One of the functions required is the ability to set 'options' against a given volume.
What I want to do is create a provider that accepts a volume name and a list of volume options with their corresponding settings, and then iterate through the provided list making a webservice call for each option.
So to give a better example of the provider in pastebin:
netapp_volume_options { 'v_puppet_test12111508':
options => ['convert_ucode=on', 'no_atime_update=on'],
}
Nan
Cheers for the response.
Yes this is just a parameter...
What's the easiest way to work with them in the provider?
Cheers
Gavin
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
#!/usr/bin/env ruby
grades = { "Bob" => 82,
"Jim" => 94,
"Billy" => 58
}
grades.each do|name,grade|
puts "#{name}: #{grade}"
end
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
After a quick google, came up with:#!/usr/bin/env ruby
grades = { "Bob" => 82,
"Jim" => 94,
"Billy" => 58
}
grades.each do|name,grade|
puts "#{name}: #{grade}"
end
So now all I need to do is pull the existing options values and compile a hash to compare in the exists?, and use the above in the create...
Quick question on the create - how will it handle one property that matches, but one property that doesn't?
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
Looks like overriding the 'insync?' method is the way to go, as I'm only interested in checking/setting property values that are being passed through...
Any insync? examples that I could refer to?
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Matched Name no_atime_update. Current value = off. New value = on
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: no_atime_update values don't match.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: setting Netapp Volume options against volume v_puppet_test12111508.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = no_atime_update, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option no_atime_update set against Volume v_puppet_test12111508.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = convert_ucode, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option convert_ucode set against Volume v_puppet_test12111508.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Options set successfully against Volume v_puppet_test12111508.
netapp_volume_options { 'v_puppet_test12111508':
options => {'convert_ucode' => 'on', 'no_atime_update' => 'on'},
require => Netapp_volume['v_puppet_test12111508']
}
Ok, I've just pushed the latest code to Github: https://github.com/fatmcgav/fatmcgav-netapp/commit/d5ae999fc49b1de6726e8f4b7027648cf2eb64a2
I've managed to get the create functioning correctly, and updating the NetApp options as required.
exists? has also been fleshed out a lot.
Logic is that it will pull back a list of the current options set against the referenced volume, and then construct a hash of the returned key=>value pairs.
The matching keys are then pulled from the current options and the setting options hashes, and the values of those keys compared.
If they are different, then the create should be triggered.
This is working fine in principle.
However the current issue is that the exists? will return false whenever a single property value doesn't match. The create will then process the whole list of setting options, rather than just the mis-matched one(s)...
An example run gives:^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Matched Name no_atime_update. Current value = off. New value = on
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: no_atime_update values don't match.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: setting Netapp Volume options against volume v_puppet_test12111508.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = no_atime_update, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option no_atime_update set against Volume v_puppet_test12111508.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = convert_ucode, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option convert_ucode set against Volume v_puppet_test12111508.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Options set successfully against Volume v_puppet_test12111508.
This is based on a config of:
netapp_volume_options { 'v_puppet_test12111508':
options => {'convert_ucode' => 'on', 'no_atime_update' => 'on'},
require => Netapp_volume['v_puppet_test12111508']
}
convert_ucode should match, and no_atime_update obviously didn't...
Any ideas?
Haven't as yet done anything with insync? yet, as if I'm honest it slightly baffles me currently...
Cheers for the response... Looks like I've got some more reading to do to get my head around some of the more complex stuff...
Think you're right in that I'm trying to treat the options as a whole, rather than individual items...
Am I better off moving to a prefetch/flush style provider, rather than the getter/setting method?
--
However I'm not sure that having individual params/properties for each volume option is the right way - The list of possible volume options currently stands at 36.. I don't really fancy having to implement a param/property for each of those... However I could see a single 'options' hash param/prop working for that... Although then I'm back to the same challenge of making sure each volume option is set & maintained correctly...
The other challenge is that to set volume options is a different webservice call to the volume-list/volume-create method, but I'm guessing I can just get that handled with another def in the provider...
^[[0;32mInfo^[[0m: Applying configuration version '1353061861'
^[[0;36mDebug^[[0m: /Stage[main]//Node[actint-star-nactl01]/Netapp_export[/vol/v_puppet_test1611120925/q_puppet_test1611120925]/require: requires Netapp_qtree[q_puppet_test1611120925]
^[[0;36mDebug^[[0m: /Stage[main]//Node[actint-star-nactl01]/Netapp_qtree[q_puppet_test1611120925]/require: requires Netapp_volume[v_puppet_test1611120925]
^[[0;36mDebug^[[0m: Stage[main]: Skipping host resources because running on a device
^[[0;36mDebug^[[0m: Class[Main]: Skipping host resources because running on a device
^[[0;36mDebug^[[0m: Node[actint-star-nactl01]: Skipping host resources because running on a device
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: checking existance of Netapp Volume v_puppet_test1611120925
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Vol Info: <results errno="13040" reason="No volume named 'v_puppet_test1611120925' exists" status="failed"></results>
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Volume doesn't exist.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: creating Netapp Volume v_puppet_test1611120925 of initial size 10g in Aggregate aggr01 using space reserve of none.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Volume v_puppet_test1611120925 created successfully. Setting options...
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Got to options= setter...
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = try_first, Value = volume_grow
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option try_first set against Volume v_puppet_test1611120925.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = no_atime_update, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option no_atime_update set against Volume v_puppet_test1611120925.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = convert_ucode, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option convert_ucode set against Volume v_puppet_test1611120925.
/Stage[main]//Node[actint-star-nactl01]/Netapp_volume[v_puppet_test1611120925]/ensure: created
^[[0;36mDebug^[[0m: /Stage[main]//Node[actint-star-nactl01]/Netapp_volume[v_puppet_test1611120925]: The container Node[actint-star-nactl01] will propagate my refresh event
^[[0;36mDebug^[[0m: Class[Settings]: Skipping host resources because running on a device
^[[0;36mDebug^[[0m: Class[Settings]: Skipping host resources because running on a device
^[[0;32mInfo^[[0m: Applying configuration version '1353061861'
^[[0;36mDebug^[[0m: /Stage[main]//Node[actint-star-nactl01]/Netapp_qtree[q_puppet_test1611120925]/require: requires Netapp_volume[v_puppet_test1611120925]
^[[0;36mDebug^[[0m: /Stage[main]//Node[actint-star-nactl01]/Netapp_export[/vol/v_puppet_test1611120925/q_puppet_test1611120925]/require: requires Netapp_qtree[q_puppet_test1611120925]
^[[0;36mDebug^[[0m: Stage[main]: Skipping host resources because running on a device
^[[0;36mDebug^[[0m: Class[Main]: Skipping host resources because running on a device
^[[0;36mDebug^[[0m: Node[actint-star-nactl01]: Skipping host resources because running on a device
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: checking existance of Netapp Volume v_puppet_test1611120925
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Vol Info: <results status="passed">
...
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Volume exists.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Vol Options: <results status="passed">
...
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Matched Name convert_ucode. Current value = on. New value = on
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Matched Name try_first. Current value = volume_grow. New value = volume_grow
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Matched Name no_atime_update. Current value = on. New value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Result is a hash.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Returning result...
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Got to options= setter...
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = convert_ucode, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option convert_ucode set against Volume v_puppet_test1611120925.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = try_first, Value = volume_grow
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option try_first set against Volume v_puppet_test1611120925.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = no_atime_update, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option no_atime_update set against Volume v_puppet_test1611120925.
/Stage[main]//Node[actint-star-nactl01]/Netapp_volume[v_puppet_test1611120925]/options: options changed '{}' to '[{"convert_ucode"=>"on", "try_first"=>"volume_grow", "no_atime_update"=>"on"}]'
^[[0;36mDebug^[[0m: /Stage[main]//Node[actint-star-nactl01]/Netapp_volume[v_puppet_test1611120925]: The container Node[actint-star-nactl01] will propagate my refresh event
^[[0;36mDebug^[[0m: Class[Settings]: Skipping host resources because running on a device
^[[0;36mDebug^[[0m: Class[Settings]: Skipping host resources because running on a device
--- a/lib/puppet/provider/netapp_volume/netapp_volume.rb
+++ b/lib/puppet/provider/netapp_volume/netapp_volume.rb
@@ -77,7 +77,7 @@
result = {}
matched_options.each do |name|
Puppet.debug("Puppet::Provider::netapp_volume_options: Matched Name #{name}. Current value = #{[current_options[name]]}. New value = #{[set_options[name]]} \n")
- result[name] = current_options[name] unless current_options[name] == set_options[name]
+ result[name] = current_options[name]
end
Puppet.debug("Puppet::Provider::Netapp_volume: Returning result hash... \n")
result
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Matched Name try_first. Current value = volume_grow. New value = snap_delete
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Matched Name convert_ucode. Current value = on. New value = on
^[[0;36mDebug^[[0m: Puppet::Provider::netapp_volume_options: Matched Name no_atime_update. Current value = on. New value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Result is a hash.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Returning result...
^[[0;36mDebug^[[0m: Checking if is.class and should.class are both Hashes...
^[[0;36mDebug^[[0m: Both is.class and should.class are Hashes...
^[[0;36mDebug^[[0m: Comparing key values for try_first. Is = volume_grow Should = snap_delete
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume: Got to options= setter...
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = try_first, Value = snap_delete
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option try_first set against Volume v_puppet_test1611120925.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = convert_ucode, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option convert_ucode set against Volume v_puppet_test1611120925.
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Setting = no_atime_update, Value = on
^[[0;36mDebug^[[0m: Puppet::Provider::Netapp_volume_options: Volume Option no_atime_update set against Volume v_puppet_test1611120925.
/Stage[main]//Node[actint-star-nactl01]/Netapp_volume[v_puppet_test1611120925]/options: options changed '{"convert_ucode"=>"on", "try_first"=>"volume_grow", "no_atime_update"=>"on"}' to '[{"try_first"=>"snap_delete", "convert_ucode"=>"on", "no_atime_update"=>"on"}]'
However still looks like if one of the :options doesn't match, then the whole lot gets set again... I guess that's a reasonable logic in that if one doesn't match, it's quite possible other's don't match, so set them all to be safe... Unless I missed something?
John
Cheers again, that could be a good alternative way of doing it... Use insync? just to trigger options=, and then work out what actually needs setting there...
Cheers
Gav
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/uFOu3gp_0kQJ.
John
Cheers again, that could be a good alternative way of doing it... Use insync? just to trigger options=, and then work out what actually needs setting there...
John,
Again, very helpful...
My knowledge of puppet is growing every day thanks to posts like this :-)
Cheers
Gavin
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/OEk9ZWDBvWUJ.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.