{"action":"created","comment":{"url":"https://api.github.com/repos/psychomario/PyPXE/pulls/comments/34224532","id":34224532,"diff_hunk":"@@ -98,7 +100,39 @@ def __init__(self, **server_settings):\n         self.sock.bind(('', self.port ))\n \n         # key is MAC\n+        # separate options dict so we don't have to clean up on export\n+        self.options = dict()\n         self.leases = defaultdict(lambda: {'ip': '', 'expire': 0, 'ipxe': self.ipxe})\n+        if self.save_leases_file:\n+            try:\n+                leasesfile = open(self.save_leases_file, 'rb')\n+                imported = json.load(leasesfile)\n+                importsafe = dict()","path":"pypxe/dhcp.py","position":35,"original_position":35,"commit_id":"50424781b76d77d1fceb33ba2378de9ccf7e592b","original_commit_id":"50424781b76d77d1fceb33ba2378de9ccf7e592b","user":{"login":"mmattioli","id":3645154,"avatar_url":"https://avatars.githubusercontent.com/u/3645154?v=3","gravatar_id":"","url":"https://api.github.com/users/mmattioli","html_url":"https://github.com/mmattioli","followers_url":"https://api.github.com/users/mmattioli/followers","following_url":"https://api.github.com/users/mmattioli/following{/other_user}","gists_url":"https://api.github.com/users/mmattioli/gists{/gist_id}","starred_url":"https://api.github.com/users/mmattioli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmattioli/subscriptions","organizations_url":"https://api.github.com/users/mmattioli/orgs","repos_url":"https://api.github.com/users/mmattioli/repos","events_url":"https://api.github.com/users/mmattioli/events{/privacy}","received_events_url":"https://api.github.com/users/mmattioli/received_events","type":"User","site_admin":false},"body":"`import_safe`","created_at":"2015-07-09T05:24:56Z","updated_at":"2015-07-09T05:24:56Z","html_url":"https://github.com/psychomario/PyPXE/pull/110#discussion_r34224532","pull_request_url":"https://api.github.com/repos/psychomario/PyPXE/pulls/110","_links":{"self":{"href":"https://api.github.com/repos/psychomario/PyPXE/pulls/comments/34224532"},"html":{"href":"https://github.com/psychomario/PyPXE/pull/110#discussion_r34224532"},"pull_request":{"href":"https://api.github.com/repos/psychomario/PyPXE/pulls/110"}}},"pull_request":{"url":"https://api.github.com/repos/psychomario/PyPXE/pulls/110","id":38454248,"html_url":"https://github.com/psychomario/PyPXE/pull/110","diff_url":"https://github.com/psychomario/PyPXE/pull/110.diff","patch_url":"https://github.com/psychomario/PyPXE/pull/110.patch","issue_url":"https://api.github.com/repos/psychomario/PyPXE/issues/110","number":110,"state":"open","locked":false,"title":"Enable Exporting Leases to JSON","user":{"login":"psychomario","id":1041406,"avatar_url":"https://avatars.githubusercontent.com/u/1041406?v=3","gravatar_id":"","url":"https://api.github.com/users/psychomario","html_url":"https://github.com/psychomario","followers_url":"https://api.github.com/users/psychomario/followers","following_url":"https://api.github.com/users/psychomario/following{/other_user}","gists_url":"https://api.github.com/users/psychomario/gists{/gist_id}","starred_url":"https://api.github.com/users/psychomario/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychomario/subscriptions","organizations_url":"https://api.github.com/users/psychomario/orgs","repos_url":"https://api.github.com/users/psychomario/repos","events_url":"https://api.github.com/users/psychomario/events{/privacy}","received_events_url":"https://api.github.com/users/psychomario/received_events","type":"User","site_admin":false},"body":"Handles `SIG{INT,ALRM,TERM,HUP}` to dump out the leases object to `--saveleases` file as json. On start with `--saveleases` the `self.leases` object is updated with the contents, so non-expired ~~(__BUG__ we don't check, will fix)~~ (fixed in 2936162) leases are used\r\n\r\nThe keys are translated to human readable (and json compatible) mac addresses on export, and back on import.\r\n\r\nI've also moved `self.leases[client_mac]['options']` to a separate object. It means we don't have to clean up the `self.leases` dict every time we save it.","created_at":"2015-06-24T15:26:04Z","updated_at":"2015-07-09T05:24:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d491e38dc898f2b86b0225de0c2dd74273cb4254","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/psychomario/PyPXE/pulls/110/commits","review_comments_url":"https://api.github.com/repos/psychomario/PyPXE/pulls/110/comments","review_comment_url":"https://api.github.com/repos/psychomario/PyPXE/pulls/comments{/number}","comments_url":"https://api.github.com/repos/psychomario/PyPXE/issues/110/comments","statuses_url":"https://api.github.com/repos/psychomario/PyPXE/statuses/50424781b76d77d1fceb33ba2378de9ccf7e592b","head":{"label":"psychomario:saveleases","ref":"saveleases","sha":"50424781b76d77d1fceb33ba2378de9ccf7e592b","user":{"login":"psychomario","id":1041406,"avatar_url":"https://avatars.githubusercontent.com/u/1041406?v=3","gravatar_id":"","url":"https://api.github.com/users/psychomario","html_url":"https://github.com/psychomario","followers_url":"https://api.github.com/users/psychomario/followers","following_url":"https://api.github.com/users/psychomario/following{/other_user}","gists_url":"https://api.github.com/users/psychomario/gists{/gist_id}","starred_url":"https://api.github.com/users/psychomario/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychomario/subscriptions","organizations_url":"https://api.github.com/users/psychomario/orgs","repos_url":"https://api.github.com/users/psychomario/repos","events_url":"https://api.github.com/users/psychomario/events{/privacy}","received_events_url":"https://api.github.com/users/psychomario/received_events","type":"User","site_admin":false},"repo":{"id":3298521,"name":"PyPXE","full_name":"psychomario/PyPXE","owner":{"login":"psychomario","id":1041406,"avatar_url":"https://avatars.githubusercontent.com/u/1041406?v=3","gravatar_id":"","url":"https://api.github.com/users/psychomario","html_url":"https://github.com/psychomario","followers_url":"https://api.github.com/users/psychomario/followers","following_url":"https://api.github.com/users/psychomario/following{/other_user}","gists_url":"https://api.github.com/users/psychomario/gists{/gist_id}","starred_url":"https://api.github.com/users/psychomario/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychomario/subscriptions","organizations_url":"https://api.github.com/users/psychomario/orgs","repos_url":"https://api.github.com/users/psychomario/repos","events_url":"https://api.github.com/users/psychomario/events{/privacy}","received_events_url":"https://api.github.com/users/psychomario/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/psychomario/PyPXE","description":"Pure Python2 PXE (DHCP-(Proxy)/TFTP/HTTP/NBD) Server","fork":false,"url":"https://api.github.com/repos/psychomario/PyPXE","forks_url":"https://api.github.com/repos/psychomario/PyPXE/forks","keys_url":"https://api.github.com/repos/psychomario/PyPXE/keys{/key_id}","collaborators_url":"https://api.github.com/repos/psychomario/PyPXE/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/psychomario/PyPXE/teams","hooks_url":"https://api.github.com/repos/psychomario/PyPXE/hooks","issue_events_url":"https://api.github.com/repos/psychomario/PyPXE/issues/events{/number}","events_url":"https://api.github.com/repos/psychomario/PyPXE/events","assignees_url":"https://api.github.com/repos/psychomario/PyPXE/assignees{/user}","branches_url":"https://api.github.com/repos/psychomario/PyPXE/branches{/branch}","tags_url":"https://api.github.com/repos/psychomario/PyPXE/tags","blobs_url":"https://api.github.com/repos/psychomario/PyPXE/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/psychomario/PyPXE/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/psychomario/PyPXE/git/refs{/sha}","trees_url":"https://api.github.com/repos/psychomario/PyPXE/git/trees{/sha}","statuses_url":"https://api.github.com/repos/psychomario/PyPXE/statuses/{sha}","languages_url":"https://api.github.com/repos/psychomario/PyPXE/languages","stargazers_url":"https://api.github.com/repos/psychomario/PyPXE/stargazers","contributors_url":"https://api.github.com/repos/psychomario/PyPXE/contributors","subscribers_url":"https://api.github.com/repos/psychomario/PyPXE/subscribers","subscription_url":"https://api.github.com/repos/psychomario/PyPXE/subscription","commits_url":"https://api.github.com/repos/psychomario/PyPXE/commits{/sha}","git_commits_url":"https://api.github.com/repos/psychomario/PyPXE/git/commits{/sha}","comments_url":"https://api.github.com/repos/psychomario/PyPXE/comments{/number}","issue_comment_url":"https://api.github.com/repos/psychomario/PyPXE/issues/comments{/number}","contents_url":"https://api.github.com/repos/psychomario/PyPXE/contents/{+path}","compare_url":"https://api.github.com/repos/psychomario/PyPXE/compare/{base}...{head}","merges_url":"https://api.github.com/repos/psychomario/PyPXE/merges","archive_url":"https://api.github.com/repos/psychomario/PyPXE/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/psychomario/PyPXE/downloads","issues_url":"https://api.github.com/repos/psychomario/PyPXE/issues{/number}","pulls_url":"https://api.github.com/repos/psychomario/PyPXE/pulls{/number}","milestones_url":"https://api.github.com/repos/psychomario/PyPXE/milestones{/number}","notifications_url":"https://api.github.com/repos/psychomario/PyPXE/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/psychomario/PyPXE/labels{/name}","releases_url":"https://api.github.com/repos/psychomario/PyPXE/releases{/id}","created_at":"2012-01-29T17:37:26Z","updated_at":"2015-06-19T08:08:49Z","pushed_at":"2015-06-25T14:08:43Z","git_url":"git://github.com/psychomario/PyPXE.git","ssh_url":"git@github.com:psychomario/PyPXE.git","clone_url":"https://github.com/psychomario/PyPXE.git","svn_url":"https://github.com/psychomario/PyPXE","homepage":"","size":10579,"stargazers_count":185,"watchers_count":185,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":9,"forks":30,"open_issues":9,"watchers":185,"default_branch":"master"}},"base":{"label":"psychomario:development","ref":"development","sha":"c0170fbe547436664d944856349cc7637b7c74eb","user":{"login":"psychomario","id":1041406,"avatar_url":"https://avatars.githubusercontent.com/u/1041406?v=3","gravatar_id":"","url":"https://api.github.com/users/psychomario","html_url":"https://github.com/psychomario","followers_url":"https://api.github.com/users/psychomario/followers","following_url":"https://api.github.com/users/psychomario/following{/other_user}","gists_url":"https://api.github.com/users/psychomario/gists{/gist_id}","starred_url":"https://api.github.com/users/psychomario/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychomario/subscriptions","organizations_url":"https://api.github.com/users/psychomario/orgs","repos_url":"https://api.github.com/users/psychomario/repos","events_url":"https://api.github.com/users/psychomario/events{/privacy}","received_events_url":"https://api.github.com/users/psychomario/received_events","type":"User","site_admin":false},"repo":{"id":3298521,"name":"PyPXE","full_name":"psychomario/PyPXE","owner":{"login":"psychomario","id":1041406,"avatar_url":"https://avatars.githubusercontent.com/u/1041406?v=3","gravatar_id":"","url":"https://api.github.com/users/psychomario","html_url":"https://github.com/psychomario","followers_url":"https://api.github.com/users/psychomario/followers","following_url":"https://api.github.com/users/psychomario/following{/other_user}","gists_url":"https://api.github.com/users/psychomario/gists{/gist_id}","starred_url":"https://api.github.com/users/psychomario/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychomario/subscriptions","organizations_url":"https://api.github.com/users/psychomario/orgs","repos_url":"https://api.github.com/users/psychomario/repos","events_url":"https://api.github.com/users/psychomario/events{/privacy}","received_events_url":"https://api.github.com/users/psychomario/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/psychomario/PyPXE","description":"Pure Python2 PXE (DHCP-(Proxy)/TFTP/HTTP/NBD) Server","fork":false,"url":"https://api.github.com/repos/psychomario/PyPXE","forks_url":"https://api.github.com/repos/psychomario/PyPXE/forks","keys_url":"https://api.github.com/repos/psychomario/PyPXE/keys{/key_id}","collaborators_url":"https://api.github.com/repos/psychomario/PyPXE/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/psychomario/PyPXE/teams","hooks_url":"https://api.github.com/repos/psychomario/PyPXE/hooks","issue_events_url":"https://api.github.com/repos/psychomario/PyPXE/issues/events{/number}","events_url":"https://api.github.com/repos/psychomario/PyPXE/events","assignees_url":"https://api.github.com/repos/psychomario/PyPXE/assignees{/user}","branches_url":"https://api.github.com/repos/psychomario/PyPXE/branches{/branch}","tags_url":"https://api.github.com/repos/psychomario/PyPXE/tags","blobs_url":"https://api.github.com/repos/psychomario/PyPXE/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/psychomario/PyPXE/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/psychomario/PyPXE/git/refs{/sha}","trees_url":"https://api.github.com/repos/psychomario/PyPXE/git/trees{/sha}","statuses_url":"https://api.github.com/repos/psychomario/PyPXE/statuses/{sha}","languages_url":"https://api.github.com/repos/psychomario/PyPXE/languages","stargazers_url":"https://api.github.com/repos/psychomario/PyPXE/stargazers","contributors_url":"https://api.github.com/repos/psychomario/PyPXE/contributors","subscribers_url":"https://api.github.com/repos/psychomario/PyPXE/subscribers","subscription_url":"https://api.github.com/repos/psychomario/PyPXE/subscription","commits_url":"https://api.github.com/repos/psychomario/PyPXE/commits{/sha}","git_commits_url":"https://api.github.com/repos/psychomario/PyPXE/git/commits{/sha}","comments_url":"https://api.github.com/repos/psychomario/PyPXE/comments{/number}","issue_comment_url":"https://api.github.com/repos/psychomario/PyPXE/issues/comments{/number}","contents_url":"https://api.github.com/repos/psychomario/PyPXE/contents/{+path}","compare_url":"https://api.github.com/repos/psychomario/PyPXE/compare/{base}...{head}","merges_url":"https://api.github.com/repos/psychomario/PyPXE/merges","archive_url":"https://api.github.com/repos/psychomario/PyPXE/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/psychomario/PyPXE/downloads","issues_url":"https://api.github.com/repos/psychomario/PyPXE/issues{/number}","pulls_url":"https://api.github.com/repos/psychomario/PyPXE/pulls{/number}","milestones_url":"https://api.github.com/repos/psychomario/PyPXE/milestones{/number}","notifications_url":"https://api.github.com/repos/psychomario/PyPXE/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/psychomario/PyPXE/labels{/name}","releases_url":"https://api.github.com/repos/psychomario/PyPXE/releases{/id}","created_at":"2012-01-29T17:37:26Z","updated_at":"2015-06-19T08:08:49Z","pushed_at":"2015-06-25T14:08:43Z","git_url":"git://github.com/psychomario/PyPXE.git","ssh_url":"git@github.com:psychomario/PyPXE.git","clone_url":"https://github.com/psychomario/PyPXE.git","svn_url":"https://github.com/psychomario/PyPXE","homepage":"","size":10579,"stargazers_count":185,"watchers_count":185,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":9,"forks":30,"open_issues":9,"watchers":185,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/psychomario/PyPXE/pulls/110"},"html":{"href":"https://github.com/psychomario/PyPXE/pull/110"},"issue":{"href":"https://api.github.com/repos/psychomario/PyPXE/issues/110"},"comments":{"href":"https://api.github.com/repos/psychomario/PyPXE/issues/110/comments"},"review_comments":{"href":"https://api.github.com/repos/psychomario/PyPXE/pulls/110/comments"},"review_comment":{"href":"https://api.github.com/repos/psychomario/PyPXE/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/psychomario/PyPXE/pulls/110/commits"},"statuses":{"href":"https://api.github.com/repos/psychomario/PyPXE/statuses/50424781b76d77d1fceb33ba2378de9ccf7e592b"}}}}