{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/38287","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/38287/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/38287/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/38287/events","html_url":"https://github.com/saltstack/salt/issues/38287","id":195911683,"number":38287,"title":"Salt-Cloud failing to deploy to EC2 -- \"There was a profile error: encode() argument 1 must be string, not None\"","user":{"login":"danbudris","id":11739241,"avatar_url":"https://avatars.githubusercontent.com/u/11739241?v=3","gravatar_id":"","url":"https://api.github.com/users/danbudris","html_url":"https://github.com/danbudris","followers_url":"https://api.github.com/users/danbudris/followers","following_url":"https://api.github.com/users/danbudris/following{/other_user}","gists_url":"https://api.github.com/users/danbudris/gists{/gist_id}","starred_url":"https://api.github.com/users/danbudris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danbudris/subscriptions","organizations_url":"https://api.github.com/users/danbudris/orgs","repos_url":"https://api.github.com/users/danbudris/repos","events_url":"https://api.github.com/users/danbudris/events{/privacy}","received_events_url":"https://api.github.com/users/danbudris/received_events","type":"User","site_admin":false},"labels":[{"id":41387723,"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21","default":false},{"id":67288742,"url":"https://api.github.com/repos/saltstack/salt/labels/Critical","name":"Critical","color":"e95800","default":false},{"id":41389957,"url":"https://api.github.com/repos/saltstack/salt/labels/Fixed%20Pending%20Verification","name":"Fixed Pending Verification","color":"d4c5f9","default":false},{"id":194766302,"url":"https://api.github.com/repos/saltstack/salt/labels/P3","name":"P3","color":"0a3d77","default":false},{"id":220527153,"url":"https://api.github.com/repos/saltstack/salt/labels/RIoT","name":"RIoT","color":"fef2c0","default":false},{"id":65370277,"url":"https://api.github.com/repos/saltstack/salt/labels/Salt-Cloud","name":"Salt-Cloud","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","html_url":"https://github.com/saltstack/salt/milestone/13","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"open_issues":3286,"closed_issues":4221,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2016-12-16T19:25:37Z","due_on":null,"closed_at":null},"comments":14,"created_at":"2016-12-15T20:46:18Z","updated_at":"2016-12-16T19:28:56Z","closed_at":null,"body":"### Description of Issue/Question\r\nWhen attempting to launch an instance into AWS EC2 via salt-cloud, using a previously working profile, all attempts fail with error: \r\n\r\nAWS Response Status Code: 400\r\nError Creating <servername> on EC2 when trying to run the Initial Deployment:\r\nencode() argument 1 must be string, not none\r\n\r\n### Setup\r\n\r\n`salt-cloud -p base_ec2_private SERVERNAME -l debug`\r\n\r\n/etc/salt/cloud.profiles.d/profiles.conf:\r\n\r\n```\r\nbase_ec2_private:\r\n    provider: my-ec2-northeast-private-ips\r\n    script: salt_deploy_w_dns\r\n    image: ami-XXXXXXXXX\r\n    size: t2.large\r\n    subnetid: subnet-XXXXXXXXX\r\n    ssh_username: ubuntu\r\n    securitygroupid: sg-XXXXXXXXX\r\n    volumes:\r\n        - { size: 55, device: /dev/sdf }\r\n    minion:\r\n      grains:\r\n        setup: False\r\n        environment_type: qa\r\n      startup_states: highstate`\r\n```\r\n\r\n/etc/salt/cloud.providers.d/providers.conf:\r\n```\r\nmy-ec2-northeast-private-ips:\r\n\r\n    #Set the location of the Salt Master\r\n    minion:\r\n        master: XXXXXXXXX\r\n\r\n    #set grains information\r\n    grains:\r\n        dom: XXXXXX\r\n\r\n    #Specify that the private IP is to be used for the script execution\r\n    ssh_interface: private_ips\r\n\r\n    #set the credientials to be used -- these are the master role credentials, which will be appended the next time we create a working Salt master\r\n\r\n    id: 'XXXXXXXX'\r\n    key: 'XXXXXXXXX'\r\n\r\n    private_key: /etc/salt/XXXX.pem\r\n    keyname: XXXXX\r\n\r\n    #specify the Salt Driver\r\n    driver: ec2\r\n```\r\n\r\n### Steps to Reproduce Issue\r\n(Include debug logs if possible and relevant.)\r\n\r\n```\r\nsalt-cloud -p base_ec2_private 'SERVERNAME' -l debug\r\n[DEBUG   ] Reading configuration from /etc/salt/cloud\r\n[DEBUG   ] Reading configuration from /etc/salt/master\r\n[DEBUG   ] Including configuration from '/etc/salt/master.d/reactor.conf'\r\n[DEBUG   ] Reading configuration from /etc/salt/master.d/reactor.conf\r\n[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: MASTER\r\n[DEBUG   ] Missing configuration file: /etc/salt/cloud.providers\r\n[DEBUG   ] Including configuration from '/etc/salt/cloud.providers.d/providers.conf'\r\n[DEBUG   ] Reading configuration from /etc/salt/cloud.providers.d/providers.conf\r\n[DEBUG   ] Missing configuration file: /etc/salt/cloud.profiles\r\n[DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/profiles.conf'\r\n[DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/profiles.conf\r\n[DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/profiles2.conf'\r\n[DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/profiles2.conf\r\n[DEBUG   ] Configuration file path: /etc/salt/cloud\r\n[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.\r\n[INFO    ] salt-cloud starting\r\n[DEBUG   ] Could not LazyLoad parallels.avail_sizes: 'parallels' __virtual__ returned False\r\n[DEBUG   ] LazyLoaded parallels.avail_locations\r\n[DEBUG   ] LazyLoaded proxmox.avail_sizes\r\n[DEBUG   ] Could not LazyLoad saltify.destroy: 'saltify.destroy' is not available.\r\n[DEBUG   ] Could not LazyLoad saltify.avail_sizes: 'saltify.avail_sizes' is not available.\r\n[DEBUG   ] Could not LazyLoad saltify.avail_images: 'saltify.avail_images' is not available.\r\n[DEBUG   ] Could not LazyLoad saltify.avail_locations: 'saltify.avail_locations' is not available.\r\n[DEBUG   ] LazyLoaded rackspace.reboot\r\n[DEBUG   ] LazyLoaded openstack.list_locations\r\n[DEBUG   ] LazyLoaded rackspace.list_locations\r\n[DEBUG   ] Could not LazyLoad parallels.avail_sizes: 'parallels' __virtual__ returned False\r\n[DEBUG   ] LazyLoaded parallels.avail_locations\r\n[DEBUG   ] LazyLoaded proxmox.avail_sizes\r\n[DEBUG   ] Could not LazyLoad saltify.destroy: 'saltify.destroy' is not available.\r\n[DEBUG   ] Could not LazyLoad saltify.avail_sizes: 'saltify.avail_sizes' is not available.\r\n[DEBUG   ] Could not LazyLoad saltify.avail_images: 'saltify.avail_images' is not available.\r\n[DEBUG   ] Could not LazyLoad saltify.avail_locations: 'saltify.avail_locations' is not available.\r\n[DEBUG   ] LazyLoaded rackspace.reboot\r\n[DEBUG   ] LazyLoaded openstack.list_locations\r\n[DEBUG   ] LazyLoaded rackspace.list_locations\r\n[DEBUG   ] Using AWS endpoint: ec2.us-east-1.amazonaws.com\r\n[DEBUG   ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=DescribeInstances&Version=2014-10-01\r\n[DEBUG   ] AWS Response Status Code: 200\r\n[DEBUG   ] LazyLoaded cloud.cache_node_list\r\n[DEBUG   ] Generating minion keys for '<SERVERNAME>'\r\n[DEBUG   ] LazyLoaded cloud.fire_event\r\n[DEBUG   ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc\r\n[DEBUG   ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc\r\n[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/master/master_event_pull.ipc\r\n[DEBUG   ] Sending event: tag = salt/cloud/<SERVERNAME>/creating; data = {'profile': 'base_ec2_private', 'event': 'starting create', '_stamp': '2016-12-15T20:27:43.460003', 'name': '<SERVERNAME>', 'provider': 'my-ec2-northeast-private-ips:ec2'}\r\n[INFO    ] Creating Cloud VM <SERVERNAME> in us-east-1\r\n[DEBUG   ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc\r\n[DEBUG   ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc\r\n[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/master/master_event_pull.ipc\r\n[DEBUG   ] Sending event: tag = salt/cloud/<SERVERNAME>/requesting; data = {'event': 'requesting instance', '_stamp': '2016-12-15T20:27:43.487663', 'location': 'us-east-1', 'kwargs': {'SecurityGroupId.7': 's', 'SecurityGroupId.6': '0', 'SecurityGroupId.5': '1', 'SecurityGroupId.4': '-', 'SecurityGroupId.3': 'f', 'SecurityGroupId.2': 'g', 'SecurityGroupId.1': 'd', 'SecurityGroupId.0': 'c', 'SecurityGroupId.9': '8', 'ImageId': 'ami-40d28157', 'SubnetId': 'subnet-3dd7b416', 'KeyName': 'Salt_Master_Test', 'MaxCount': 1, 'Action': 'RunInstances', 'MinCount': 1, 'SecurityGroupId.8': '6', 'InstanceType': 't2.large'}}\r\n[DEBUG   ] Using AWS endpoint: ec2.us-east-1.amazonaws.com\r\n[DEBUG   ] AWS Request: https://ec2.us-east-1.amazonaws.com/?Action=RunInstances&ImageId=ami-40d28157&InstanceType=t2.large&KeyName=MASTER&MaxCount=1&MinCount=1&SecurityGroupId.0=c&SecurityGroupId.1=d&SecurityGroupId.2=g&SecurityGroupId.3=f&SecurityGroupId.4=-&SecurityGroupId.5=1&SecurityGroupId.6=0&SecurityGroupId.7=s&SecurityGroupId.8=6&SecurityGroupId.9=8&SubnetId=subnet-XXXXXX&Version=2014-10-01\r\n[DEBUG   ] AWS Response Status Code: 400\r\n[ERROR   ] Error creating <SERVERNAME> on EC2 when trying to run the initial deployment:\r\nencode() argument 1 must be string, not None\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python2.7/dist-packages/salt/cloud/clouds/ec2.py\", line 1921, in request_instance\r\n    sigver='4')\r\n  File \"/usr/lib/python2.7/dist-packages/salt/utils/aws.py\", line 463, in query\r\n    result.text.encode(result.encoding)\r\nTypeError: encode() argument 1 must be string, not None\r\n[ERROR   ] There was a profile error: encode() argument 1 must be string, not None\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python2.7/dist-packages/salt/cloud/cli.py\", line 284, in run\r\n    self.config.get('names')\r\n  File \"/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py\", line 1458, in run_profile\r\n    ret[name] = self.create(vm_)\r\n  File \"/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py\", line 1288, in create\r\n    output = self.clouds[func](vm_)\r\n  File \"/usr/lib/python2.7/dist-packages/salt/cloud/clouds/ec2.py\", line 2510, in create\r\n    data, vm_ = request_instance(vm_, location)\r\n  File \"/usr/lib/python2.7/dist-packages/salt/cloud/clouds/ec2.py\", line 1921, in request_instance\r\n    sigver='4')\r\n  File \"/usr/lib/python2.7/dist-packages/salt/utils/aws.py\", line 463, in query\r\n    result.text.encode(result.encoding)\r\nTypeError: encode() argument 1 must be string, not None\r\n```\r\n\r\n### Versions Report\r\n(Provided by running `salt --versions-report`. Please also mention any differences in master/minion versions.)\r\n\r\n```\r\nSalt Version:\r\n           Salt: 2016.11.1\r\n\r\nDependency Versions:\r\n           cffi: Not Installed\r\n       cherrypy: 3.5.0\r\n       dateutil: 2.4.2\r\n          gitdb: 0.6.4\r\n      gitpython: 1.0.1\r\n          ioflo: Not Installed\r\n         Jinja2: 2.8\r\n        libgit2: Not Installed\r\n        libnacl: Not Installed\r\n       M2Crypto: Not Installed\r\n           Mako: 1.0.3\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.4.6\r\n   mysql-python: Not Installed\r\n      pycparser: Not Installed\r\n       pycrypto: 2.6.1\r\n         pygit2: Not Installed\r\n         Python: 2.7.12 (default, Nov 19 2016, 06:48:10)\r\n   python-gnupg: Not Installed\r\n         PyYAML: 3.11\r\n          PyZMQ: 15.2.0\r\n           RAET: Not Installed\r\n          smmap: 0.9.0\r\n        timelib: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.1.4\r\n\r\nSystem Versions:\r\n           dist: Ubuntu 16.04 xenial\r\n        machine: x86_64\r\n        release: 4.4.0-34-generic\r\n         system: Linux\r\n        version: Ubuntu 16.04 xenial\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/267676182","html_url":"https://github.com/saltstack/salt/issues/38287#issuecomment-267676182","issue_url":"https://api.github.com/repos/saltstack/salt/issues/38287","id":267676182,"user":{"login":"Ch3LL","id":6886822,"avatar_url":"https://avatars.githubusercontent.com/u/6886822?v=3","gravatar_id":"","url":"https://api.github.com/users/Ch3LL","html_url":"https://github.com/Ch3LL","followers_url":"https://api.github.com/users/Ch3LL/followers","following_url":"https://api.github.com/users/Ch3LL/following{/other_user}","gists_url":"https://api.github.com/users/Ch3LL/gists{/gist_id}","starred_url":"https://api.github.com/users/Ch3LL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ch3LL/subscriptions","organizations_url":"https://api.github.com/users/Ch3LL/orgs","repos_url":"https://api.github.com/users/Ch3LL/repos","events_url":"https://api.github.com/users/Ch3LL/events{/privacy}","received_events_url":"https://api.github.com/users/Ch3LL/received_events","type":"User","site_admin":false},"created_at":"2016-12-16T19:28:56Z","updated_at":"2016-12-16T19:28:56Z","body":"yep it seems there might be two issues going on here. Oh and i just had him switch it back to the original code so we could just quickly get the real reason behind the 400 error. I didn't mean for my patch to be the solution just a workaround.but yeah looks like your pr will fix that encode error :+1: "}}
{"actor":{"display_login":"Ch3LL"}}