{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/13484","labels_url":"https://api.github.com/repos/saltstack/salt/issues/13484/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/13484/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/13484/events","html_url":"https://github.com/saltstack/salt/issues/13484","id":35829204,"number":13484,"title":"ssh_known_hosts.present appends public key when that key already exists in the known_hosts file","user":{"login":"jaloren","id":6081083,"avatar_url":"https://avatars.githubusercontent.com/u/6081083?v=3","gravatar_id":"","url":"https://api.github.com/users/jaloren","html_url":"https://github.com/jaloren","followers_url":"https://api.github.com/users/jaloren/followers","following_url":"https://api.github.com/users/jaloren/following{/other_user}","gists_url":"https://api.github.com/users/jaloren/gists{/gist_id}","starred_url":"https://api.github.com/users/jaloren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaloren/subscriptions","organizations_url":"https://api.github.com/users/jaloren/orgs","repos_url":"https://api.github.com/users/jaloren/repos","events_url":"https://api.github.com/users/jaloren/events{/privacy}","received_events_url":"https://api.github.com/users/jaloren/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Medium%20Severity","name":"Medium Severity","color":"fad8c7"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P3","name":"P3","color":"0a3d77"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Platform","name":"Platform","color":"fef2c0"},{"url":"https://api.github.com/repos/saltstack/salt/labels/State%20Module","name":"State Module","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","html_url":"https://github.com/saltstack/salt/milestones/Approved","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":2813,"closed_issues":3040,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-12-11T19:33:53Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2014-06-16T19:42:14Z","updated_at":"2015-12-11T19:38:01Z","closed_at":null,"body":"salt version: 2014.1.5\r\nOS: CentOS 6.4\r\n\r\nUsing the ssh_known_hosts.present in a state file.\r\n\r\nhttp://salt.readthedocs.org/en/v2014.1.1/ref/states/all/salt.states.ssh_known_hosts.html?highlight=known_hosts#salt.states.ssh_known_hosts.present\r\n\r\nHere is the state file. \r\n\r\nhttps://gist.github.com/jaloren/d074e69f7c64ea798031\r\n\r\nExpectation is that the function behave like file.append:\r\n\r\n1. check the known_hosts file for the public key.\r\n2. If public key is found, then do nothing.\r\n3. if the public key is not found,  then append the public key to the file.\r\n\r\nHowever, instead the function appends the public key no matter what. This means that the public key is appended to the known_hosts file after each state run, regardless of whether the entry is already there. As a consequence, the known_hosts file is filled with multiple entries, where each entry is of the same public key."},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/164029851","html_url":"https://github.com/saltstack/salt/issues/13484#issuecomment-164029851","issue_url":"https://api.github.com/repos/saltstack/salt/issues/13484","id":164029851,"user":{"login":"fenderle","id":1256154,"avatar_url":"https://avatars.githubusercontent.com/u/1256154?v=3","gravatar_id":"","url":"https://api.github.com/users/fenderle","html_url":"https://github.com/fenderle","followers_url":"https://api.github.com/users/fenderle/followers","following_url":"https://api.github.com/users/fenderle/following{/other_user}","gists_url":"https://api.github.com/users/fenderle/gists{/gist_id}","starred_url":"https://api.github.com/users/fenderle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fenderle/subscriptions","organizations_url":"https://api.github.com/users/fenderle/orgs","repos_url":"https://api.github.com/users/fenderle/repos","events_url":"https://api.github.com/users/fenderle/events{/privacy}","received_events_url":"https://api.github.com/users/fenderle/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T19:38:01Z","updated_at":"2015-12-11T19:38:01Z","body":"Same problem here (2015.8.3) - everything ok with ecdsa. When I use enc: ecdsa-sha2-nistp256 the problem starts. And my OpenSSH also wants the full ecdsa name."}}