(#6758) Pass options as an argument to string actions.
Earlier in their implementation the String prototype would set global state on
a String object to reflect options set on the command line. As we move
strings away from a CLI-only prototype, this becomes troublesome because we
can easily have, for example, HTTP access to a string, which means load
balancers can really make this confusing.
It also encourages global state pollution, where one invocation can adversely
influence another. A better approach is that we pass options to the string
action invocation directly; this makes the interaction stateless.
Changes required to your code to adapt to the new world:
- action(:foo) do |some, args|
+ action(:foo) do |some, args, options={}|
if options[:whatever] then
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>