salt-cloud throws an exception when ec2 does not return encoding #38856
Labels
Bug
broken, incorrect, or confusing behavior
P3
Priority 3
RIoT
Relates to integration with cloud providers, hypervisors, API-based services, etc.
Salt-Cloud
severity-high
2nd top severity, seen by most users, causes major problems
Milestone
Description of Issue/Question
salt-cloud does not handle exceptions when ec2 does not return encoding.
Setup
I am able to reproduce this with a stock 2016.11.1 install using salt-cloud on ubuntu 16.04. Any VM I have tried to create has had this issue.
Stack trace is:
[DEBUG ] Using AWS endpoint: ec2.us-east-1.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=DescribeInstances&InstanceId.1=i-0fdd120e73a86763a&Version=2014-10-01
[DEBUG ] AWS Response Status Code: 400
[ERROR ] There was a query error: encode() argument 1 must be string, not None
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/cloud/cli.py", line 348, in run
ret = mapper.run_map(dmap)
File "/usr/lib/python2.7/dist-packages/salt/cloud/init.py", line 2231, in run_map
profile, local_master=local_master
File "/usr/lib/python2.7/dist-packages/salt/cloud/init.py", line 1288, in create
output = self.cloudsfunc
File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/ec2.py", line 2695, in create
node = get_node(instance_id=vm['instance_id'])
File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/ec2.py", line 3303, in _get_node
sigver='4')
File "/usr/lib/python2.7/dist-packages/salt/utils/aws.py", line 464, in query
result.text.encode(result.encoding)
TypeError: encode() argument 1 must be string, not None
Steps to Reproduce Issue
Create a VM profile configured to connect via the private IP. Attempt to provision a machine in ec2 with it. I was able to work around it by just printing result.text and not attempting to encode it.
Versions Report
Salt Version:
Salt: 2016.11.1
Dependency Versions:
cffi: 1.5.2
cherrypy: 3.5.0
dateutil: 2.4.2
gitdb: 0.6.4
gitpython: 1.0.1
ioflo: Not Installed
Jinja2: 2.8
libgit2: 0.24.0
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 1.0.3
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: 2.14
pycrypto: 2.6.1
pygit2: 0.24.0
Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.2.0
RAET: Not Installed
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: Ubuntu 16.04 xenial
machine: x86_64
release: 4.4.0-45-generic
system: Linux
version: Ubuntu 16.04 xenial
The text was updated successfully, but these errors were encountered: