{"action":"created","comment":{"url":"https://api.github.com/repos/NixOS/nixops/pulls/comments/230659094","pull_request_review_id":171443840,"id":230659094,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDY1OTA5NA==","diff_hunk":"@@ -0,0 +1,356 @@\n+# -*- coding: utf-8 -*-\n+\n+import nixops.deployment\n+from nixops.state.state_helper import _create_resource_state\n+import os\n+import os.path\n+import sys\n+import threading\n+import fcntl\n+import re\n+import json\n+import copy\n+\n+from uuid import uuid1 as gen_uuid\n+\n+class TransactionalJsonFile:\n+    \"\"\"\n+        Transactional access to a JSON file, with support\n+        of nested transactions.","path":"nixops/state/json_file.py","position":19,"original_position":19,"commit_id":"7c152552081a6f0fcdbc8f3faa9e2037b1f85970","original_commit_id":"7c152552081a6f0fcdbc8f3faa9e2037b1f85970","user":{"login":"coretemp","id":34454443,"node_id":"MDQ6VXNlcjM0NDU0NDQz","avatar_url":"https://avatars0.githubusercontent.com/u/34454443?v=4","gravatar_id":"","url":"https://api.github.com/users/coretemp","html_url":"https://github.com/coretemp","followers_url":"https://api.github.com/users/coretemp/followers","following_url":"https://api.github.com/users/coretemp/following{/other_user}","gists_url":"https://api.github.com/users/coretemp/gists{/gist_id}","starred_url":"https://api.github.com/users/coretemp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coretemp/subscriptions","organizations_url":"https://api.github.com/users/coretemp/orgs","repos_url":"https://api.github.com/users/coretemp/repos","events_url":"https://api.github.com/users/coretemp/events{/privacy}","received_events_url":"https://api.github.com/users/coretemp/received_events","type":"User","site_admin":false},"body":"of -> for","created_at":"2018-11-05T08:07:49Z","updated_at":"2018-11-05T08:07:49Z","html_url":"https://github.com/NixOS/nixops/pull/969#discussion_r230659094","pull_request_url":"https://api.github.com/repos/NixOS/nixops/pulls/969","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/NixOS/nixops/pulls/comments/230659094"},"html":{"href":"https://github.com/NixOS/nixops/pull/969#discussion_r230659094"},"pull_request":{"href":"https://api.github.com/repos/NixOS/nixops/pulls/969"}}},"pull_request":{"url":"https://api.github.com/repos/NixOS/nixops/pulls/969","id":194797738,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0Nzk3NzM4","html_url":"https://github.com/NixOS/nixops/pull/969","diff_url":"https://github.com/NixOS/nixops/pull/969.diff","patch_url":"https://github.com/NixOS/nixops/pull/969.patch","issue_url":"https://api.github.com/repos/NixOS/nixops/issues/969","number":969,"state":"open","locked":false,"title":"Key value state + tests refactoring ","user":{"login":"srghma","id":7573215,"node_id":"MDQ6VXNlcjc1NzMyMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/7573215?v=4","gravatar_id":"","url":"https://api.github.com/users/srghma","html_url":"https://github.com/srghma","followers_url":"https://api.github.com/users/srghma/followers","following_url":"https://api.github.com/users/srghma/following{/other_user}","gists_url":"https://api.github.com/users/srghma/gists{/gist_id}","starred_url":"https://api.github.com/users/srghma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srghma/subscriptions","organizations_url":"https://api.github.com/users/srghma/orgs","repos_url":"https://api.github.com/users/srghma/repos","events_url":"https://api.github.com/users/srghma/events{/privacy}","received_events_url":"https://api.github.com/users/srghma/received_events","type":"User","site_admin":false},"body":"This pr consumes:\r\n- https://github.com/NixOS/nixops/pull/865\r\n- https://github.com/NixOS/nixops/pull/624\r\n\r\nTests done:\r\n- [x] python2 tests.py tests.functional.test_cloning_clones [`libvirtd, vbox, ec2`](https://pastebin.com/kM48PaDX), [`amazon`](https://pastebin.com/JZA1kEpe), [`gce`](https://pastebin.com/Ph5GNg9B)\r\n- [x] python2 tests.py tests.functional.test_deleting_deletes [vbox, ec2, libvritd, gce, azure](https://pastebin.com/RAAcMg8c)\r\n- [x] python2 tests.py tests.functional.test_deploys_nixos [vbox, ec2, ec2_spot](https://pastebin.com/LtmMv4nZ) / [libvritd](https://pastebin.com/iXuj45rM) / [`amazon`](https://paste.ee/p/W4Lqp), [`gce`](https://pastebin.com/fgKrsanu)\r\n- [x] [python2 tests.py tests.functional.test_ec2_backups](https://pastebin.com/VNPdx3iE)\r\n- [x] python2 tests.py tests.functional.test_ec2_rds_dbinstance ([ec2-rds-dbinstance.nix](https://pastebin.com/F644s9N3)) / ec2-rds-dbinstance-sg.nix (NOT TESTED, BECAUSE LEGACY)\r\n- [x] python2 tests.py tests.functional.test_invalid_indentifier (https://pastebin.com/GLnMAyS0)\r\n- [x] python2 tests.py tests.functional.test_query_deployments (https://pastebin.com/7mLW2bwB)\r\n- [x] python2 tests.py tests.functional.test_rebooting_reboots [`vbox, libvirtd`](https://pastebin.com/5dGJecDZ), [`ec2`](https://pastebin.com/YPvubtwr), [`amazon nixops`](https://pastebin.com/T6gbamRp), [`amazon json`](https://pastebin.com/NuhaijS4), [`gce`](https://pastebin.com/QWTk0Nev)\r\n- [x] python2 tests.py tests.functional.test_rollback_rollsback  [`vbox, libvirtd`](https://pastebin.com/hQn1iQsz), [`ec2`](https://pastebin.com/cHggXjj1), [`amazon`](https://paste.ee/p/q4joX), [`gce`](https://pastebin.com/4911kuPw)\r\n- [x] python2 tests.py tests.functional.test_send_keys_sends_keys [`vbox, libvirtd`](https://pastebin.com/FmTsNJ2R), [`ec2`](https://pastebin.com/MbZTAU0U), [`amazon`](https://paste.ee/p/pNd10), [`gce`](https://pastebin.com/ENQE3AUa)\r\n- [x] python2 tests.py tests.functional.test_starting_starts [`vbox, libvirtd`](https://pastebin.com/JtHDbRXu), [`ec2`](https://pastebin.com/RkmQscGe), [`amazon json`](https://pastebin.com/4rFeAmSg), [`amazon nixops`](https://pastebin.com/vM8ecGJp), [`gce`](https://pastebin.com/S4JDdH8U)\r\n- [x] python2 tests.py tests.functional.test_stopping_stops [`vbox`](https://pastebin.com/zfjePdRR), [`libvirtd`](https://pastebin.com/LAtVPyP2), [`ec2`](https://pastebin.com/UA0fBTKA), [`amazon json`](https://pastebin.com/6P6s7QZP), [`amazon nixops`](https://pastebin.com/QymmSaLj), [`gce`](https://pastebin.com/V1bmk7tt)\r\n- [x] [python2 tests.py tests.functional.test_vbox_encrypted_links](https://pastebin.com/F4VfirsY)\r\n- [x] python2 tests.py tests.functional.test_vpc: [test_deploy_vpc](https://pastebin.com/Gcbf0uB7) [test_deploy_vpc_machine](https://pastebin.com/dqfJhMtB)  [test_enable_dns_support](https://pastebin.com/8b6pTbGX) [test_enable_ipv6](https://pastebin.com/MTp6wi00) [test_deploy_subnets](https://pastebin.com/9Zab5Mn9) [test_deploy_nat_gtw](https://paste.ee/p/BxgmW)  \r\n- [ ] hertzner tests\r\n\r\nTODOs:\r\n- [x] each test has its own store file (for tests parallelization)\r\n- [x] `python2 tests.py tests.functional.test_cloning_clones -vv` once in 5 times throws error https://pastebin.com/fe7njGJH\r\n- [x] `tests.functional.test_stopping_stops` with ec2 issue https://pastebin.com/BJwKMWti (fix https://github.com/NixOS/nixops/pull/969/commits/898107cb047bd59b512af524d15bf8daf71ec61e). I suppose this bug occured in this test because aws returns termination responce faster if instance already stopped, just after that nixops tries to remove security group, and fails, try remove fix and you will see it youself\r\n- [x] `tests.functional.test_stopping_stops` with libvirt issue https://pastebin.com/e4VLG8Cc\r\n- [x] `tests.functional.test_ec2_rds_dbinstance` not working https://github.com/NixOS/nixops/issues/970\r\n- [x] `python2 tests.py tests.functional.test_vpc:test_deploy_vpc -vv` no working with json state file https://pastebin.com/N8E90uke (fix https://github.com/NixOS/nixops/pull/969/commits/e1b9158f67dc7673e9d84eaf9e3a5b73c21cb31a)\r\n- [x] `python2 tests.py tests.functional.test_vpc:test_deploy_vpc_machine -vv` not working (https://pastebin.com/hqYBi7hF)\r\n\r\nCONSIDER (dont mind it :smile:, just thoughts):\r\n- not use StateDict at all because it makes return value type vague, you can put array but get string, use `nixops.utils.attr_property` instead (also StateDict should be named ResourceStateDict, because only ResourceState can use it)\r\n- substitute every `isinstance(XXX, basestring)` with ` isinstance(XXX, six.text_type)`\r\n- all `nixops.util.attr_property` should be wrapped in `with self.db`, maybe highlight their name like `self.state_prop_XXX`\r\n- in `tests.functional.shared.destroy_deployments_and_remove_state_file` dont ignore `'VirtualBoxState' object has no attribute 'get_backups'` error https://pastebin.com/W228z0rN","created_at":"2018-06-14T07:12:20Z","updated_at":"2018-11-05T08:07:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"974534f91f93c46cd15696d6024685ea8ee1d437","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/NixOS/nixops/pulls/969/commits","review_comments_url":"https://api.github.com/repos/NixOS/nixops/pulls/969/comments","review_comment_url":"https://api.github.com/repos/NixOS/nixops/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NixOS/nixops/issues/969/comments","statuses_url":"https://api.github.com/repos/NixOS/nixops/statuses/7c152552081a6f0fcdbc8f3faa9e2037b1f85970","head":{"label":"srghma:kv-state","ref":"kv-state","sha":"7c152552081a6f0fcdbc8f3faa9e2037b1f85970","user":{"login":"srghma","id":7573215,"node_id":"MDQ6VXNlcjc1NzMyMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/7573215?v=4","gravatar_id":"","url":"https://api.github.com/users/srghma","html_url":"https://github.com/srghma","followers_url":"https://api.github.com/users/srghma/followers","following_url":"https://api.github.com/users/srghma/following{/other_user}","gists_url":"https://api.github.com/users/srghma/gists{/gist_id}","starred_url":"https://api.github.com/users/srghma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srghma/subscriptions","organizations_url":"https://api.github.com/users/srghma/orgs","repos_url":"https://api.github.com/users/srghma/repos","events_url":"https://api.github.com/users/srghma/events{/privacy}","received_events_url":"https://api.github.com/users/srghma/received_events","type":"User","site_admin":false},"repo":{"id":135801080,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU4MDEwODA=","name":"nixops","full_name":"srghma/nixops","private":false,"owner":{"login":"srghma","id":7573215,"node_id":"MDQ6VXNlcjc1NzMyMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/7573215?v=4","gravatar_id":"","url":"https://api.github.com/users/srghma","html_url":"https://github.com/srghma","followers_url":"https://api.github.com/users/srghma/followers","following_url":"https://api.github.com/users/srghma/following{/other_user}","gists_url":"https://api.github.com/users/srghma/gists{/gist_id}","starred_url":"https://api.github.com/users/srghma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srghma/subscriptions","organizations_url":"https://api.github.com/users/srghma/orgs","repos_url":"https://api.github.com/users/srghma/repos","events_url":"https://api.github.com/users/srghma/events{/privacy}","received_events_url":"https://api.github.com/users/srghma/received_events","type":"User","site_admin":false},"html_url":"https://github.com/srghma/nixops","description":"NixOps, the NixOS-based cloud deployment tool","fork":true,"url":"https://api.github.com/repos/srghma/nixops","forks_url":"https://api.github.com/repos/srghma/nixops/forks","keys_url":"https://api.github.com/repos/srghma/nixops/keys{/key_id}","collaborators_url":"https://api.github.com/repos/srghma/nixops/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/srghma/nixops/teams","hooks_url":"https://api.github.com/repos/srghma/nixops/hooks","issue_events_url":"https://api.github.com/repos/srghma/nixops/issues/events{/number}","events_url":"https://api.github.com/repos/srghma/nixops/events","assignees_url":"https://api.github.com/repos/srghma/nixops/assignees{/user}","branches_url":"https://api.github.com/repos/srghma/nixops/branches{/branch}","tags_url":"https://api.github.com/repos/srghma/nixops/tags","blobs_url":"https://api.github.com/repos/srghma/nixops/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/srghma/nixops/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/srghma/nixops/git/refs{/sha}","trees_url":"https://api.github.com/repos/srghma/nixops/git/trees{/sha}","statuses_url":"https://api.github.com/repos/srghma/nixops/statuses/{sha}","languages_url":"https://api.github.com/repos/srghma/nixops/languages","stargazers_url":"https://api.github.com/repos/srghma/nixops/stargazers","contributors_url":"https://api.github.com/repos/srghma/nixops/contributors","subscribers_url":"https://api.github.com/repos/srghma/nixops/subscribers","subscription_url":"https://api.github.com/repos/srghma/nixops/subscription","commits_url":"https://api.github.com/repos/srghma/nixops/commits{/sha}","git_commits_url":"https://api.github.com/repos/srghma/nixops/git/commits{/sha}","comments_url":"https://api.github.com/repos/srghma/nixops/comments{/number}","issue_comment_url":"https://api.github.com/repos/srghma/nixops/issues/comments{/number}","contents_url":"https://api.github.com/repos/srghma/nixops/contents/{+path}","compare_url":"https://api.github.com/repos/srghma/nixops/compare/{base}...{head}","merges_url":"https://api.github.com/repos/srghma/nixops/merges","archive_url":"https://api.github.com/repos/srghma/nixops/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/srghma/nixops/downloads","issues_url":"https://api.github.com/repos/srghma/nixops/issues{/number}","pulls_url":"https://api.github.com/repos/srghma/nixops/pulls{/number}","milestones_url":"https://api.github.com/repos/srghma/nixops/milestones{/number}","notifications_url":"https://api.github.com/repos/srghma/nixops/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/srghma/nixops/labels{/name}","releases_url":"https://api.github.com/repos/srghma/nixops/releases{/id}","deployments_url":"https://api.github.com/repos/srghma/nixops/deployments","created_at":"2018-06-02T08:32:00Z","updated_at":"2018-06-02T08:32:03Z","pushed_at":"2018-09-05T15:08:24Z","git_url":"git://github.com/srghma/nixops.git","ssh_url":"git@github.com:srghma/nixops.git","clone_url":"https://github.com/srghma/nixops.git","svn_url":"https://github.com/srghma/nixops","homepage":"http://nixos.org/","size":5380,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NixOS:master","ref":"master","sha":"38119201ec7386dc88d0087e796a30bdb2b5f0cb","user":{"login":"NixOS","id":487568,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ4NzU2OA==","avatar_url":"https://avatars3.githubusercontent.com/u/487568?v=4","gravatar_id":"","url":"https://api.github.com/users/NixOS","html_url":"https://github.com/NixOS","followers_url":"https://api.github.com/users/NixOS/followers","following_url":"https://api.github.com/users/NixOS/following{/other_user}","gists_url":"https://api.github.com/users/NixOS/gists{/gist_id}","starred_url":"https://api.github.com/users/NixOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NixOS/subscriptions","organizations_url":"https://api.github.com/users/NixOS/orgs","repos_url":"https://api.github.com/users/NixOS/repos","events_url":"https://api.github.com/users/NixOS/events{/privacy}","received_events_url":"https://api.github.com/users/NixOS/received_events","type":"Organization","site_admin":false},"repo":{"id":2637203,"node_id":"MDEwOlJlcG9zaXRvcnkyNjM3MjAz","name":"nixops","full_name":"NixOS/nixops","private":false,"owner":{"login":"NixOS","id":487568,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ4NzU2OA==","avatar_url":"https://avatars3.githubusercontent.com/u/487568?v=4","gravatar_id":"","url":"https://api.github.com/users/NixOS","html_url":"https://github.com/NixOS","followers_url":"https://api.github.com/users/NixOS/followers","following_url":"https://api.github.com/users/NixOS/following{/other_user}","gists_url":"https://api.github.com/users/NixOS/gists{/gist_id}","starred_url":"https://api.github.com/users/NixOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NixOS/subscriptions","organizations_url":"https://api.github.com/users/NixOS/orgs","repos_url":"https://api.github.com/users/NixOS/repos","events_url":"https://api.github.com/users/NixOS/events{/privacy}","received_events_url":"https://api.github.com/users/NixOS/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/NixOS/nixops","description":"NixOps, the NixOS-based cloud deployment tool","fork":false,"url":"https://api.github.com/repos/NixOS/nixops","forks_url":"https://api.github.com/repos/NixOS/nixops/forks","keys_url":"https://api.github.com/repos/NixOS/nixops/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NixOS/nixops/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NixOS/nixops/teams","hooks_url":"https://api.github.com/repos/NixOS/nixops/hooks","issue_events_url":"https://api.github.com/repos/NixOS/nixops/issues/events{/number}","events_url":"https://api.github.com/repos/NixOS/nixops/events","assignees_url":"https://api.github.com/repos/NixOS/nixops/assignees{/user}","branches_url":"https://api.github.com/repos/NixOS/nixops/branches{/branch}","tags_url":"https://api.github.com/repos/NixOS/nixops/tags","blobs_url":"https://api.github.com/repos/NixOS/nixops/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NixOS/nixops/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NixOS/nixops/git/refs{/sha}","trees_url":"https://api.github.com/repos/NixOS/nixops/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NixOS/nixops/statuses/{sha}","languages_url":"https://api.github.com/repos/NixOS/nixops/languages","stargazers_url":"https://api.github.com/repos/NixOS/nixops/stargazers","contributors_url":"https://api.github.com/repos/NixOS/nixops/contributors","subscribers_url":"https://api.github.com/repos/NixOS/nixops/subscribers","subscription_url":"https://api.github.com/repos/NixOS/nixops/subscription","commits_url":"https://api.github.com/repos/NixOS/nixops/commits{/sha}","git_commits_url":"https://api.github.com/repos/NixOS/nixops/git/commits{/sha}","comments_url":"https://api.github.com/repos/NixOS/nixops/comments{/number}","issue_comment_url":"https://api.github.com/repos/NixOS/nixops/issues/comments{/number}","contents_url":"https://api.github.com/repos/NixOS/nixops/contents/{+path}","compare_url":"https://api.github.com/repos/NixOS/nixops/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NixOS/nixops/merges","archive_url":"https://api.github.com/repos/NixOS/nixops/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NixOS/nixops/downloads","issues_url":"https://api.github.com/repos/NixOS/nixops/issues{/number}","pulls_url":"https://api.github.com/repos/NixOS/nixops/pulls{/number}","milestones_url":"https://api.github.com/repos/NixOS/nixops/milestones{/number}","notifications_url":"https://api.github.com/repos/NixOS/nixops/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NixOS/nixops/labels{/name}","releases_url":"https://api.github.com/repos/NixOS/nixops/releases{/id}","deployments_url":"https://api.github.com/repos/NixOS/nixops/deployments","created_at":"2011-10-24T15:49:58Z","updated_at":"2018-11-04T19:38:34Z","pushed_at":"2018-11-04T23:26:00Z","git_url":"git://github.com/NixOS/nixops.git","ssh_url":"git@github.com:NixOS/nixops.git","clone_url":"https://github.com/NixOS/nixops.git","svn_url":"https://github.com/NixOS/nixops","homepage":"http://nixos.org/","size":5227,"stargazers_count":453,"watchers_count":453,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":222,"mirror_url":null,"archived":false,"open_issues_count":374,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":222,"open_issues":374,"watchers":453,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NixOS/nixops/pulls/969"},"html":{"href":"https://github.com/NixOS/nixops/pull/969"},"issue":{"href":"https://api.github.com/repos/NixOS/nixops/issues/969"},"comments":{"href":"https://api.github.com/repos/NixOS/nixops/issues/969/comments"},"review_comments":{"href":"https://api.github.com/repos/NixOS/nixops/pulls/969/comments"},"review_comment":{"href":"https://api.github.com/repos/NixOS/nixops/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NixOS/nixops/pulls/969/commits"},"statuses":{"href":"https://api.github.com/repos/NixOS/nixops/statuses/7c152552081a6f0fcdbc8f3faa9e2037b1f85970"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"coretemp"}}