{"action":"created","comment":{"url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/comments/42631925","id":42631925,"diff_hunk":"@@ -0,0 +1,103 @@\n+#\n+# Copyright 2015, SUSE LINUX GmbH\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#   http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+\n+class RepositoriesController < ApplicationController\n+  before_filter :load_registry\n+  #\n+  # Repository Check\n+  #\n+  # Provides the restful api call for\n+  # Repository Checks \t/utils/repositories \tGET \tReturns a json list of checked repositories\n+  # Renders an HTML view in the UI\n+  def index\n+    @repocheck = Crowbar::Repository.check_all_repos\n+    respond_to do |format|\n+      format.html { @repocheck }\n+      format.xml { render xml: @repocheck }\n+      format.json { render json: @repocheck }\n+    end\n+  end\n+\n+  # update the state of the repositories (active/disabled)\n+  # /utils/repositories/sync   POST\n+  def sync\n+    unless params[\"repo\"].nil?\n+      ProvisionerService.new(logger).synchronize_repositories(params[\"repo\"])\n+    end\n+\n+    redirect_to repositories_path\n+  end\n+\n+  #\n+  # Activate a single Repository\n+  #\n+  # Provides the restful api call for\n+  # Activate a Repository   /utils/repositories/activate   POST  Creates Repository DataBagItem\n+  # required parameters: platform, repo\n+  def activate\n+    return render_not_found if params[:platform].nil? || params[:repo].nil?\n+    respond_to do |format|\n+      repo_object = Crowbar::Repository.where(platform: params[:platform], repo: params[:repo]).first\n+      ret = ProvisionerService.new(logger).create_repository_item(repo_object) unless repo_object.nil?\n+      if ret\n+        format.json { head :ok }\n+        format.html { redirect_to repositories_url }\n+      else\n+        format.json do\n+          render json: { error: I18n.t('cannot_activate_repo', scope: 'error', id: repo_object.id) },\n+                 status: :unprocessable_entity\n+        end\n+        format.html do\n+          flash[:alert] = I18n.t('cannot_activate_repo', scope: 'error', id: repo_object.id)\n+          redirect_to repositories_url\n+        end\n+      end\n+    end\n+  end\n+\n+  #\n+  # Deactivate a single Repository\n+  #\n+  # Provides the restful api call for\n+  # Deactivate a Repository   /utils/repositories/deactivate   POST   Destroys Repository DataBagItem\n+  # required parameters: platform, repo\n+  def deactivate\n+    return render_not_found if params[:platform].nil? || params[:repo].nil?\n+    respond_to do |format|\n+      repo_object = Crowbar::Repository.where(platform: params[:platform], repo: params[:repo]).first\n+      ret = ProvisionerService.new(logger).destroy_repository_item(repo_object)\n+      if ret\n+        format.json { head :ok }\n+        format.html { redirect_to repositories_url }\n+      else\n+        format.json do\n+          render json: { error: I18n.t('cannot_deactivate_repo', scope: 'error', id: repo_object.id) },\n+                 status: :unprocessable_entity\n+        end\n+        format.html do\n+          flash[:alert] = I18n.t('cannot_deactivate_repo', scope: 'error', id: repo_object.id)","path":"crowbar_framework/app/controllers/repositories_controller.rb","position":91,"original_position":91,"commit_id":"197f7e6197dd52df060c0bfcc0ed8099601cf0d4","original_commit_id":"197f7e6197dd52df060c0bfcc0ed8099601cf0d4","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)","created_at":"2015-10-21T14:40:31Z","updated_at":"2015-10-21T14:40:31Z","html_url":"https://github.com/crowbar/crowbar-core/pull/18#discussion_r42631925","pull_request_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/comments/42631925"},"html":{"href":"https://github.com/crowbar/crowbar-core/pull/18#discussion_r42631925"},"pull_request":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/18","id":43760502,"html_url":"https://github.com/crowbar/crowbar-core/pull/18","diff_url":"https://github.com/crowbar/crowbar-core/pull/18.diff","patch_url":"https://github.com/crowbar/crowbar-core/pull/18.patch","issue_url":"https://api.github.com/repos/crowbar/crowbar-core/issues/18","number":18,"state":"open","locked":false,"title":"add repositories page","user":{"login":"MaximilianMeister","id":5364817,"avatar_url":"https://avatars.githubusercontent.com/u/5364817?v=3","gravatar_id":"","url":"https://api.github.com/users/MaximilianMeister","html_url":"https://github.com/MaximilianMeister","followers_url":"https://api.github.com/users/MaximilianMeister/followers","following_url":"https://api.github.com/users/MaximilianMeister/following{/other_user}","gists_url":"https://api.github.com/users/MaximilianMeister/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximilianMeister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximilianMeister/subscriptions","organizations_url":"https://api.github.com/users/MaximilianMeister/orgs","repos_url":"https://api.github.com/users/MaximilianMeister/repos","events_url":"https://api.github.com/users/MaximilianMeister/events{/privacy}","received_events_url":"https://api.github.com/users/MaximilianMeister/received_events","type":"User","site_admin":false},"body":"Part of https://trello.com/c/CRJYcP59/466-5-p6-move-repo-checks-out-of-install-suse-cloud-also-ux\r\n\r\nThis still needs some work, the views are just a very basic table right now, so depending on where we want to go with the whole thing, (adding new repos, first time landing page...) we need to involve @kwwii in the design.\r\nplease don't judge the views too much here, as they are just a dummy right now to have something.\r\n\r\n![repo_page](https://cloud.githubusercontent.com/assets/5364817/9578144/e4fd6f44-4fe7-11e5-9126-f81b40099ddd.png)\r\n\r\nSo for now shall we just implement a simple table like that? or do we need sth. more designed? any concrete suggestions are more than welcome. same goes for the lib, I have put this to WIP to get some input from you.\r\n\r\nBits that are still unclear/TODO:\r\n- [ ] decide on a good UI representation (view)\r\n- [ ] define YAML file\r\n- [ ] where do we store the yaml file(s) ?\r\n- [ ] fit the lib to [repositories.rb](https://github.com/crowbar/crowbar-core/blob/master/chef/cookbooks/provisioner/libraries/repositories.rb) **or** fit [repositories.rb](https://github.com/crowbar/crowbar-core/blob/master/chef/cookbooks/provisioner/libraries/repositories.rb) to the lib?\r\n- [ ] unittests for the lib","created_at":"2015-08-31T12:45:48Z","updated_at":"2015-10-21T14:40:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62ec5cc8a5105f20ed6a9f298de44f32a97af6a7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/18/commits","review_comments_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/18/comments","review_comment_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crowbar/crowbar-core/issues/18/comments","statuses_url":"https://api.github.com/repos/crowbar/crowbar-core/statuses/197f7e6197dd52df060c0bfcc0ed8099601cf0d4","head":{"label":"MaximilianMeister:feature/move-repo-checks","ref":"feature/move-repo-checks","sha":"197f7e6197dd52df060c0bfcc0ed8099601cf0d4","user":{"login":"MaximilianMeister","id":5364817,"avatar_url":"https://avatars.githubusercontent.com/u/5364817?v=3","gravatar_id":"","url":"https://api.github.com/users/MaximilianMeister","html_url":"https://github.com/MaximilianMeister","followers_url":"https://api.github.com/users/MaximilianMeister/followers","following_url":"https://api.github.com/users/MaximilianMeister/following{/other_user}","gists_url":"https://api.github.com/users/MaximilianMeister/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximilianMeister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximilianMeister/subscriptions","organizations_url":"https://api.github.com/users/MaximilianMeister/orgs","repos_url":"https://api.github.com/users/MaximilianMeister/repos","events_url":"https://api.github.com/users/MaximilianMeister/events{/privacy}","received_events_url":"https://api.github.com/users/MaximilianMeister/received_events","type":"User","site_admin":false},"repo":{"id":40901479,"name":"crowbar-core","full_name":"MaximilianMeister/crowbar-core","owner":{"login":"MaximilianMeister","id":5364817,"avatar_url":"https://avatars.githubusercontent.com/u/5364817?v=3","gravatar_id":"","url":"https://api.github.com/users/MaximilianMeister","html_url":"https://github.com/MaximilianMeister","followers_url":"https://api.github.com/users/MaximilianMeister/followers","following_url":"https://api.github.com/users/MaximilianMeister/following{/other_user}","gists_url":"https://api.github.com/users/MaximilianMeister/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximilianMeister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximilianMeister/subscriptions","organizations_url":"https://api.github.com/users/MaximilianMeister/orgs","repos_url":"https://api.github.com/users/MaximilianMeister/repos","events_url":"https://api.github.com/users/MaximilianMeister/events{/privacy}","received_events_url":"https://api.github.com/users/MaximilianMeister/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MaximilianMeister/crowbar-core","description":"Core deployment for Crowbar","fork":true,"url":"https://api.github.com/repos/MaximilianMeister/crowbar-core","forks_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/forks","keys_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/teams","hooks_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/hooks","issue_events_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/issues/events{/number}","events_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/events","assignees_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/assignees{/user}","branches_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/branches{/branch}","tags_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/tags","blobs_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/statuses/{sha}","languages_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/languages","stargazers_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/stargazers","contributors_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/contributors","subscribers_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/subscribers","subscription_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/subscription","commits_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/contents/{+path}","compare_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/merges","archive_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/downloads","issues_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/issues{/number}","pulls_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/pulls{/number}","milestones_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/milestones{/number}","notifications_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/labels{/name}","releases_url":"https://api.github.com/repos/MaximilianMeister/crowbar-core/releases{/id}","created_at":"2015-08-17T14:29:21Z","updated_at":"2015-08-17T14:29:23Z","pushed_at":"2015-10-21T14:40:14Z","git_url":"git://github.com/MaximilianMeister/crowbar-core.git","ssh_url":"git@github.com:MaximilianMeister/crowbar-core.git","clone_url":"https://github.com/MaximilianMeister/crowbar-core.git","svn_url":"https://github.com/MaximilianMeister/crowbar-core","homepage":null,"size":103468,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"crowbar:master","ref":"master","sha":"75b48a48cf2cdda4e48d938e18d90347fb0cc60e","user":{"login":"crowbar","id":2910205,"avatar_url":"https://avatars.githubusercontent.com/u/2910205?v=3","gravatar_id":"","url":"https://api.github.com/users/crowbar","html_url":"https://github.com/crowbar","followers_url":"https://api.github.com/users/crowbar/followers","following_url":"https://api.github.com/users/crowbar/following{/other_user}","gists_url":"https://api.github.com/users/crowbar/gists{/gist_id}","starred_url":"https://api.github.com/users/crowbar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowbar/subscriptions","organizations_url":"https://api.github.com/users/crowbar/orgs","repos_url":"https://api.github.com/users/crowbar/repos","events_url":"https://api.github.com/users/crowbar/events{/privacy}","received_events_url":"https://api.github.com/users/crowbar/received_events","type":"Organization","site_admin":false},"repo":{"id":39003227,"name":"crowbar-core","full_name":"crowbar/crowbar-core","owner":{"login":"crowbar","id":2910205,"avatar_url":"https://avatars.githubusercontent.com/u/2910205?v=3","gravatar_id":"","url":"https://api.github.com/users/crowbar","html_url":"https://github.com/crowbar","followers_url":"https://api.github.com/users/crowbar/followers","following_url":"https://api.github.com/users/crowbar/following{/other_user}","gists_url":"https://api.github.com/users/crowbar/gists{/gist_id}","starred_url":"https://api.github.com/users/crowbar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowbar/subscriptions","organizations_url":"https://api.github.com/users/crowbar/orgs","repos_url":"https://api.github.com/users/crowbar/repos","events_url":"https://api.github.com/users/crowbar/events{/privacy}","received_events_url":"https://api.github.com/users/crowbar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crowbar/crowbar-core","description":"Core deployment for Crowbar","fork":false,"url":"https://api.github.com/repos/crowbar/crowbar-core","forks_url":"https://api.github.com/repos/crowbar/crowbar-core/forks","keys_url":"https://api.github.com/repos/crowbar/crowbar-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crowbar/crowbar-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crowbar/crowbar-core/teams","hooks_url":"https://api.github.com/repos/crowbar/crowbar-core/hooks","issue_events_url":"https://api.github.com/repos/crowbar/crowbar-core/issues/events{/number}","events_url":"https://api.github.com/repos/crowbar/crowbar-core/events","assignees_url":"https://api.github.com/repos/crowbar/crowbar-core/assignees{/user}","branches_url":"https://api.github.com/repos/crowbar/crowbar-core/branches{/branch}","tags_url":"https://api.github.com/repos/crowbar/crowbar-core/tags","blobs_url":"https://api.github.com/repos/crowbar/crowbar-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crowbar/crowbar-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crowbar/crowbar-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/crowbar/crowbar-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crowbar/crowbar-core/statuses/{sha}","languages_url":"https://api.github.com/repos/crowbar/crowbar-core/languages","stargazers_url":"https://api.github.com/repos/crowbar/crowbar-core/stargazers","contributors_url":"https://api.github.com/repos/crowbar/crowbar-core/contributors","subscribers_url":"https://api.github.com/repos/crowbar/crowbar-core/subscribers","subscription_url":"https://api.github.com/repos/crowbar/crowbar-core/subscription","commits_url":"https://api.github.com/repos/crowbar/crowbar-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/crowbar/crowbar-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/crowbar/crowbar-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/crowbar/crowbar-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/crowbar/crowbar-core/contents/{+path}","compare_url":"https://api.github.com/repos/crowbar/crowbar-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crowbar/crowbar-core/merges","archive_url":"https://api.github.com/repos/crowbar/crowbar-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crowbar/crowbar-core/downloads","issues_url":"https://api.github.com/repos/crowbar/crowbar-core/issues{/number}","pulls_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls{/number}","milestones_url":"https://api.github.com/repos/crowbar/crowbar-core/milestones{/number}","notifications_url":"https://api.github.com/repos/crowbar/crowbar-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crowbar/crowbar-core/labels{/name}","releases_url":"https://api.github.com/repos/crowbar/crowbar-core/releases{/id}","created_at":"2015-07-13T09:31:28Z","updated_at":"2015-10-15T10:15:04Z","pushed_at":"2015-10-21T14:40:14Z","git_url":"git://github.com/crowbar/crowbar-core.git","ssh_url":"git@github.com:crowbar/crowbar-core.git","clone_url":"https://github.com/crowbar/crowbar-core.git","svn_url":"https://github.com/crowbar/crowbar-core","homepage":null,"size":119364,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":20,"forks":21,"open_issues":20,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/18"},"html":{"href":"https://github.com/crowbar/crowbar-core/pull/18"},"issue":{"href":"https://api.github.com/repos/crowbar/crowbar-core/issues/18"},"comments":{"href":"https://api.github.com/repos/crowbar/crowbar-core/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/crowbar/crowbar-core/statuses/197f7e6197dd52df060c0bfcc0ed8099601cf0d4"}}}}