Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt-cloud throws an exception when ec2 does not return encoding #38856

Closed
fhaynes opened this issue Jan 21, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@fhaynes
Copy link

commented Jan 21, 2017

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

@gtmanfred

This comment has been minimized.

Copy link
Contributor

commented Jan 23, 2017

We should just set this to result.text.encode(result.encoding or 'utf8') or whatever the default encoding is for aws for all references to .encoding on the result.

Thanks for reporting,
Daniel

@sumeetisp

This comment has been minimized.

Copy link
Contributor

commented Feb 27, 2017

Even i am facing this error while provisioning.

@gtmanfred

This comment has been minimized.

Copy link
Contributor

commented Feb 27, 2017

This has been fixed in #39228, and will be released as part of 2016.11.3

@gtmanfred gtmanfred closed this Feb 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.