{"action":"created","comment":{"url":"https://api.github.com/repos/projectkudu/kudu/pulls/comments/25468627","id":25468627,"diff_hunk":"@@ -0,0 +1,176 @@\n+﻿using System;\n+using System.Globalization;\n+using System.IO;\n+using System.Net;\n+using System.Threading.Tasks;\n+using Kudu.Contracts.Infrastructure;\n+using Kudu.Contracts.SiteExtensions;\n+using Kudu.Core.Infrastructure;\n+using Kudu.Core.Settings;\n+using Newtonsoft.Json.Linq;\n+\n+namespace Kudu.Core.SiteExtensions\n+{\n+    public class SiteExtensionArmSettings : JsonSettings\n+    {\n+        private const string _statusSettingsFileName = \"SiteExtensionSetting.json\";\n+        private const string _provisioningStateSetting = \"provisioningState\";\n+        private const string _commentMessageSetting = \"comment\";\n+        private const string _statusSetting = \"status\";\n+        private const string _operationSetting = \"operation\";\n+\n+        private string _filePath;\n+        private LockFile _settingsLockFile;\n+        private LockFile _deleteLockFile;\n+        private JObject _cache;\n+\n+        public string ProvisioningState\n+        {\n+            get { return _cache.Value<string>(_provisioningStateSetting); }\n+            set { _cache[_provisioningStateSetting] = value; }\n+        }\n+\n+        public string Comment\n+        {\n+            get { return _cache.Value<string>(_commentMessageSetting); }\n+            set { _cache[_commentMessageSetting] = value; }\n+        }\n+\n+        public HttpStatusCode Status\n+        {\n+            get\n+            {\n+                string statusStr = _cache.Value<string>(_statusSetting);\n+                HttpStatusCode statusCode = HttpStatusCode.OK;\n+                Enum.TryParse<HttpStatusCode>(statusStr, out statusCode);\n+                return statusCode;\n+            }\n+            set { _cache[_statusSetting] = Enum.GetName(typeof(HttpStatusCode), value); }\n+        }\n+\n+        /// <summary>\n+        /// <para>Property to indicate current operation</para>\n+        /// <para>Empty/null means there is no recent operation</para>\n+        /// </summary>\n+        public string Operation\n+        {\n+            get { return _cache.Value<string>(_operationSetting); }\n+            set { _cache[_operationSetting] = value; }\n+        }\n+\n+        private SiteExtensionArmSettings(string path)\n+            : base(path)\n+        {\n+            _filePath = path;\n+            FileSystemHelpers.CreateDirectory(Path.GetDirectoryName(_filePath));\n+            _settingsLockFile = new LockFile(string.Format(CultureInfo.InvariantCulture, \"{0}.lock\", _filePath));\n+            _settingsLockFile.InitializeAsyncLocks();\n+\n+            string folderPath = Path.GetDirectoryName(_filePath);\n+            folderPath = folderPath.TrimEnd('\\\\');\n+            _deleteLockFile = new LockFile(string.Format(CultureInfo.InvariantCulture, \"{0}.del.lock\", folderPath));\n+            _deleteLockFile.InitializeAsyncLocks();","path":"Kudu.Core/SiteExtensions/SiteExtensionArmSettings.cs","position":72,"original_position":72,"commit_id":"c2fe16643884fbc0fec82ef7420392effb6b643e","original_commit_id":"c2fe16643884fbc0fec82ef7420392effb6b643e","user":{"login":"suwatch","id":1088218,"avatar_url":"https://avatars.githubusercontent.com/u/1088218?v=3","gravatar_id":"","url":"https://api.github.com/users/suwatch","html_url":"https://github.com/suwatch","followers_url":"https://api.github.com/users/suwatch/followers","following_url":"https://api.github.com/users/suwatch/following{/other_user}","gists_url":"https://api.github.com/users/suwatch/gists{/gist_id}","starred_url":"https://api.github.com/users/suwatch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suwatch/subscriptions","organizations_url":"https://api.github.com/users/suwatch/orgs","repos_url":"https://api.github.com/users/suwatch/repos","events_url":"https://api.github.com/users/suwatch/events{/privacy}","received_events_url":"https://api.github.com/users/suwatch/received_events","type":"User","site_admin":false},"body":"This delete lock is not necessary.  Just safe delete the folder should do.","created_at":"2015-02-26T21:54:34Z","updated_at":"2015-02-26T21:54:34Z","html_url":"https://github.com/projectkudu/kudu/pull/1472#discussion_r25468627","pull_request_url":"https://api.github.com/repos/projectkudu/kudu/pulls/1472","_links":{"self":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/comments/25468627"},"html":{"href":"https://github.com/projectkudu/kudu/pull/1472#discussion_r25468627"},"pull_request":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/1472"}}},"pull_request":{"url":"https://api.github.com/repos/projectkudu/kudu/pulls/1472","id":29746933,"html_url":"https://github.com/projectkudu/kudu/pull/1472","diff_url":"https://github.com/projectkudu/kudu/pull/1472.diff","patch_url":"https://github.com/projectkudu/kudu/pull/1472.patch","issue_url":"https://api.github.com/repos/projectkudu/kudu/issues/1472","number":1472,"state":"open","locked":false,"title":"Update site extension action to be ARM async","user":{"login":"shrimpy","id":79823,"avatar_url":"https://avatars.githubusercontent.com/u/79823?v=3","gravatar_id":"","url":"https://api.github.com/users/shrimpy","html_url":"https://github.com/shrimpy","followers_url":"https://api.github.com/users/shrimpy/followers","following_url":"https://api.github.com/users/shrimpy/following{/other_user}","gists_url":"https://api.github.com/users/shrimpy/gists{/gist_id}","starred_url":"https://api.github.com/users/shrimpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shrimpy/subscriptions","organizations_url":"https://api.github.com/users/shrimpy/orgs","repos_url":"https://api.github.com/users/shrimpy/repos","events_url":"https://api.github.com/users/shrimpy/events{/privacy}","received_events_url":"https://api.github.com/users/shrimpy/received_events","type":"User","site_admin":false},"body":"- Update install action to ARM async\r\n- Update other action to be ARM friendly (sync but when it is arm request, will wrap data inside ARM envelop)\r\n\r\n\r\nsample trace\r\n```xml\r\n<step title=\"Queue installation into background worker queue.\" date=\"2015-02-25T21:59:15.665\" instance=\"XIAOWU\" Accept=\"application/json\" Expect=\"100-continue\" Host=\"localhost:54866\" x-ms-geo-location=\"\" /><!-- duration: 2ms -->\r\n<step title=\"Perform installation with background worker.\" date=\"2015-02-25T21:59:15.669\" instance=\"XIAOWU\" >\r\n  <step title=\"Search package by id: bootstrap and version: 3.3.2\" date=\"2015-02-25T21:59:15.672\" /><!-- duration: 86ms -->\r\n  <step title=\"Install package: bootstrap.\" date=\"2015-02-25T21:59:15.760\" >\r\n    <step title=\"Download site extension: bootstrap.3.3.2\" date=\"2015-02-25T21:59:15.761\" /><!-- duration: 294ms -->\r\n    <step title=\"Check if applicationhost.xdt file existed.\" date=\"2015-02-25T21:59:16.056\" >\r\n      <step title=\"Missing xdt file, creating one.\" date=\"2015-02-25T21:59:16.058\" /><!-- duration: 1ms -->\r\n    </step><!-- duration: 5ms -->\r\n    <step title=\"Trigger site extension job\" date=\"2015-02-25T21:59:16.062\" /><!-- duration: 1ms -->\r\n  </step><!-- duration: 308ms -->\r\n  <step title=\"Update arm settings for bootstrap installation. Status: OK\" date=\"2015-02-25T21:59:16.153\" /><!-- duration: 9ms -->\r\n</step><!-- duration: 496ms -->\r\n\r\n```\r\n","created_at":"2015-02-21T02:21:07Z","updated_at":"2015-02-26T21:54:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8662ef55007d132a1cd27e58860702cdff066d46","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/projectkudu/kudu/pulls/1472/commits","review_comments_url":"https://api.github.com/repos/projectkudu/kudu/pulls/1472/comments","review_comment_url":"https://api.github.com/repos/projectkudu/kudu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectkudu/kudu/issues/1472/comments","statuses_url":"https://api.github.com/repos/projectkudu/kudu/statuses/c2fe16643884fbc0fec82ef7420392effb6b643e","head":{"label":"projectkudu:xiaowu-arm-async","ref":"xiaowu-arm-async","sha":"c2fe16643884fbc0fec82ef7420392effb6b643e","user":{"login":"projectkudu","id":927131,"avatar_url":"https://avatars.githubusercontent.com/u/927131?v=3","gravatar_id":"","url":"https://api.github.com/users/projectkudu","html_url":"https://github.com/projectkudu","followers_url":"https://api.github.com/users/projectkudu/followers","following_url":"https://api.github.com/users/projectkudu/following{/other_user}","gists_url":"https://api.github.com/users/projectkudu/gists{/gist_id}","starred_url":"https://api.github.com/users/projectkudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectkudu/subscriptions","organizations_url":"https://api.github.com/users/projectkudu/orgs","repos_url":"https://api.github.com/users/projectkudu/repos","events_url":"https://api.github.com/users/projectkudu/events{/privacy}","received_events_url":"https://api.github.com/users/projectkudu/received_events","type":"Organization","site_admin":false},"repo":{"id":1939769,"name":"kudu","full_name":"projectkudu/kudu","owner":{"login":"projectkudu","id":927131,"avatar_url":"https://avatars.githubusercontent.com/u/927131?v=3","gravatar_id":"","url":"https://api.github.com/users/projectkudu","html_url":"https://github.com/projectkudu","followers_url":"https://api.github.com/users/projectkudu/followers","following_url":"https://api.github.com/users/projectkudu/following{/other_user}","gists_url":"https://api.github.com/users/projectkudu/gists{/gist_id}","starred_url":"https://api.github.com/users/projectkudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectkudu/subscriptions","organizations_url":"https://api.github.com/users/projectkudu/orgs","repos_url":"https://api.github.com/users/projectkudu/repos","events_url":"https://api.github.com/users/projectkudu/events{/privacy}","received_events_url":"https://api.github.com/users/projectkudu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectkudu/kudu","description":"Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.","fork":false,"url":"https://api.github.com/repos/projectkudu/kudu","forks_url":"https://api.github.com/repos/projectkudu/kudu/forks","keys_url":"https://api.github.com/repos/projectkudu/kudu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectkudu/kudu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectkudu/kudu/teams","hooks_url":"https://api.github.com/repos/projectkudu/kudu/hooks","issue_events_url":"https://api.github.com/repos/projectkudu/kudu/issues/events{/number}","events_url":"https://api.github.com/repos/projectkudu/kudu/events","assignees_url":"https://api.github.com/repos/projectkudu/kudu/assignees{/user}","branches_url":"https://api.github.com/repos/projectkudu/kudu/branches{/branch}","tags_url":"https://api.github.com/repos/projectkudu/kudu/tags","blobs_url":"https://api.github.com/repos/projectkudu/kudu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectkudu/kudu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectkudu/kudu/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectkudu/kudu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectkudu/kudu/statuses/{sha}","languages_url":"https://api.github.com/repos/projectkudu/kudu/languages","stargazers_url":"https://api.github.com/repos/projectkudu/kudu/stargazers","contributors_url":"https://api.github.com/repos/projectkudu/kudu/contributors","subscribers_url":"https://api.github.com/repos/projectkudu/kudu/subscribers","subscription_url":"https://api.github.com/repos/projectkudu/kudu/subscription","commits_url":"https://api.github.com/repos/projectkudu/kudu/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectkudu/kudu/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectkudu/kudu/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectkudu/kudu/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectkudu/kudu/contents/{+path}","compare_url":"https://api.github.com/repos/projectkudu/kudu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectkudu/kudu/merges","archive_url":"https://api.github.com/repos/projectkudu/kudu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectkudu/kudu/downloads","issues_url":"https://api.github.com/repos/projectkudu/kudu/issues{/number}","pulls_url":"https://api.github.com/repos/projectkudu/kudu/pulls{/number}","milestones_url":"https://api.github.com/repos/projectkudu/kudu/milestones{/number}","notifications_url":"https://api.github.com/repos/projectkudu/kudu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectkudu/kudu/labels{/name}","releases_url":"https://api.github.com/repos/projectkudu/kudu/releases{/id}","created_at":"2011-06-23T05:36:20Z","updated_at":"2015-02-26T21:53:15Z","pushed_at":"2015-02-26T20:29:19Z","git_url":"git://github.com/projectkudu/kudu.git","ssh_url":"git@github.com:projectkudu/kudu.git","clone_url":"https://github.com/projectkudu/kudu.git","svn_url":"https://github.com/projectkudu/kudu","homepage":"","size":45364,"stargazers_count":850,"watchers_count":850,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":172,"mirror_url":null,"open_issues_count":104,"forks":172,"open_issues":104,"watchers":850,"default_branch":"master"}},"base":{"label":"projectkudu:master","ref":"master","sha":"67a281c2e7e931f31e8434d9130e035ed3759992","user":{"login":"projectkudu","id":927131,"avatar_url":"https://avatars.githubusercontent.com/u/927131?v=3","gravatar_id":"","url":"https://api.github.com/users/projectkudu","html_url":"https://github.com/projectkudu","followers_url":"https://api.github.com/users/projectkudu/followers","following_url":"https://api.github.com/users/projectkudu/following{/other_user}","gists_url":"https://api.github.com/users/projectkudu/gists{/gist_id}","starred_url":"https://api.github.com/users/projectkudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectkudu/subscriptions","organizations_url":"https://api.github.com/users/projectkudu/orgs","repos_url":"https://api.github.com/users/projectkudu/repos","events_url":"https://api.github.com/users/projectkudu/events{/privacy}","received_events_url":"https://api.github.com/users/projectkudu/received_events","type":"Organization","site_admin":false},"repo":{"id":1939769,"name":"kudu","full_name":"projectkudu/kudu","owner":{"login":"projectkudu","id":927131,"avatar_url":"https://avatars.githubusercontent.com/u/927131?v=3","gravatar_id":"","url":"https://api.github.com/users/projectkudu","html_url":"https://github.com/projectkudu","followers_url":"https://api.github.com/users/projectkudu/followers","following_url":"https://api.github.com/users/projectkudu/following{/other_user}","gists_url":"https://api.github.com/users/projectkudu/gists{/gist_id}","starred_url":"https://api.github.com/users/projectkudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectkudu/subscriptions","organizations_url":"https://api.github.com/users/projectkudu/orgs","repos_url":"https://api.github.com/users/projectkudu/repos","events_url":"https://api.github.com/users/projectkudu/events{/privacy}","received_events_url":"https://api.github.com/users/projectkudu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectkudu/kudu","description":"Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.","fork":false,"url":"https://api.github.com/repos/projectkudu/kudu","forks_url":"https://api.github.com/repos/projectkudu/kudu/forks","keys_url":"https://api.github.com/repos/projectkudu/kudu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectkudu/kudu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectkudu/kudu/teams","hooks_url":"https://api.github.com/repos/projectkudu/kudu/hooks","issue_events_url":"https://api.github.com/repos/projectkudu/kudu/issues/events{/number}","events_url":"https://api.github.com/repos/projectkudu/kudu/events","assignees_url":"https://api.github.com/repos/projectkudu/kudu/assignees{/user}","branches_url":"https://api.github.com/repos/projectkudu/kudu/branches{/branch}","tags_url":"https://api.github.com/repos/projectkudu/kudu/tags","blobs_url":"https://api.github.com/repos/projectkudu/kudu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectkudu/kudu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectkudu/kudu/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectkudu/kudu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectkudu/kudu/statuses/{sha}","languages_url":"https://api.github.com/repos/projectkudu/kudu/languages","stargazers_url":"https://api.github.com/repos/projectkudu/kudu/stargazers","contributors_url":"https://api.github.com/repos/projectkudu/kudu/contributors","subscribers_url":"https://api.github.com/repos/projectkudu/kudu/subscribers","subscription_url":"https://api.github.com/repos/projectkudu/kudu/subscription","commits_url":"https://api.github.com/repos/projectkudu/kudu/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectkudu/kudu/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectkudu/kudu/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectkudu/kudu/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectkudu/kudu/contents/{+path}","compare_url":"https://api.github.com/repos/projectkudu/kudu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectkudu/kudu/merges","archive_url":"https://api.github.com/repos/projectkudu/kudu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectkudu/kudu/downloads","issues_url":"https://api.github.com/repos/projectkudu/kudu/issues{/number}","pulls_url":"https://api.github.com/repos/projectkudu/kudu/pulls{/number}","milestones_url":"https://api.github.com/repos/projectkudu/kudu/milestones{/number}","notifications_url":"https://api.github.com/repos/projectkudu/kudu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectkudu/kudu/labels{/name}","releases_url":"https://api.github.com/repos/projectkudu/kudu/releases{/id}","created_at":"2011-06-23T05:36:20Z","updated_at":"2015-02-26T21:53:15Z","pushed_at":"2015-02-26T20:29:19Z","git_url":"git://github.com/projectkudu/kudu.git","ssh_url":"git@github.com:projectkudu/kudu.git","clone_url":"https://github.com/projectkudu/kudu.git","svn_url":"https://github.com/projectkudu/kudu","homepage":"","size":45364,"stargazers_count":850,"watchers_count":850,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":172,"mirror_url":null,"open_issues_count":104,"forks":172,"open_issues":104,"watchers":850,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/1472"},"html":{"href":"https://github.com/projectkudu/kudu/pull/1472"},"issue":{"href":"https://api.github.com/repos/projectkudu/kudu/issues/1472"},"comments":{"href":"https://api.github.com/repos/projectkudu/kudu/issues/1472/comments"},"review_comments":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/1472/comments"},"review_comment":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/1472/commits"},"statuses":{"href":"https://api.github.com/repos/projectkudu/kudu/statuses/c2fe16643884fbc0fec82ef7420392effb6b643e"}}}}