GitHub PullRequestReviewCommentEvent at 2014-11-25 08:38:44
Repository: foreman
Actor: eLobato
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/theforeman/foreman/pulls/comments/20848995","id":20848995,"diff_hunk":"@@ -0,0 +1,107 @@\n+module Foreman::Model\n+  class Digitalocean < ComputeResource\n+    has_one :key_pair, :foreign_key => :compute_resource_id, :dependent => :destroy\n+    delegate :flavors, :to => :client\n+\n+    validates :user, :password, :presence => true\n+    #before_create :test_connection\n+\n+    # Not sure why it would need a url, but OK (copied from ec2)\n+    alias_attribute :region, :url\n+\n+    def to_label\n+      \"#{name} (#{provider_friendly_name})\"\n+    end\n+\n+    def provided_attributes\n+      super.merge({ :ip => :public_ip_address })\n+    end\n+\n+    def self.model_name\n+      ComputeResource.model_name\n+    end\n+\n+    def capabilities\n+      [:image]\n+    end\n+\n+    def find_vm_by_uuid(uuid)\n+      client.servers.get(uuid)\n+    rescue Fog::Compute::DigitalOcean::Error\n+      raise(ActiveRecord::RecordNotFound)\n+    end\n+\n+    def create_vm(args = { })\n+      super(args)\n+    rescue Fog::Errors::Error => e\n+      logger.error \"Unhandled DigitalOcean error: #{e.class}:#{e.message}\\n \" + e.backtrace.join(\"\\n \")\n+      raise e\n+    end\n+\n+    def available_images\n+      client.images\n+    end\n+\n+    def regions\n+      return [] if user.blank? or password.blank?\n+      client.regions\n+    end\n+\n+    def test_connection(options = {})\n+      super\n+      errors[:user].empty? and errors[:password].empty? and regions.count","path":"app/models/compute_resources/foreman/model/digitalocean.rb","position":52,"original_position":52,"commit_id":"0c10575b61cab73736859687fe87e9a32e0eb655","original_commit_id":"0c10575b61cab73736859687fe87e9a32e0eb655","user":{"login":"eLobato","id":598891,"avatar_url":"https://avatars.githubusercontent.com/u/598891?v=3","gravatar_id":"","url":"https://api.github.com/users/eLobato","html_url":"https://github.com/eLobato","followers_url":"https://api.github.com/users/eLobato/followers","following_url":"https://api.github.com/users/eLobato/following{/other_user}","gists_url":"https://api.github.com/users/eLobato/gists{/gist_id}","starred_url":"https://api.github.com/users/eLobato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eLobato/subscriptions","organizations_url":"https://api.github.com/users/eLobato/orgs","repos_url":"https://api.github.com/users/eLobato/repos","events_url":"https://api.github.com/users/eLobato/events{/privacy}","received_events_url":"https://api.github.com/users/eLobato/received_events","type":"User","site_admin":false},"body":"http://devblog.avdi.org/2010/08/02/using-and-and-or-in-ruby/ :smile: ","created_at":"2014-11-25T08:38:44Z","updated_at":"2014-11-25T08:38:44Z","html_url":"https://github.com/theforeman/foreman/pull/1978#discussion_r20848995","pull_request_url":"https://api.github.com/repos/theforeman/foreman/pulls/1978","_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/comments/20848995"},"html":{"href":"https://github.com/theforeman/foreman/pull/1978#discussion_r20848995"},"pull_request":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/1978"}}},"pull_request":{"url":"https://api.github.com/repos/theforeman/foreman/pulls/1978","id":24991494,"html_url":"https://github.com/theforeman/foreman/pull/1978","diff_url":"https://github.com/theforeman/foreman/pull/1978.diff","patch_url":"https://github.com/theforeman/foreman/pull/1978.patch","issue_url":"https://api.github.com/repos/theforeman/foreman/issues/1978","number":1978,"state":"open","locked":false,"title":"fixes #8465 Add Digital Ocean Support (this time with fixes)","user":{"login":"TJM","id":1641316,"avatar_url":"https://avatars.githubusercontent.com/u/1641316?v=3","gravatar_id":"","url":"https://api.github.com/users/TJM","html_url":"https://github.com/TJM","followers_url":"https://api.github.com/users/TJM/followers","following_url":"https://api.github.com/users/TJM/following{/other_user}","gists_url":"https://api.github.com/users/TJM/gists{/gist_id}","starred_url":"https://api.github.com/users/TJM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TJM/subscriptions","organizations_url":"https://api.github.com/users/TJM/orgs","repos_url":"https://api.github.com/users/TJM/repos","events_url":"https://api.github.com/users/TJM/events{/privacy}","received_events_url":"https://api.github.com/users/TJM/received_events","type":"User","site_admin":false},"body":"Sorry, this is a re-request from #1974 .. I messed up and had to re-create the branch.\r\n\r\nPlease see that for history.. this is intended to become a module *probably* :)","created_at":"2014-11-25T08:30:43Z","updated_at":"2014-11-25T08:38:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"945fa64a161368945a712b3541ea7d76ddb2e5f1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/theforeman/foreman/pulls/1978/commits","review_comments_url":"https://api.github.com/repos/theforeman/foreman/pulls/1978/comments","review_comment_url":"https://api.github.com/repos/theforeman/foreman/pulls/comments/{number}","comments_url":"https://api.github.com/repos/theforeman/foreman/issues/1978/comments","statuses_url":"https://api.github.com/repos/theforeman/foreman/statuses/0c10575b61cab73736859687fe87e9a32e0eb655","head":{"label":"TJM:8465-AddDigitalOcean","ref":"8465-AddDigitalOcean","sha":"0c10575b61cab73736859687fe87e9a32e0eb655","user":{"login":"TJM","id":1641316,"avatar_url":"https://avatars.githubusercontent.com/u/1641316?v=3","gravatar_id":"","url":"https://api.github.com/users/TJM","html_url":"https://github.com/TJM","followers_url":"https://api.github.com/users/TJM/followers","following_url":"https://api.github.com/users/TJM/following{/other_user}","gists_url":"https://api.github.com/users/TJM/gists{/gist_id}","starred_url":"https://api.github.com/users/TJM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TJM/subscriptions","organizations_url":"https://api.github.com/users/TJM/orgs","repos_url":"https://api.github.com/users/TJM/repos","events_url":"https://api.github.com/users/TJM/events{/privacy}","received_events_url":"https://api.github.com/users/TJM/received_events","type":"User","site_admin":false},"repo":{"id":26922601,"name":"foreman","full_name":"TJM/foreman","owner":{"login":"TJM","id":1641316,"avatar_url":"https://avatars.githubusercontent.com/u/1641316?v=3","gravatar_id":"","url":"https://api.github.com/users/TJM","html_url":"https://github.com/TJM","followers_url":"https://api.github.com/users/TJM/followers","following_url":"https://api.github.com/users/TJM/following{/other_user}","gists_url":"https://api.github.com/users/TJM/gists{/gist_id}","starred_url":"https://api.github.com/users/TJM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TJM/subscriptions","organizations_url":"https://api.github.com/users/TJM/orgs","repos_url":"https://api.github.com/users/TJM/repos","events_url":"https://api.github.com/users/TJM/events{/privacy}","received_events_url":"https://api.github.com/users/TJM/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TJM/foreman","description":"an application that automates the lifecycle of servers ","fork":true,"url":"https://api.github.com/repos/TJM/foreman","forks_url":"https://api.github.com/repos/TJM/foreman/forks","keys_url":"https://api.github.com/repos/TJM/foreman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TJM/foreman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TJM/foreman/teams","hooks_url":"https://api.github.com/repos/TJM/foreman/hooks","issue_events_url":"https://api.github.com/repos/TJM/foreman/issues/events{/number}","events_url":"https://api.github.com/repos/TJM/foreman/events","assignees_url":"https://api.github.com/repos/TJM/foreman/assignees{/user}","branches_url":"https://api.github.com/repos/TJM/foreman/branches{/branch}","tags_url":"https://api.github.com/repos/TJM/foreman/tags","blobs_url":"https://api.github.com/repos/TJM/foreman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TJM/foreman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TJM/foreman/git/refs{/sha}","trees_url":"https://api.github.com/repos/TJM/foreman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TJM/foreman/statuses/{sha}","languages_url":"https://api.github.com/repos/TJM/foreman/languages","stargazers_url":"https://api.github.com/repos/TJM/foreman/stargazers","contributors_url":"https://api.github.com/repos/TJM/foreman/contributors","subscribers_url":"https://api.github.com/repos/TJM/foreman/subscribers","subscription_url":"https://api.github.com/repos/TJM/foreman/subscription","commits_url":"https://api.github.com/repos/TJM/foreman/commits{/sha}","git_commits_url":"https://api.github.com/repos/TJM/foreman/git/commits{/sha}","comments_url":"https://api.github.com/repos/TJM/foreman/comments{/number}","issue_comment_url":"https://api.github.com/repos/TJM/foreman/issues/comments/{number}","contents_url":"https://api.github.com/repos/TJM/foreman/contents/{+path}","compare_url":"https://api.github.com/repos/TJM/foreman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TJM/foreman/merges","archive_url":"https://api.github.com/repos/TJM/foreman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TJM/foreman/downloads","issues_url":"https://api.github.com/repos/TJM/foreman/issues{/number}","pulls_url":"https://api.github.com/repos/TJM/foreman/pulls{/number}","milestones_url":"https://api.github.com/repos/TJM/foreman/milestones{/number}","notifications_url":"https://api.github.com/repos/TJM/foreman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TJM/foreman/labels{/name}","releases_url":"https://api.github.com/repos/TJM/foreman/releases{/id}","created_at":"2014-11-20T17:03:39Z","updated_at":"2014-11-25T08:09:13Z","pushed_at":"2014-11-25T08:28:21Z","git_url":"git://github.com/TJM/foreman.git","ssh_url":"git@github.com:TJM/foreman.git","clone_url":"https://github.com/TJM/foreman.git","svn_url":"https://github.com/TJM/foreman","homepage":"http://theforeman.org","size":25797,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":false,"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":"develop"}},"base":{"label":"theforeman:develop","ref":"develop","sha":"082378b7ec529bb2d28e0849d0f566785e2af527","user":{"login":"theforeman","id":1439844,"avatar_url":"https://avatars.githubusercontent.com/u/1439844?v=3","gravatar_id":"","url":"https://api.github.com/users/theforeman","html_url":"https://github.com/theforeman","followers_url":"https://api.github.com/users/theforeman/followers","following_url":"https://api.github.com/users/theforeman/following{/other_user}","gists_url":"https://api.github.com/users/theforeman/gists{/gist_id}","starred_url":"https://api.github.com/users/theforeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theforeman/subscriptions","organizations_url":"https://api.github.com/users/theforeman/orgs","repos_url":"https://api.github.com/users/theforeman/repos","events_url":"https://api.github.com/users/theforeman/events{/privacy}","received_events_url":"https://api.github.com/users/theforeman/received_events","type":"Organization","site_admin":false},"repo":{"id":258750,"name":"foreman","full_name":"theforeman/foreman","owner":{"login":"theforeman","id":1439844,"avatar_url":"https://avatars.githubusercontent.com/u/1439844?v=3","gravatar_id":"","url":"https://api.github.com/users/theforeman","html_url":"https://github.com/theforeman","followers_url":"https://api.github.com/users/theforeman/followers","following_url":"https://api.github.com/users/theforeman/following{/other_user}","gists_url":"https://api.github.com/users/theforeman/gists{/gist_id}","starred_url":"https://api.github.com/users/theforeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theforeman/subscriptions","organizations_url":"https://api.github.com/users/theforeman/orgs","repos_url":"https://api.github.com/users/theforeman/repos","events_url":"https://api.github.com/users/theforeman/events{/privacy}","received_events_url":"https://api.github.com/users/theforeman/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/theforeman/foreman","description":"an application that automates the lifecycle of servers ","fork":false,"url":"https://api.github.com/repos/theforeman/foreman","forks_url":"https://api.github.com/repos/theforeman/foreman/forks","keys_url":"https://api.github.com/repos/theforeman/foreman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/theforeman/foreman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/theforeman/foreman/teams","hooks_url":"https://api.github.com/repos/theforeman/foreman/hooks","issue_events_url":"https://api.github.com/repos/theforeman/foreman/issues/events{/number}","events_url":"https://api.github.com/repos/theforeman/foreman/events","assignees_url":"https://api.github.com/repos/theforeman/foreman/assignees{/user}","branches_url":"https://api.github.com/repos/theforeman/foreman/branches{/branch}","tags_url":"https://api.github.com/repos/theforeman/foreman/tags","blobs_url":"https://api.github.com/repos/theforeman/foreman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/theforeman/foreman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/theforeman/foreman/git/refs{/sha}","trees_url":"https://api.github.com/repos/theforeman/foreman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/theforeman/foreman/statuses/{sha}","languages_url":"https://api.github.com/repos/theforeman/foreman/languages","stargazers_url":"https://api.github.com/repos/theforeman/foreman/stargazers","contributors_url":"https://api.github.com/repos/theforeman/foreman/contributors","subscribers_url":"https://api.github.com/repos/theforeman/foreman/subscribers","subscription_url":"https://api.github.com/repos/theforeman/foreman/subscription","commits_url":"https://api.github.com/repos/theforeman/foreman/commits{/sha}","git_commits_url":"https://api.github.com/repos/theforeman/foreman/git/commits{/sha}","comments_url":"https://api.github.com/repos/theforeman/foreman/comments{/number}","issue_comment_url":"https://api.github.com/repos/theforeman/foreman/issues/comments/{number}","contents_url":"https://api.github.com/repos/theforeman/foreman/contents/{+path}","compare_url":"https://api.github.com/repos/theforeman/foreman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/theforeman/foreman/merges","archive_url":"https://api.github.com/repos/theforeman/foreman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/theforeman/foreman/downloads","issues_url":"https://api.github.com/repos/theforeman/foreman/issues{/number}","pulls_url":"https://api.github.com/repos/theforeman/foreman/pulls{/number}","milestones_url":"https://api.github.com/repos/theforeman/foreman/milestones{/number}","notifications_url":"https://api.github.com/repos/theforeman/foreman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/theforeman/foreman/labels{/name}","releases_url":"https://api.github.com/repos/theforeman/foreman/releases{/id}","created_at":"2009-07-23T15:07:00Z","updated_at":"2014-11-25T06:29:20Z","pushed_at":"2014-11-25T08:36:01Z","git_url":"git://github.com/theforeman/foreman.git","ssh_url":"git@github.com:theforeman/foreman.git","clone_url":"https://github.com/theforeman/foreman.git","svn_url":"https://github.com/theforeman/foreman","homepage":"http://theforeman.org","size":73790,"stargazers_count":599,"watchers_count":599,"language":"Ruby","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":333,"mirror_url":null,"open_issues_count":76,"forks":333,"open_issues":76,"watchers":599,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/1978"},"html":{"href":"https://github.com/theforeman/foreman/pull/1978"},"issue":{"href":"https://api.github.com/repos/theforeman/foreman/issues/1978"},"comments":{"href":"https://api.github.com/repos/theforeman/foreman/issues/1978/comments"},"review_comments":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/1978/comments"},"review_comment":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/1978/commits"},"statuses":{"href":"https://api.github.com/repos/theforeman/foreman/statuses/0c10575b61cab73736859687fe87e9a32e0eb655"}}}}