HomePhorge

(#6758) Pass options as an argument to string actions.
05b434dca10bUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#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>

Details

Provenance
Daniel Pittman <daniel@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUa3f5f974251e: MAINT: fix error reporting when you set terminus incorrectly.
Branches
Unknown
Tags
Unknown

Event Timeline

Daniel Pittman <daniel@puppetlabs.com> committed rPU05b434dca10b: (#6758) Pass options as an argument to string actions. (authored by Daniel Pittman <daniel@puppetlabs.com>).Apr 3 2011, 12:51 AM