{"action":"opened","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/22843","labels_url":"https://api.github.com/repos/saltstack/salt/issues/22843/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/22843/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/22843/events","html_url":"https://github.com/saltstack/salt/issues/22843","id":69522781,"number":22843,"title":"salt-ssh roster doesn't support integers as host keys","user":{"login":"Xiol","id":159842,"avatar_url":"https://avatars.githubusercontent.com/u/159842?v=3","gravatar_id":"","url":"https://api.github.com/users/Xiol","html_url":"https://github.com/Xiol","followers_url":"https://api.github.com/users/Xiol/followers","following_url":"https://api.github.com/users/Xiol/following{/other_user}","gists_url":"https://api.github.com/users/Xiol/gists{/gist_id}","starred_url":"https://api.github.com/users/Xiol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xiol/subscriptions","organizations_url":"https://api.github.com/users/Xiol/orgs","repos_url":"https://api.github.com/users/Xiol/repos","events_url":"https://api.github.com/users/Xiol/events{/privacy}","received_events_url":"https://api.github.com/users/Xiol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-20T07:04:20Z","updated_at":"2015-04-20T07:04:20Z","closed_at":null,"body":"Hi,\r\n\r\n```\r\n           Salt: 2015.2.0rc2-272-g34526d5\r\n         Python: 2.7.5 (default, Jun 17 2014, 18:11:42)\r\n         Jinja2: 2.7.2\r\n       M2Crypto: 0.21.1\r\n msgpack-python: 0.4.4\r\n   msgpack-pure: Not Installed\r\n       pycrypto: 2.6.1\r\n        libnacl: Not Installed\r\n         PyYAML: 3.10\r\n          ioflo: Not Installed\r\n          PyZMQ: 14.3.1\r\n           RAET: Not Installed\r\n            ZMQ: 4.0.4\r\n           Mako: Not Installed\r\n```\r\n\r\nSalt's roster file doesn't seem to support using integers as host keys. For example, if I have the following roster:\r\n\r\n```\r\n12345:\r\n  host: 172.16.32.57\r\n  port: 22\r\n  user: root\r\n  passwd: password\r\n12346:\r\n  host: 172.16.32.59\r\n  port: 22\r\n  user: root\r\n  passwd: password\r\n```\r\n\r\nUsing salt-ssh like so:\r\n\r\n```/usr/bin/salt-ssh --out yaml --no-color --roster-file roster.tmp -E '(12346|12345)' state.sls basic_cluster.0_both pillar={...}```\r\n\r\nResults in this error (repeated for each host):\r\n\r\n```\r\n[ERROR   ] An un-handled exception was caught by salt's global exception handler:\r\nTypeError: expected string or buffer\r\nTraceback (most recent call last):\r\n  File \"/usr/bin/salt-ssh\", line 10, in <module>\r\n    salt_ssh()\r\n  File \"/usr/lib/python2.7/site-packages/salt/scripts.py\", line 273, in salt_ssh\r\n    client.run()\r\n  File \"/usr/lib/python2.7/site-packages/salt/cli/ssh.py\", line 17, in run\r\n    ssh = salt.client.ssh.SSH(self.config)\r\n  File \"/usr/lib/python2.7/site-packages/salt/client/ssh/__init__.py\", line 173, in __init__\r\n    self.tgt_type)\r\n  File \"/usr/lib/python2.7/site-packages/salt/roster/__init__.py\", line 79, in targets\r\n    targets.update(self.rosters[f_str](tgt, tgt_type))\r\n  File \"/usr/lib/python2.7/site-packages/salt/roster/flat.py\", line 31, in targets\r\n    return rmatcher.targets()\r\n  File \"/usr/lib/python2.7/site-packages/salt/roster/flat.py\", line 49, in targets\r\n    return getattr(self, 'ret_{0}_minions'.format(self.tgt_type))()\r\n  File \"/usr/lib/python2.7/site-packages/salt/roster/flat.py\", line 72, in ret_pcre_minions\r\n    if re.match(self.tgt, minion):\r\n  File \"/usr/lib64/python2.7/re.py\", line 137, in match\r\n    return _compile(pattern, flags).match(string)\r\nTypeError: expected string or buffer\r\n```\r\n\r\nChanging the host key into a string by quoting it changes the error, though this one very obtuse:\r\n\r\n```\r\n\"12345\":\r\n  host: 172.16.32.57\r\n  [...snip...]\r\n\"12346\":\r\n  host: 172.16.32.59\r\n  [...snip...]\r\n```\r\n\r\n```\r\n...snip\r\n  stderr: \"Traceback (most recent call last):\\n  File \\\"<string>\\\", line 137, in <module>\\n\r\n    \\ File \\\"<string>\\\", line 42\\n    OPTIONS.config = '{id: '12345', root_dir: /var/lib/acmecorp/salt/running_data,\r\n    sock_dir: /}'\\n                                ^\\nSyntaxError: invalid syntax\\n\"\r\n  stdout: \"root@172.16.32.57's password: \\n\"\r\n```\r\n\r\nPrefixing the host key with the string 'ID' (e.g. 'ID12345') causes it to work fine, so I think it's just integers in any form that it really doesn't like!\r\n"}}