getmoto / moto

A library that allows you to easily mock out tests based on AWS infrastructure.
http://docs.getmoto.org/en/latest/
Apache License 2.0
7.61k stars 2.03k forks source link

update_auto_scaling_group not work #596

Closed boynux closed 8 years ago

boynux commented 8 years ago

update_auto_scaling_group throws exception with no message. Is this supported?

spulec commented 8 years ago

The update_auto_scaling_group method is supported. See here for an example.

Can you give some more details? What code were you running and what did the exception look like?

boynux commented 8 years ago

that's the traceback:

Traceback (most recent call last):
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/moto/core/models.py", line 71, in wrapper
    result = func(*args, **kwargs)
  File "/home/mamad/Working/secret-ops-scripts/tests/helpers/aws/test_asg_descale.py", line 43, in test_retrieve_autoscaling_groups_in_vpc
    AutoScalingGroupManager('eu-west-1').scale(asg['AutoScalingGroupName'], MinSize = 1)
  File "/home/mamad/Working/secret-ops-scripts/modules/aws/auto_scaling_group_manager.py", line 13, in scale
    client.update_auto_scaling_group(AutoScalingGroupName=name, **kwargs)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/client.py", line 252, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/client.py", line 531, in _make_api_call
    operation_model, request_dict)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/endpoint.py", line 117, in make_request
    return self._send_request(request_dict, operation_model)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/endpoint.py", line 146, in _send_request
    success_response, exception):
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/endpoint.py", line 219, in _needs_retry
    caught_exception=caught_exception)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/hooks.py", line 226, in emit
    return self._emit(event_name, kwargs)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/hooks.py", line 209, in _emit
    response = handler(**kwargs)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 250, in __call__
    caught_exception)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 265, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 313, in __call__
    caught_exception)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 222, in __call__
    return self._check_caught_exception(attempt_number, caught_exception)
  File "/home/mamad/Working/secret-ops-scripts/.env/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 355, in _check_caught_exception
    raise caught_exception
KeyError: None

Creating ASG works well, just update fails. I tried to change parameters but I didn't manage to make it work. The actual code without Moto works well and updates the ASG group properly.

The update code is as simple as this:

client.update_auto_scaling_group(AutoScalingGroupName=name, MinSize=1, DesiredCapacity=1)

spulec commented 8 years ago

Thanks for opening! Let me know if that doesn't solve it.