Skip to content

Instantly share code, notes, and snippets.

View GregSutcliffe's full-sized avatar

Greg "Gwmngilfen" Sutcliffe GregSutcliffe

  • Red Hat
  • Scotland
View GitHub Profile
diff --git a/modules/tftp/tftp_plugin.rb b/modules/tftp/tftp_plugin.rb
index b1cc82d..8f125b9 100644
--- a/modules/tftp/tftp_plugin.rb
+++ b/modules/tftp/tftp_plugin.rb
@@ -2,9 +2,13 @@ module Proxy::TFTP
class Plugin < ::Proxy::Plugin
plugin :tftp, ::Proxy::VERSION
- http_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__))
- https_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__))
diff --git a/app/lib/puppet_fact_parser_extensions.rb b/app/lib/puppet_fact_parser_extensions.rb
index 94fd4f6..fe12d63 100644
--- a/app/lib/puppet_fact_parser_extensions.rb
+++ b/app/lib/puppet_fact_parser_extensions.rb
@@ -18,6 +18,7 @@ module PuppetFactParserExtensions
# search for IP of interface with primary interface macaddress (ipaddress fact does not have to be interface used for boot)
def ip_with_discovery_fact
facts[:interfaces].split(',').each do |interface|
+ next if facts["macaddress_#{interface}"].nil?
if facts["macaddress_#{interface}"].try(:downcase) == facts[discovery_mac_fact_name].try(:downcase)
diff --git a/app/models/host/managed.rb b/app/models/host/managed.rb
index 63eb14b..e2719bb 100644
--- a/app/models/host/managed.rb
+++ b/app/models/host/managed.rb
@@ -141,6 +141,7 @@ class Host::Managed < Host::Base
delegate :dns?, :reverse_dns?, :dns_a_record, :dns_ptr_record, :to => :primary_interface
include Orchestration::Compute
# include Orchestration::TFTP
+ include Rails.application.routes.url_helpers
delegate :tftp?, :tftp, :generate_pxe_template, :to => :provision_interface
h=Host.new
h.name = "test"
i = Nic::Managed.new
i.name = "test"
i.host = h
i.mac="52:54:00:a9:54:89"
i.primary = true
i.domain = Domain.find(1)
i.subnet=Subnet.find(1)
i.ip="192.168.122.201"
test "should use a nested hostgroup parent root password" do
Setting[:root_pass] = "$1$default$hCkak1kaJPQILNmYbUXhD0"
h = FactoryGirl.create(:host, :managed, :with_hostgroup)
g = h.hostgroup
p = FactoryGirl.create(:hostgroup, :environment => h.environment)
p.update_attribute(:root_pass, "abc")
h.root_pass = nil
g.root_pass = nil
g.parent = p
g.save
diff --git a/app/models/host/discovered.rb b/app/models/host/discovered.rb
index ce475f2..95f255b 100644
--- a/app/models/host/discovered.rb
+++ b/app/models/host/discovered.rb
@@ -75,7 +75,7 @@ class Host::Discovered < ::Host::Base
super + [:ip]
end
- def populate_fields_from_facts facts = self.facts_hash, type = 'puppet'
+ def populate_fields_from_facts facts = self.facts_hash
#!/usr/bin/ruby
require 'pp'
require 'csv'
league = ARGV[1] || "Beyond"
name = ARGV[2] || "Dracharoth"
puts "BB begins here"
puts "--------------"
diff --git a/db/migrate/20140626204657_add_unlimited_to_activation_keys.rb b/db/migrate/20140626204657_add_unlimited_to_activation_keys.rb
index c24252b..1ef0ffb 100644
--- a/db/migrate/20140626204657_add_unlimited_to_activation_keys.rb
+++ b/db/migrate/20140626204657_add_unlimited_to_activation_keys.rb
@@ -5,18 +5,18 @@ class AddUnlimitedToActivationKeys < ActiveRecord::Migration
change_column_default :katello_activation_keys, :max_content_hosts, nil
update "UPDATE katello_activation_keys
- SET unlimited_content_hosts = true, max_content_hosts = null
+ SET unlimited_content_hosts = 1, max_content_hosts = null
diff --git a/app/helpers/foreman_column_view/hosts_helper.rb b/app/helpers/foreman_column_view/hosts_helper.rb
index d52b1a2..2319326 100644
--- a/app/helpers/foreman_column_view/hosts_helper.rb
+++ b/app/helpers/foreman_column_view/hosts_helper.rb
@@ -2,12 +2,12 @@ module ForemanColumnView
module HostsHelper
def fcv_title(column)
- title = SETTINGS[:column_view][column.to_sym][:title]
+ title = SETTINGS[:column_view][column][:title]
diff --git a/app/helpers/katello/hosts_and_hostgroups_helper.rb b/app/helpers/katello/hosts_and_hostgroups_helper.rb
index dfbd7d7..684f8ac 100644
--- a/app/helpers/katello/hosts_and_hostgroups_helper.rb
+++ b/app/helpers/katello/hosts_and_hostgroups_helper.rb
@@ -42,7 +42,7 @@ module Katello
where("#{::Organization.table_name}.label" => kt_org_label).first
%[<option value="#{kt_org_label}/#{kt_env_label}"
- class="kt-env" data-katello-env-id="#{kt_env.id}"
+ class="kt-env" data-katello-env-id="#{kt_env.try(:id)}"