{"action":"created","issue":{"url":"https://api.github.com/repos/theforeman/smart-proxy/issues/338","labels_url":"https://api.github.com/repos/theforeman/smart-proxy/issues/338/labels{/name}","comments_url":"https://api.github.com/repos/theforeman/smart-proxy/issues/338/comments","events_url":"https://api.github.com/repos/theforeman/smart-proxy/issues/338/events","html_url":"https://github.com/theforeman/smart-proxy/pull/338","id":116746017,"number":338,"title":"Fixes #12465 -  handle ISC deleted entires correctly","user":{"login":"brandonweeks","id":15869,"avatar_url":"https://avatars.githubusercontent.com/u/15869?v=3","gravatar_id":"","url":"https://api.github.com/users/brandonweeks","html_url":"https://github.com/brandonweeks","followers_url":"https://api.github.com/users/brandonweeks/followers","following_url":"https://api.github.com/users/brandonweeks/following{/other_user}","gists_url":"https://api.github.com/users/brandonweeks/gists{/gist_id}","starred_url":"https://api.github.com/users/brandonweeks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandonweeks/subscriptions","organizations_url":"https://api.github.com/users/brandonweeks/orgs","repos_url":"https://api.github.com/users/brandonweeks/repos","events_url":"https://api.github.com/users/brandonweeks/events{/privacy}","received_events_url":"https://api.github.com/users/brandonweeks/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/theforeman/smart-proxy/labels/1.10%20priority","name":"1.10 priority","color":"bfd4f2"},{"url":"https://api.github.com/repos/theforeman/smart-proxy/labels/Needs%20testing","name":"Needs testing","color":"fbca04"},{"url":"https://api.github.com/repos/theforeman/smart-proxy/labels/Waiting%20on%20contributor","name":"Waiting on contributor","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-11-13T10:55:53Z","updated_at":"2015-11-19T19:43:00Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/theforeman/smart-proxy/pulls/338","html_url":"https://github.com/theforeman/smart-proxy/pull/338","diff_url":"https://github.com/theforeman/smart-proxy/pull/338.diff","patch_url":"https://github.com/theforeman/smart-proxy/pull/338.patch"},"body":"~~Fixes #12465 with three changes: ~=\r\n1. Don't catch Exception (the error it surfaced was opaque)\r\n2. Added a test case for a record that doesn't have an IP\r\n3. Skip records without an IP, otherwise they will error on trying to find the subnet~~\r\n\r\nAlright, let's try this again correctly. Here's what's happening:\r\n* The proxy creates a DHCP reservation in ISC via omshell. dhcpd.leases will contain an entry:\r\n```\r\nhost deletedhost.example.com {\r\n  dynamic;\r\n  hardware ethernet aa:aa:aa:aa:aa:aa;\r\n  fixed-address 192.168.0.10;\r\n        supersede server.filename = \"pxelinux.0\";\r\n        supersede server.next-server = ff:ff:ff:ff;\r\n        supersede host-name = \"deletedhost.example.com\";\r\n}\r\n```\r\n* The proxy deletes the host. dhcpd.leases will now contain the original entry *and* the following at the bottom of the file:\r\n```\r\nhost deletedhost.example.com {\r\n  dynamic;\r\n  deleted;\r\n}\r\n```\r\n* Foreman is trying to modify the DHCP reservation, so it calls `DELETE` on `/dhcp/192.168.0.0/aa:aa:aa:aa:aa:aa`.\r\n* The proxy parses dhcpd.leases correctly parsing the first entry and adding it to the in memory database. It fails to parse the deleted entry because it doesn't have an address and since we're catching Exception it moves on.\r\n* The proxy then tries to delete the record that it thinks exists and then #12469 is triggered.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/theforeman/smart-proxy/issues/comments/158172794","html_url":"https://github.com/theforeman/smart-proxy/pull/338#issuecomment-158172794","issue_url":"https://api.github.com/repos/theforeman/smart-proxy/issues/338","id":158172794,"user":{"login":"brandonweeks","id":15869,"avatar_url":"https://avatars.githubusercontent.com/u/15869?v=3","gravatar_id":"","url":"https://api.github.com/users/brandonweeks","html_url":"https://github.com/brandonweeks","followers_url":"https://api.github.com/users/brandonweeks/followers","following_url":"https://api.github.com/users/brandonweeks/following{/other_user}","gists_url":"https://api.github.com/users/brandonweeks/gists{/gist_id}","starred_url":"https://api.github.com/users/brandonweeks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandonweeks/subscriptions","organizations_url":"https://api.github.com/users/brandonweeks/orgs","repos_url":"https://api.github.com/users/brandonweeks/repos","events_url":"https://api.github.com/users/brandonweeks/events{/privacy}","received_events_url":"https://api.github.com/users/brandonweeks/received_events","type":"User","site_admin":false},"created_at":"2015-11-19T19:43:00Z","updated_at":"2015-11-19T19:43:00Z","body":"@witlessbird ack. These past few days has been super busy for my team. I'm hoping to get a chance to rewrite this PR this weekend. :)"}}