{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/30277","labels_url":"https://api.github.com/repos/saltstack/salt/issues/30277/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/30277/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/30277/events","html_url":"https://github.com/saltstack/salt/issues/30277","id":126019579,"number":30277,"title":"[salt-cloud] Error actioning machines: 'ascii' codec can't encode character u'\\xa0' in position 20","user":{"login":"webtrekker","id":16315633,"avatar_url":"https://avatars.githubusercontent.com/u/16315633?v=3","gravatar_id":"","url":"https://api.github.com/users/webtrekker","html_url":"https://github.com/webtrekker","followers_url":"https://api.github.com/users/webtrekker/followers","following_url":"https://api.github.com/users/webtrekker/following{/other_user}","gists_url":"https://api.github.com/users/webtrekker/gists{/gist_id}","starred_url":"https://api.github.com/users/webtrekker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webtrekker/subscriptions","organizations_url":"https://api.github.com/users/webtrekker/orgs","repos_url":"https://api.github.com/users/webtrekker/repos","events_url":"https://api.github.com/users/webtrekker/events{/privacy}","received_events_url":"https://api.github.com/users/webtrekker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/High%20Severity","name":"High Severity","color":"ff9143"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Info%20Needed","name":"Info Needed","color":"c7def8"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P3","name":"P3","color":"0a3d77"},{"url":"https://api.github.com/repos/saltstack/salt/labels/RIoT","name":"RIoT","color":"fef2c0"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Salt-Cloud","name":"Salt-Cloud","color":"006b75"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Upstream%20Bug","name":"Upstream Bug","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/37","html_url":"https://github.com/saltstack/salt/milestones/Blocked","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/37/labels","id":343741,"number":37,"title":"Blocked","description":"Issues which are blocked in some way, whether they need further discussion, clarification, justification, or are blocked for some other reason.","creator":{"login":"basepi","id":702318,"avatar_url":"https://avatars.githubusercontent.com/u/702318?v=3","gravatar_id":"","url":"https://api.github.com/users/basepi","html_url":"https://github.com/basepi","followers_url":"https://api.github.com/users/basepi/followers","following_url":"https://api.github.com/users/basepi/following{/other_user}","gists_url":"https://api.github.com/users/basepi/gists{/gist_id}","starred_url":"https://api.github.com/users/basepi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basepi/subscriptions","organizations_url":"https://api.github.com/users/basepi/orgs","repos_url":"https://api.github.com/users/basepi/repos","events_url":"https://api.github.com/users/basepi/events{/privacy}","received_events_url":"https://api.github.com/users/basepi/received_events","type":"User","site_admin":false},"open_issues":346,"closed_issues":719,"state":"open","created_at":"2013-05-28T22:24:12Z","updated_at":"2016-01-13T18:50:17Z","due_on":null,"closed_at":null},"comments":19,"created_at":"2016-01-11T19:34:30Z","updated_at":"2016-01-13T20:01:16Z","closed_at":null,"body":"When trying to create a VMWare snapshot using --- \r\n`salt-cloud -a create_snapshot syslog01 snapshot_name=\"mySaltSnap\" description=\"Snap created via Saltcloud\"`\r\n\r\nI get the error --\r\n`UnicodeEncodeError: 'ascii' codec can't encode character u'\\xa0' in position 20: ordinal not in range(128)`\r\n\r\n… in my massive Google’ing this I came across this link\r\nhttp://stackoverflow.com/questions/28544686/unicodeencodeerror-ascii-codec-cant-encode-characters-in-position-0-5-ordin\r\n\r\nSo, from another suggestion that it might be pyVmomi I found this –\r\n    `/usr/lib/python2.7/site-packages/pyVmomi/__init__.py`\r\n \r\nAnd added these two lines after line 20 …\r\n \r\nline 20: `reload(sys)`\r\nAdded: `sys.set`\r\nAdded: `defaultencoding('utf-8')`\r\n\r\n`sed -n '20,23p' /usr/lib/python2.7/site-packages/pyVmomi/__init__.py`\r\n`import sys`\r\n`reload(sys)`\r\n`sys.setdefaultencoding('utf-8')`\r\n\r\nGuess what … IT WORKED !!\r\n \r\nOn my SLES12 Salt-master:\r\nsalt --version\r\nsalt 2015.8.3 (Beryllium)\r\nsalt-cloud --version\r\nsalt-cloud 2015.8.3 (Beryllium)\r\nNote: my SLES12 Salt-master failed when trying to run `salt --versions-report` \r\n\r\nAdding these lines also worked on my RHEL6.5 Salt-master\r\n`sed -n '20,23p' /usr/lib/python2.6/site-packages/pyVmomi/__init__.py`\r\n`import sys`\r\n`reload(sys)`\r\n`sys.setdefaultencoding('utf-8')`\r\n\r\nsalt --versions-report\r\nSalt Version:\r\n           Salt: 2015.8.1\r\n\r\nDependency Versions:\r\n         Jinja2: 2.2.1\r\n       M2Crypto: 0.20.2\r\n           Mako: Not Installed\r\n         PyYAML: 3.11\r\n          PyZMQ: 14.5.0\r\n         Python: 2.6.6 (r266:84292, May 22 2015, 08:34:51)\r\n           RAET: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.0.5\r\n           cffi: Not Installed\r\n       cherrypy: 3.2.2\r\n       dateutil: 1.4.1\r\n          gitdb: Not Installed\r\n      gitpython: Not Installed\r\n          ioflo: Not Installed\r\n        libnacl: Not Installed\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: 0.20.3\r\n   python-gnupg: Not Installed\r\n          smmap: Not Installed\r\n        timelib: Not Installed\r\n\r\nSystem Versions:\r\n           dist: redhat 6.6 Santiago\r\n        machine: x86_64\r\n        release: 2.6.32-504.8.1.el6.x86_64\r\n         system: Red Hat Enterprise Linux Server 6.6 Santiago\r\n\r\nsalt-cloud --version\r\n            salt-cloud 2015.8.1 (Beryllium)\r\n\r\nHowever, the above link suggests that what I added is a \"nasty, nasty hack for people who don't understand encoding\", which would be true of me, but maybe someone from the pyVmomi team or salt-cloud team can find a better work fix.\r\n"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/171416079","html_url":"https://github.com/saltstack/salt/issues/30277#issuecomment-171416079","issue_url":"https://api.github.com/repos/saltstack/salt/issues/30277","id":171416079,"user":{"login":"webtrekker","id":16315633,"avatar_url":"https://avatars.githubusercontent.com/u/16315633?v=3","gravatar_id":"","url":"https://api.github.com/users/webtrekker","html_url":"https://github.com/webtrekker","followers_url":"https://api.github.com/users/webtrekker/followers","following_url":"https://api.github.com/users/webtrekker/following{/other_user}","gists_url":"https://api.github.com/users/webtrekker/gists{/gist_id}","starred_url":"https://api.github.com/users/webtrekker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webtrekker/subscriptions","organizations_url":"https://api.github.com/users/webtrekker/orgs","repos_url":"https://api.github.com/users/webtrekker/repos","events_url":"https://api.github.com/users/webtrekker/events{/privacy}","received_events_url":"https://api.github.com/users/webtrekker/received_events","type":"User","site_admin":false},"created_at":"2016-01-13T20:01:16Z","updated_at":"2016-01-13T20:01:16Z","body":"@nmadhok, \r\n```\r\n1442                     if vm_name not in names:\r\n1443             #            log.debug('vm:{0} in provider:{1} is not in name list:{2!r}'.format(\r\n1444             #                vm_name, driver, names\r\n1445             #            ))\r\n1446                         log.debug(\r\n1447                                 'vm:{0} in provider:{1} is not in name '\r\n1448                                 'list:\\'{2}\\''.format(vm_name.encode('utf-8'), driver, names)\r\n1449                             )\r\n1450                         continue\r\n```\r\nAnd Ladies and Gentlemen, members of the press, and Distinguished Guests .... We have a Winner!\r\n```\r\nsalt-cloud -l debug -a create_snapshot slx9e snapshot_name=\"mySaltSnap\" description=\"Snap created via Saltcloud\"\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/api.conf'\r\n[DEBUG   ] Reading configuration from /etc/salt/master.d/api.conf\r\n[DEBUG   ] Including configuration from '/etc/salt/master.d/fileserver.conf'\r\n[DEBUG   ] Reading configuration from /etc/salt/master.d/fileserver.conf\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   ] Including configuration from '/etc/salt/master.d/susemanager.conf'\r\n[DEBUG   ] Reading configuration from /etc/salt/master.d/susemanager.conf\r\n[DEBUG   ] Reading configuration from /etc/salt/cloud.providers\r\n[DEBUG   ] Including configuration from '/etc/salt/cloud.providers.d/vmware.conf'\r\n[DEBUG   ] Reading configuration from /etc/salt/cloud.providers.d/vmware.conf\r\n[DEBUG   ] Reading configuration from /etc/salt/cloud.profiles\r\n[DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/cmatrixbox.conf'\r\n[DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/cmatrixbox.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\r\n[DEBUG   ] LazyLoaded parallels.avail_locations\r\n[DEBUG   ] LazyLoaded proxmox.avail_sizes\r\n[DEBUG   ] Could not LazyLoad saltify.destroy\r\n[DEBUG   ] Could not LazyLoad saltify.avail_sizes\r\n[DEBUG   ] Could not LazyLoad saltify.avail_images\r\n[DEBUG   ] Could not LazyLoad saltify.avail_locations\r\n[DEBUG   ] LazyLoaded rackspace.reboot\r\n[DEBUG   ] LazyLoaded openstack.list_locations\r\n[DEBUG   ] LazyLoaded rackspace.list_locations\r\nThe following virtual machines are set to be actioned with \"create_snapshot\":\r\n  slx9e\r\n\r\nProceed? [N/y] y\r\n... proceeding\r\n[DEBUG   ] Could not LazyLoad vmware.optimize_providers\r\n[DEBUG   ] The 'vmware' cloud driver is unable to be optimized.\r\n[DEBUG   ] Could not LazyLoad parallels.avail_sizes\r\n[DEBUG   ] LazyLoaded parallels.avail_locations\r\n[DEBUG   ] LazyLoaded proxmox.avail_sizes\r\n[DEBUG   ] Could not LazyLoad saltify.destroy\r\n[DEBUG   ] Could not LazyLoad saltify.avail_sizes\r\n[DEBUG   ] Could not LazyLoad saltify.avail_images\r\n[DEBUG   ] Could not LazyLoad saltify.avail_locations\r\n[DEBUG   ] LazyLoaded rackspace.reboot\r\n[DEBUG   ] LazyLoaded openstack.list_locations\r\n[DEBUG   ] LazyLoaded rackspace.list_locations\r\n[DEBUG   ] vm:sf1ap01-lnx82 in provider:vmware is not in name list:'set(['slx9e'])'\r\n```\r\n.... huge list ... continues...\r\n```\r\n[INFO    ] [ slx9e ] Waiting for create snapshot task to finish [0 s]\r\n[INFO    ] [ slx9e ] Waiting for create snapshot task to finish [5 s]\r\n[INFO    ] [ slx9e ] Waiting for create snapshot task to finish [10 s]\r\n[INFO    ] [ slx9e ] Successfully completed create snapshot task in 11 seconds\r\n[DEBUG   ] LazyLoaded nested.output\r\nmycompany-vmware-config:\r\n    ----------\r\n    vmware:\r\n        ----------\r\n        slx9e:\r\n            ----------\r\n            Snapshot created successfully:\r\n                ----------\r\n                created:\r\n                    2016-01-13 19:51:43\r\n                description:\r\n                    Snap created via Saltcloud\r\n                name:\r\n                    mySaltSnap\r\n                path:\r\n                    /mySaltSnap\r\n                state:\r\n                    poweredOn\r\n\r\n```"}}