Skip to content

Instantly share code, notes, and snippets.

View jlsherrill's full-sized avatar

Justin Sherrill jlsherrill

View GitHub Profile
diff --git a/test/controllers/api/v2/content_view_puppet_modules_controller_test.rb b/test/controllers/api/v2/content_view_puppet_modules_controller_test.rb
index bcb799d..2a5978a 100644
--- a/test/controllers/api/v2/content_view_puppet_modules_controller_test.rb
+++ b/test/controllers/api/v2/content_view_puppet_modules_controller_test.rb
@@ -42,6 +42,7 @@ module Katello
@fake_search_service = @controller.load_search_service(Support::SearchService::FakeSearchService.new)
models
permissions
+ ContentViewPuppetModule.any_instance.stubs(:puppet_module).returns(PuppetModule.new)
end
diff --git a/test/controllers/api/v2/content_views_controller_test.rb b/test/controllers/api/v2/content_views_controller_test.rb
index 69ba5d6..6b0eb59 100644
--- a/test/controllers/api/v2/content_views_controller_test.rb
+++ b/test/controllers/api/v2/content_views_controller_test.rb
@@ -184,7 +184,7 @@ module Katello
get :available_puppet_modules, :id => @content_view.id
assert_response :success
- assert_template 'katello/api/v2/content_views/../puppet_modules/index'
+ assert_template 'katello/api/v2/content_views/puppet_modules'
diff --git a/app/controllers/katello/api/v2/api_controller.rb b/app/controllers/katello/api/v2/api_controller.
index d5bc7c5..8857125 100644
--- a/app/controllers/katello/api/v2/api_controller.rb
+++ b/app/controllers/katello/api/v2/api_controller.rb
@@ -88,6 +88,7 @@ module Katello
@search_service.model = item_class
options[:per_page] = 1
options[:facets] = {facet_name => term}
+ options[:facet_filters] = options[:filters]
@jlsherrill
jlsherrill / gist:9793345
Last active August 29, 2015 13:57
Asset loading speedup for foreman/katello
--- a/config.ru
+++ b/config.ru
@@ -4,5 +4,6 @@ require ::File.expand_path('../config/environment', __FILE__)
# apply a prefix to the application, if one is defined
# e.g. http://some.server.com/prefix where '/prefix' is defined by env variable
map ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do
+ map("/assets"){ run Rails.application.assets }
run Foreman::Application
end
#!/bin/bash
#
# Copyright 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
diff --git a/db/seeds.rb b/db/seeds.rb
index e7964bb..1aa86fa 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -16,8 +16,9 @@ def format_errors(model = nil)
model.errors.full_messages.join(';')
end
+::User.current = ::User.anonymous_api_admin
+
def plan(repo)
action_subject(repo)
sequence do
other_actions = []
sync_task = plan_action(Pulp::Repository::Sync, pulp_id: repo.pulp_id)
concurrence do
other_actions << plan_action(Katello::Repository::NodeMetadataGenerate, repo, sync_task.output[:pulp_tasks])
other_actions << plan_action(ElasticSearch::Repository::IndexContent, pulp_task: sync_task.output[:pulp_tasks], id: repo.id)
diff --git a/app/views/katello/api/v2/systems/show.json.rabl b/app/views/katello/api/v2/systems/show.json.rabl
index 8f2710d..1646caf 100644
--- a/app/views/katello/api/v2/systems/show.json.rabl
+++ b/app/views/katello/api/v2/systems/show.json.rabl
@@ -63,7 +63,7 @@ end
# Requires another API call to fetch from Candlepin
if params[:fields] == "full"
- attributes :type
+ attributes :system_type => :type
@jlsherrill
jlsherrill / factsd.rb
Created November 13, 2014 17:22
Fact exchange
#!/usr/bin/ruby
if File.exists?("/etc/facts.d")
entries = Dir.entries("/etc/facts.d/")
name_map = {}
entries.each do |entry|
if File.file?("/etc/facts.d/#{entry}")
ext = entry.split('.')[1]
@jlsherrill
jlsherrill / generate_puppet_repo.py
Last active August 29, 2015 14:11
Script to generate repos syncable by katello/pulp for built puppet modules.
#!/usr/bin/env python
import sys
import os
from hashlib import sha256
ARCHIVE_SUFFIX = '.tar.gz'
def digest(path):
h = sha256()