saltstack-formulas / ec2-autoscale-reactor

Autonomous Minion Management via EC2 Autoscaler
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
77 stars 28 forks source link

exception occurred in runner cloud.create #14

Open ugurengin opened 7 years ago

ugurengin commented 7 years ago

I have tested it with latest version of saltstack (2016.3.4), but it was returned an exception after reacting a new event from auto scaling group.It seems that "cloud.create runner" needed one more argument to work with event as well. Probably something is changed in latest version of salt which contain core framework.

Exception

salt/run/20161124075253378593/ret { "_stamp": "2016-11-24T07:52:53.444115", "fun": "runner.cloud.create", "jid": "20161124075253378593", "return": "Exception occurred in runner cloud.create: Traceback (most recent call last):\n File \"/usr/lib/python2.7/site-packages/salt/client/mixins.py\", line 326, in low\n expected_extra_kws=CLIENT_INTERNAL_KEYWORDS\n File \"/usr/lib/python2.7/site-packages/salt/utils/__init__.py\", line 1021, in format_call\n used_args_count\nSaltInvocationError: create takes at least 2 arguments (1 given)\n", "success": false, "user": "Reactor" }

Tracing log:

2016-11-24 12:10:47,865 [salt.template ][PROFILE ][13984] Time (in seconds) to render '/srv/reactor/ec2-autoscale.sls' using 'py' renderer: 0.0761120319366 2016-11-24 12:10:47,879 [salt.utils.process][DEBUG ][13984] ThreadPool executing func: <bound method RunnerClient.low of <salt.runner.RunnerClient object at 0x32ad7d0>> with args:('cloud.create', {'name': u'ec2_autoscale_launch', 'instance_id': 'i-5c6c50cg', 'instances': 'i-5c6c50cg', 'state': 'runner', '__user__': 'Reactor', '__sls__': '/srv/reactor/ec2-autoscale.sls', 'reactor': True, 'order': 1, '__id__': 'ec2_autoscale_launch'}) kwargs{}

justinlee46 commented 7 years ago

Hey @ugurengin,

I got the same error but I figured it out.

If you look at line 86 (https://github.com/saltstack-formulas/ec2-autoscale-reactor/blob/master/ec2-autoscale/init.sls#L86), you'll notice one of key arguments of runner.cloud.create is extracted from the master config (opts).

Normally, I have my cloud profiles under cloud.profiles.d directory, including the ec2.autoscale that's required, but the formula looks for ec2.autoscale in the master's config so after I moved it to master's config, this reactor works like a charm.

I'm using the most updated salt-master as well "salt-master 2016.11.0 (Carbon)"