{"action":"created","comment":{"url":"https://api.github.com/repos/coreos/fleet/pulls/comments/23877938","id":23877938,"diff_hunk":"@@ -25,7 +25,7 @@ const (\n type MachineState struct {\n \tID       string\n \tPublicIP string\n-\tMetadata map[string]string\n+\tMetadata map[string]string `json:\"-\"`","path":"machine/state.go","position":5,"original_position":5,"commit_id":"2724a9d9044dfb0717fe326f7848967190fbf92d","original_commit_id":"2724a9d9044dfb0717fe326f7848967190fbf92d","user":{"login":"epipho","id":622665,"avatar_url":"https://avatars.githubusercontent.com/u/622665?v=3","gravatar_id":"","url":"https://api.github.com/users/epipho","html_url":"https://github.com/epipho","followers_url":"https://api.github.com/users/epipho/followers","following_url":"https://api.github.com/users/epipho/following{/other_user}","gists_url":"https://api.github.com/users/epipho/gists{/gist_id}","starred_url":"https://api.github.com/users/epipho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epipho/subscriptions","organizations_url":"https://api.github.com/users/epipho/orgs","repos_url":"https://api.github.com/users/epipho/repos","events_url":"https://api.github.com/users/epipho/events{/privacy}","received_events_url":"https://api.github.com/users/epipho/received_events","type":"User","site_admin":false},"body":"Yes. Since the metadata is no longer inside the main machine object, but rather in independent kv pairs, decoding the machine object could wipe out the metadata.\r\n\r\n","created_at":"2015-01-30T22:37:30Z","updated_at":"2015-01-30T22:37:30Z","html_url":"https://github.com/coreos/fleet/pull/1077#discussion_r23877938","pull_request_url":"https://api.github.com/repos/coreos/fleet/pulls/1077","_links":{"self":{"href":"https://api.github.com/repos/coreos/fleet/pulls/comments/23877938"},"html":{"href":"https://github.com/coreos/fleet/pull/1077#discussion_r23877938"},"pull_request":{"href":"https://api.github.com/repos/coreos/fleet/pulls/1077"}}},"pull_request":{"url":"https://api.github.com/repos/coreos/fleet/pulls/1077","id":26578156,"html_url":"https://github.com/coreos/fleet/pull/1077","diff_url":"https://github.com/coreos/fleet/pull/1077.diff","patch_url":"https://github.com/coreos/fleet/pull/1077.patch","issue_url":"https://api.github.com/repos/coreos/fleet/issues/1077","number":1077,"state":"open","locked":false,"title":"Dynamic Metadata","user":{"login":"epipho","id":622665,"avatar_url":"https://avatars.githubusercontent.com/u/622665?v=3","gravatar_id":"","url":"https://api.github.com/users/epipho","html_url":"https://github.com/epipho","followers_url":"https://api.github.com/users/epipho/followers","following_url":"https://api.github.com/users/epipho/following{/other_user}","gists_url":"https://api.github.com/users/epipho/gists{/gist_id}","starred_url":"https://api.github.com/users/epipho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epipho/subscriptions","organizations_url":"https://api.github.com/users/epipho/orgs","repos_url":"https://api.github.com/users/epipho/repos","events_url":"https://api.github.com/users/epipho/events{/privacy}","received_events_url":"https://api.github.com/users/epipho/received_events","type":"User","site_admin":false},"body":"This is a work in progress solution for #555 which provides the ability to update metadata on a running instance.  Please take a look at the progress so far to see if the approach makes sense.\r\n\r\n- Metadata has been moved out of the /object key in etcd and into individual etcd keys under <machID>/metadata to allow for individual updates to metadata values without fear of stepping on each other.\r\n- A new endpoint PATCH /machines/<mach_id> was created to handle metadata updates for a single machine. It takes a json document with 1 or more keys to update, example below.\r\n- Metadata supports per-value TTL. \r\n- Metadata keys can be removed by setting their value to null or empty string\r\n- Metadata in the machine heartbeat is ignored unless it is the first time it is seen. If the machine state needs to be created in etcd, the metadata in the heartbeat will be used as the starting point.\r\n\r\nExample PATCH request\r\n```\r\n{\r\n   \"foo\": { \"value\": \"bar\" },\r\n  \"baz\": {\"value\": \"stuff\"; \"ttl\": 30},\r\n  \"feh\": {\"value\": null }\r\n}\r\n```","created_at":"2014-12-25T09:12:10Z","updated_at":"2015-01-30T22:37:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8da447c820b012d8c9d4b795440947331f441c0d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coreos/fleet/pulls/1077/commits","review_comments_url":"https://api.github.com/repos/coreos/fleet/pulls/1077/comments","review_comment_url":"https://api.github.com/repos/coreos/fleet/pulls/comments/{number}","comments_url":"https://api.github.com/repos/coreos/fleet/issues/1077/comments","statuses_url":"https://api.github.com/repos/coreos/fleet/statuses/2724a9d9044dfb0717fe326f7848967190fbf92d","head":{"label":"epipho:dynamic-metadata","ref":"dynamic-metadata","sha":"2724a9d9044dfb0717fe326f7848967190fbf92d","user":{"login":"epipho","id":622665,"avatar_url":"https://avatars.githubusercontent.com/u/622665?v=3","gravatar_id":"","url":"https://api.github.com/users/epipho","html_url":"https://github.com/epipho","followers_url":"https://api.github.com/users/epipho/followers","following_url":"https://api.github.com/users/epipho/following{/other_user}","gists_url":"https://api.github.com/users/epipho/gists{/gist_id}","starred_url":"https://api.github.com/users/epipho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epipho/subscriptions","organizations_url":"https://api.github.com/users/epipho/orgs","repos_url":"https://api.github.com/users/epipho/repos","events_url":"https://api.github.com/users/epipho/events{/privacy}","received_events_url":"https://api.github.com/users/epipho/received_events","type":"User","site_admin":false},"repo":{"id":24780364,"name":"fleet","full_name":"epipho/fleet","owner":{"login":"epipho","id":622665,"avatar_url":"https://avatars.githubusercontent.com/u/622665?v=3","gravatar_id":"","url":"https://api.github.com/users/epipho","html_url":"https://github.com/epipho","followers_url":"https://api.github.com/users/epipho/followers","following_url":"https://api.github.com/users/epipho/following{/other_user}","gists_url":"https://api.github.com/users/epipho/gists{/gist_id}","starred_url":"https://api.github.com/users/epipho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epipho/subscriptions","organizations_url":"https://api.github.com/users/epipho/orgs","repos_url":"https://api.github.com/users/epipho/repos","events_url":"https://api.github.com/users/epipho/events{/privacy}","received_events_url":"https://api.github.com/users/epipho/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/epipho/fleet","description":"A Distributed init System","fork":true,"url":"https://api.github.com/repos/epipho/fleet","forks_url":"https://api.github.com/repos/epipho/fleet/forks","keys_url":"https://api.github.com/repos/epipho/fleet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/epipho/fleet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/epipho/fleet/teams","hooks_url":"https://api.github.com/repos/epipho/fleet/hooks","issue_events_url":"https://api.github.com/repos/epipho/fleet/issues/events{/number}","events_url":"https://api.github.com/repos/epipho/fleet/events","assignees_url":"https://api.github.com/repos/epipho/fleet/assignees{/user}","branches_url":"https://api.github.com/repos/epipho/fleet/branches{/branch}","tags_url":"https://api.github.com/repos/epipho/fleet/tags","blobs_url":"https://api.github.com/repos/epipho/fleet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/epipho/fleet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/epipho/fleet/git/refs{/sha}","trees_url":"https://api.github.com/repos/epipho/fleet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/epipho/fleet/statuses/{sha}","languages_url":"https://api.github.com/repos/epipho/fleet/languages","stargazers_url":"https://api.github.com/repos/epipho/fleet/stargazers","contributors_url":"https://api.github.com/repos/epipho/fleet/contributors","subscribers_url":"https://api.github.com/repos/epipho/fleet/subscribers","subscription_url":"https://api.github.com/repos/epipho/fleet/subscription","commits_url":"https://api.github.com/repos/epipho/fleet/commits{/sha}","git_commits_url":"https://api.github.com/repos/epipho/fleet/git/commits{/sha}","comments_url":"https://api.github.com/repos/epipho/fleet/comments{/number}","issue_comment_url":"https://api.github.com/repos/epipho/fleet/issues/comments/{number}","contents_url":"https://api.github.com/repos/epipho/fleet/contents/{+path}","compare_url":"https://api.github.com/repos/epipho/fleet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/epipho/fleet/merges","archive_url":"https://api.github.com/repos/epipho/fleet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/epipho/fleet/downloads","issues_url":"https://api.github.com/repos/epipho/fleet/issues{/number}","pulls_url":"https://api.github.com/repos/epipho/fleet/pulls{/number}","milestones_url":"https://api.github.com/repos/epipho/fleet/milestones{/number}","notifications_url":"https://api.github.com/repos/epipho/fleet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/epipho/fleet/labels{/name}","releases_url":"https://api.github.com/repos/epipho/fleet/releases{/id}","created_at":"2014-10-04T02:59:47Z","updated_at":"2015-01-15T04:24:56Z","pushed_at":"2015-01-15T05:53:18Z","git_url":"git://github.com/epipho/fleet.git","ssh_url":"git@github.com:epipho/fleet.git","clone_url":"https://github.com/epipho/fleet.git","svn_url":"https://github.com/epipho/fleet","homepage":"","size":6256,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"coreos:master","ref":"master","sha":"2865925320d5c4d7c80f62189100e41de24c7f39","user":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"repo":{"id":13512328,"name":"fleet","full_name":"coreos/fleet","owner":{"login":"coreos","id":3730757,"avatar_url":"https://avatars.githubusercontent.com/u/3730757?v=3","gravatar_id":"","url":"https://api.github.com/users/coreos","html_url":"https://github.com/coreos","followers_url":"https://api.github.com/users/coreos/followers","following_url":"https://api.github.com/users/coreos/following{/other_user}","gists_url":"https://api.github.com/users/coreos/gists{/gist_id}","starred_url":"https://api.github.com/users/coreos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreos/subscriptions","organizations_url":"https://api.github.com/users/coreos/orgs","repos_url":"https://api.github.com/users/coreos/repos","events_url":"https://api.github.com/users/coreos/events{/privacy}","received_events_url":"https://api.github.com/users/coreos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coreos/fleet","description":"A Distributed init System","fork":false,"url":"https://api.github.com/repos/coreos/fleet","forks_url":"https://api.github.com/repos/coreos/fleet/forks","keys_url":"https://api.github.com/repos/coreos/fleet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coreos/fleet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coreos/fleet/teams","hooks_url":"https://api.github.com/repos/coreos/fleet/hooks","issue_events_url":"https://api.github.com/repos/coreos/fleet/issues/events{/number}","events_url":"https://api.github.com/repos/coreos/fleet/events","assignees_url":"https://api.github.com/repos/coreos/fleet/assignees{/user}","branches_url":"https://api.github.com/repos/coreos/fleet/branches{/branch}","tags_url":"https://api.github.com/repos/coreos/fleet/tags","blobs_url":"https://api.github.com/repos/coreos/fleet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coreos/fleet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coreos/fleet/git/refs{/sha}","trees_url":"https://api.github.com/repos/coreos/fleet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coreos/fleet/statuses/{sha}","languages_url":"https://api.github.com/repos/coreos/fleet/languages","stargazers_url":"https://api.github.com/repos/coreos/fleet/stargazers","contributors_url":"https://api.github.com/repos/coreos/fleet/contributors","subscribers_url":"https://api.github.com/repos/coreos/fleet/subscribers","subscription_url":"https://api.github.com/repos/coreos/fleet/subscription","commits_url":"https://api.github.com/repos/coreos/fleet/commits{/sha}","git_commits_url":"https://api.github.com/repos/coreos/fleet/git/commits{/sha}","comments_url":"https://api.github.com/repos/coreos/fleet/comments{/number}","issue_comment_url":"https://api.github.com/repos/coreos/fleet/issues/comments/{number}","contents_url":"https://api.github.com/repos/coreos/fleet/contents/{+path}","compare_url":"https://api.github.com/repos/coreos/fleet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coreos/fleet/merges","archive_url":"https://api.github.com/repos/coreos/fleet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coreos/fleet/downloads","issues_url":"https://api.github.com/repos/coreos/fleet/issues{/number}","pulls_url":"https://api.github.com/repos/coreos/fleet/pulls{/number}","milestones_url":"https://api.github.com/repos/coreos/fleet/milestones{/number}","notifications_url":"https://api.github.com/repos/coreos/fleet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coreos/fleet/labels{/name}","releases_url":"https://api.github.com/repos/coreos/fleet/releases{/id}","created_at":"2013-10-11T23:56:38Z","updated_at":"2015-01-30T21:39:11Z","pushed_at":"2015-01-30T21:39:11Z","git_url":"git://github.com/coreos/fleet.git","ssh_url":"git@github.com:coreos/fleet.git","clone_url":"https://github.com/coreos/fleet.git","svn_url":"https://github.com/coreos/fleet","homepage":"","size":11638,"stargazers_count":1513,"watchers_count":1513,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":163,"mirror_url":null,"open_issues_count":89,"forks":163,"open_issues":89,"watchers":1513,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coreos/fleet/pulls/1077"},"html":{"href":"https://github.com/coreos/fleet/pull/1077"},"issue":{"href":"https://api.github.com/repos/coreos/fleet/issues/1077"},"comments":{"href":"https://api.github.com/repos/coreos/fleet/issues/1077/comments"},"review_comments":{"href":"https://api.github.com/repos/coreos/fleet/pulls/1077/comments"},"review_comment":{"href":"https://api.github.com/repos/coreos/fleet/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/coreos/fleet/pulls/1077/commits"},"statuses":{"href":"https://api.github.com/repos/coreos/fleet/statuses/2724a9d9044dfb0717fe326f7848967190fbf92d"}}}}