Project

General

Profile

Refactor #235 » 0001-Fixed-detection-of-preseed_server-and-preseed_path-f.patch

Jochen Schalanda, 05/03/2010 01:57 PM

View differences:

lib/family.rb
# Adds operatingsystem family behaviour to the Operatingsystem class
# The variant is calculated at run-time
require 'ostruct'
require 'uri'
module Family
# NEVER, EVER reorder this list. Additions are allowed but offsets are encoded in the database
FAMILIES = [:Debian, :RedHat, :Solaris]
......
include Family
def preseed_server media
media.path.match('^(\w+):\/\/((\w|\.)+)((\w|\/)+)$')[2]
URI.parse(media.path).normalize.select(:host, :port).compact.join(':')
end
#TODO: rethink of a more generic way
def preseed_path media
media.path.match('^(\w+):\/\/((\w|\.)+)((\w|\/)+)$')[4]
URI.parse(media.path).normalize.select(:path, :query).compact.join('?')
end
end
(2-2/4)