{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/comments/77228956","id":77228956,"diff_hunk":"@@ -182,8 +189,27 @@ def list_flavor(self):\n     def list_network(self):\n         raise NotImplementedError('list_network not implemented.')\n \n-    def vm_creation_time(self, vm_name):\n-        raise NotImplementedError('vm_creation_time not implemented.')\n+    def vm_creation_time(self, vm_name, resource_group=None):\n+        self.logger.info(\"Attempting to Retrieve Azure VM Modification Time {}\".format(vm_name))\n+        vm_vhd = self.get_vm_vhd(vm_name, resource_group or self.resource_group)\n+        vhd_name = os.path.split(urlparse.urlparse(vm_vhd).path)[1]\n+        data = self.run_script(\n+            \"\"\"\n+            Invoke-Command -scriptblock {{\n+            $storageContext = New-AzureStorageContext -StorageAccountName \\\"{storage_account}\\\" `\n+                            -StorageAccountKey \\\"{storage_key}\\\"\n+            Get-AzureStorageBlob -Name \\\"{storage_blob}\\\" `\n+                            -Context $storageContext -Blob \\\"{vhd_blob}\\\" | convertto-xml -as String\n+            }}\n+            \"\"\".format(storage_account=self.storage_account,\n+                       storage_blob=self.storage_blob,\n+                       storage_key=self.storage_key,\n+                       vhd_blob=vhd_name), True)\n+        vhd_last_modified = etree.parse(StringIO(self.clean_azure_xml(data))).getroot().xpath(\n+            \"./Object/Property[@Name='LastModified']/text()\")\n+        create_time = datetime.strptime(str(vhd_last_modified), '[\\'%m/%d/%Y %H:%M:%S %p +00:00\\']')\n+        self.logger.info(\"VM last edit time based on vhd =  {}\".format(str(create_time)))","path":"mgmtsystem/azure.py","position":89,"original_position":89,"commit_id":"c7cc1a22a759b4a8b794ece898c1345de046dd4d","original_commit_id":"c7cc1a22a759b4a8b794ece898c1345de046dd4d","user":{"login":"jteehan","id":13650298,"avatar_url":"https://avatars.githubusercontent.com/u/13650298?v=3","gravatar_id":"","url":"https://api.github.com/users/jteehan","html_url":"https://github.com/jteehan","followers_url":"https://api.github.com/users/jteehan/followers","following_url":"https://api.github.com/users/jteehan/following{/other_user}","gists_url":"https://api.github.com/users/jteehan/gists{/gist_id}","starred_url":"https://api.github.com/users/jteehan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jteehan/subscriptions","organizations_url":"https://api.github.com/users/jteehan/orgs","repos_url":"https://api.github.com/users/jteehan/repos","events_url":"https://api.github.com/users/jteehan/events{/privacy}","received_events_url":"https://api.github.com/users/jteehan/received_events","type":"User","site_admin":false},"body":"Yeah, there is no such thing as vm creation time in azure.  The best Amogh and I could come up with is VHD last modification.","created_at":"2016-09-01T18:33:22Z","updated_at":"2016-09-01T18:33:22Z","html_url":"https://github.com/ManageIQ/wrapanapi/pull/63#discussion_r77228956","pull_request_url":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/63","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/comments/77228956"},"html":{"href":"https://github.com/ManageIQ/wrapanapi/pull/63#discussion_r77228956"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/63"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/63","id":83547512,"html_url":"https://github.com/ManageIQ/wrapanapi/pull/63","diff_url":"https://github.com/ManageIQ/wrapanapi/pull/63.diff","patch_url":"https://github.com/ManageIQ/wrapanapi/pull/63.patch","issue_url":"https://api.github.com/repos/ManageIQ/wrapanapi/issues/63","number":63,"state":"open","locked":false,"title":"Overhaul Cleanup methods, implement vm_creation_time, other.","user":{"login":"jteehan","id":13650298,"avatar_url":"https://avatars.githubusercontent.com/u/13650298?v=3","gravatar_id":"","url":"https://api.github.com/users/jteehan","html_url":"https://github.com/jteehan","followers_url":"https://api.github.com/users/jteehan/followers","following_url":"https://api.github.com/users/jteehan/following{/other_user}","gists_url":"https://api.github.com/users/jteehan/gists{/gist_id}","starred_url":"https://api.github.com/users/jteehan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jteehan/subscriptions","organizations_url":"https://api.github.com/users/jteehan/orgs","repos_url":"https://api.github.com/users/jteehan/repos","events_url":"https://api.github.com/users/jteehan/events{/privacy}","received_events_url":"https://api.github.com/users/jteehan/received_events","type":"User","site_admin":false},"body":"There's a lot here.  Perhaps a meeting to review would be best.","created_at":"2016-08-31T23:31:44Z","updated_at":"2016-09-01T18:33:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a1db5e4ede07b1ef4a33a48e2cb0ea15587cc4a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/63/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/63/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/wrapanapi/issues/63/comments","statuses_url":"https://api.github.com/repos/ManageIQ/wrapanapi/statuses/c7cc1a22a759b4a8b794ece898c1345de046dd4d","head":{"label":"jteehan:azure830_cleanupdelete","ref":"azure830_cleanupdelete","sha":"c7cc1a22a759b4a8b794ece898c1345de046dd4d","user":{"login":"jteehan","id":13650298,"avatar_url":"https://avatars.githubusercontent.com/u/13650298?v=3","gravatar_id":"","url":"https://api.github.com/users/jteehan","html_url":"https://github.com/jteehan","followers_url":"https://api.github.com/users/jteehan/followers","following_url":"https://api.github.com/users/jteehan/following{/other_user}","gists_url":"https://api.github.com/users/jteehan/gists{/gist_id}","starred_url":"https://api.github.com/users/jteehan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jteehan/subscriptions","organizations_url":"https://api.github.com/users/jteehan/orgs","repos_url":"https://api.github.com/users/jteehan/repos","events_url":"https://api.github.com/users/jteehan/events{/privacy}","received_events_url":"https://api.github.com/users/jteehan/received_events","type":"User","site_admin":false},"repo":{"id":46372341,"name":"mgmtsystem","full_name":"jteehan/mgmtsystem","owner":{"login":"jteehan","id":13650298,"avatar_url":"https://avatars.githubusercontent.com/u/13650298?v=3","gravatar_id":"","url":"https://api.github.com/users/jteehan","html_url":"https://github.com/jteehan","followers_url":"https://api.github.com/users/jteehan/followers","following_url":"https://api.github.com/users/jteehan/following{/other_user}","gists_url":"https://api.github.com/users/jteehan/gists{/gist_id}","starred_url":"https://api.github.com/users/jteehan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jteehan/subscriptions","organizations_url":"https://api.github.com/users/jteehan/orgs","repos_url":"https://api.github.com/users/jteehan/repos","events_url":"https://api.github.com/users/jteehan/events{/privacy}","received_events_url":"https://api.github.com/users/jteehan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jteehan/mgmtsystem","description":"A base system for provider management","fork":true,"url":"https://api.github.com/repos/jteehan/mgmtsystem","forks_url":"https://api.github.com/repos/jteehan/mgmtsystem/forks","keys_url":"https://api.github.com/repos/jteehan/mgmtsystem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jteehan/mgmtsystem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jteehan/mgmtsystem/teams","hooks_url":"https://api.github.com/repos/jteehan/mgmtsystem/hooks","issue_events_url":"https://api.github.com/repos/jteehan/mgmtsystem/issues/events{/number}","events_url":"https://api.github.com/repos/jteehan/mgmtsystem/events","assignees_url":"https://api.github.com/repos/jteehan/mgmtsystem/assignees{/user}","branches_url":"https://api.github.com/repos/jteehan/mgmtsystem/branches{/branch}","tags_url":"https://api.github.com/repos/jteehan/mgmtsystem/tags","blobs_url":"https://api.github.com/repos/jteehan/mgmtsystem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jteehan/mgmtsystem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jteehan/mgmtsystem/git/refs{/sha}","trees_url":"https://api.github.com/repos/jteehan/mgmtsystem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jteehan/mgmtsystem/statuses/{sha}","languages_url":"https://api.github.com/repos/jteehan/mgmtsystem/languages","stargazers_url":"https://api.github.com/repos/jteehan/mgmtsystem/stargazers","contributors_url":"https://api.github.com/repos/jteehan/mgmtsystem/contributors","subscribers_url":"https://api.github.com/repos/jteehan/mgmtsystem/subscribers","subscription_url":"https://api.github.com/repos/jteehan/mgmtsystem/subscription","commits_url":"https://api.github.com/repos/jteehan/mgmtsystem/commits{/sha}","git_commits_url":"https://api.github.com/repos/jteehan/mgmtsystem/git/commits{/sha}","comments_url":"https://api.github.com/repos/jteehan/mgmtsystem/comments{/number}","issue_comment_url":"https://api.github.com/repos/jteehan/mgmtsystem/issues/comments{/number}","contents_url":"https://api.github.com/repos/jteehan/mgmtsystem/contents/{+path}","compare_url":"https://api.github.com/repos/jteehan/mgmtsystem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jteehan/mgmtsystem/merges","archive_url":"https://api.github.com/repos/jteehan/mgmtsystem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jteehan/mgmtsystem/downloads","issues_url":"https://api.github.com/repos/jteehan/mgmtsystem/issues{/number}","pulls_url":"https://api.github.com/repos/jteehan/mgmtsystem/pulls{/number}","milestones_url":"https://api.github.com/repos/jteehan/mgmtsystem/milestones{/number}","notifications_url":"https://api.github.com/repos/jteehan/mgmtsystem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jteehan/mgmtsystem/labels{/name}","releases_url":"https://api.github.com/repos/jteehan/mgmtsystem/releases{/id}","deployments_url":"https://api.github.com/repos/jteehan/mgmtsystem/deployments","created_at":"2015-11-17T20:08:43Z","updated_at":"2016-04-29T00:09:59Z","pushed_at":"2016-09-01T03:06:52Z","git_url":"git://github.com/jteehan/mgmtsystem.git","ssh_url":"git@github.com:jteehan/mgmtsystem.git","clone_url":"https://github.com/jteehan/mgmtsystem.git","svn_url":"https://github.com/jteehan/mgmtsystem","homepage":"","size":263,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"ManageIQ:master","ref":"master","sha":"ac2c8c38f027e38a5358275b56b6d619ee81ecee","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":41742770,"name":"wrapanapi","full_name":"ManageIQ/wrapanapi","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/wrapanapi","description":"A base system for provider management","fork":false,"url":"https://api.github.com/repos/ManageIQ/wrapanapi","forks_url":"https://api.github.com/repos/ManageIQ/wrapanapi/forks","keys_url":"https://api.github.com/repos/ManageIQ/wrapanapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/wrapanapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/wrapanapi/teams","hooks_url":"https://api.github.com/repos/ManageIQ/wrapanapi/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/wrapanapi/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/wrapanapi/events","assignees_url":"https://api.github.com/repos/ManageIQ/wrapanapi/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/wrapanapi/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/wrapanapi/tags","blobs_url":"https://api.github.com/repos/ManageIQ/wrapanapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/wrapanapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/wrapanapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/wrapanapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/wrapanapi/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/wrapanapi/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/wrapanapi/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/wrapanapi/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/wrapanapi/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/wrapanapi/subscription","commits_url":"https://api.github.com/repos/ManageIQ/wrapanapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/wrapanapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/wrapanapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/wrapanapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/wrapanapi/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/wrapanapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/wrapanapi/merges","archive_url":"https://api.github.com/repos/ManageIQ/wrapanapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/wrapanapi/downloads","issues_url":"https://api.github.com/repos/ManageIQ/wrapanapi/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/wrapanapi/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/wrapanapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/wrapanapi/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/wrapanapi/releases{/id}","deployments_url":"https://api.github.com/repos/ManageIQ/wrapanapi/deployments","created_at":"2015-09-01T14:16:00Z","updated_at":"2016-06-10T04:28:10Z","pushed_at":"2016-09-01T17:10:07Z","git_url":"git://github.com/ManageIQ/wrapanapi.git","ssh_url":"git@github.com:ManageIQ/wrapanapi.git","clone_url":"https://github.com/ManageIQ/wrapanapi.git","svn_url":"https://github.com/ManageIQ/wrapanapi","homepage":"","size":291,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":3,"forks":17,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/63"},"html":{"href":"https://github.com/ManageIQ/wrapanapi/pull/63"},"issue":{"href":"https://api.github.com/repos/ManageIQ/wrapanapi/issues/63"},"comments":{"href":"https://api.github.com/repos/ManageIQ/wrapanapi/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/wrapanapi/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/wrapanapi/statuses/c7cc1a22a759b4a8b794ece898c1345de046dd4d"}}}}
{"actor":{"display_login":"jteehan"}}