{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/15730","labels_url":"https://api.github.com/repos/saltstack/salt/issues/15730/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/15730/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/15730/events","html_url":"https://github.com/saltstack/salt/issues/15730","id":42599831,"number":15730,"title":"pkgrepo.managed should empty file before adding","user":{"login":"syphernl","id":639906,"avatar_url":"https://avatars.githubusercontent.com/u/639906?v=3","gravatar_id":"","url":"https://api.github.com/users/syphernl","html_url":"https://github.com/syphernl","followers_url":"https://api.github.com/users/syphernl/followers","following_url":"https://api.github.com/users/syphernl/following{/other_user}","gists_url":"https://api.github.com/users/syphernl/gists{/gist_id}","starred_url":"https://api.github.com/users/syphernl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syphernl/subscriptions","organizations_url":"https://api.github.com/users/syphernl/orgs","repos_url":"https://api.github.com/users/syphernl/repos","events_url":"https://api.github.com/users/syphernl/events{/privacy}","received_events_url":"https://api.github.com/users/syphernl/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+Severity","name":"Medium Severity","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/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":1787,"closed_issues":1347,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-01-04T05:16:14Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2014-09-12T06:18:45Z","updated_at":"2015-01-05T07:57:57Z","closed_at":null,"body":"If you have a repo, say `repo-2.2` and change the state to install `repo-2.4` instead you end up having one `sources.list` file with both 2.2 and 2.4. \r\n\r\nThis may not be desirable, so it would be nice to clean it out prior to putting in the repo line. Since it may not be desirable for everyone (e.g. custom additions) it probably should be an option."},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/68677625","html_url":"https://github.com/saltstack/salt/issues/15730#issuecomment-68677625","issue_url":"https://api.github.com/repos/saltstack/salt/issues/15730","id":68677625,"user":{"login":"boltronics","id":250531,"avatar_url":"https://avatars.githubusercontent.com/u/250531?v=3","gravatar_id":"","url":"https://api.github.com/users/boltronics","html_url":"https://github.com/boltronics","followers_url":"https://api.github.com/users/boltronics/followers","following_url":"https://api.github.com/users/boltronics/following{/other_user}","gists_url":"https://api.github.com/users/boltronics/gists{/gist_id}","starred_url":"https://api.github.com/users/boltronics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boltronics/subscriptions","organizations_url":"https://api.github.com/users/boltronics/orgs","repos_url":"https://api.github.com/users/boltronics/repos","events_url":"https://api.github.com/users/boltronics/events{/privacy}","received_events_url":"https://api.github.com/users/boltronics/received_events","type":"User","site_admin":false},"created_at":"2015-01-05T07:57:57Z","updated_at":"2015-01-05T07:57:57Z","body":"I host a repo on my CI server (which builds to be deployed are automatically packaged and dropped into). When the CI server hostname changes (which happens more often than I'd like with the current setup), pkgrepo.managed on clients accessing the repo does not remove the old entry, causing them to take forever to deploy due to trying to download from a repo that no longer exists.\r\n\r\nI've tried working around the issue by using prereq_in to call a file.absent statement on the generated .list file so in theory it is nuked when (and only when) changes are required, but then I seem to hit one of the various prereq-related infinite recursion bugs for reasons I have been unable to determine. The only other option I see is to just not use pkgrepo.managed for the time being.\r\n\r\nSo in short, +1. :)"}}