Refactor #235 » 0001-Fixed-detection-of-preseed_server-and-preseed_path-f.patch
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
|
||