rackspace/pyrax — pull request #206 by radeex (2013-09-27 23:47:28+00:00)
Title: [autoscale] Support passing necessary arguments for non-webhook policy types

Here's the simple solution to issues #204 and #205, which just adds an "args" parameter to the policy creation and updating functions.

You can test it (and its various permutations) like this:

autoscale.add_policy(group_id, "my-schedule", "schedule", cooldown=0, change=-1, args={"cron": "0 0 0 0 0"})

I've tested it this way, along with the permutations like group.add_policy, and also the updating functions like policy.update(), group.update_policy, and autoscale.update_policy().

It turns out that the "cloud_monitoring" type isn't available in the public API yet, but with this particular strategy, pyrax won't need any additional work to support it.

I noticed that there's a bunch of webhook-related methods on the AutoScalePolicy class -- it may be nice to make them raise an exception immediately if self.type != "webhook". If you want me to do that just say the word (and a suggestion for which exception type to raise would be nice).