Project

General

Profile

0001-Fixed-detection-of-preseed_server-and-preseed_path-f.patch

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

View differences:

lib/family.rb
1 1
# Adds operatingsystem family behaviour to the Operatingsystem class
2 2
# The variant is calculated at run-time
3 3
require 'ostruct'
4
require 'uri'
5

  
4 6
module Family
5 7
  # NEVER, EVER reorder this list. Additions are allowed but offsets are encoded in the database
6 8
  FAMILIES  = [:Debian, :RedHat, :Solaris]
......
16 18
    include Family
17 19

  
18 20
    def preseed_server media
19
      media.path.match('^(\w+):\/\/((\w|\.)+)((\w|\/)+)$')[2]
21
      URI.parse(media.path).normalize.select(:host, :port).compact.join(':')
20 22
    end
21 23

  
22
    #TODO: rethink of a more generic way
23 24
    def preseed_path media
24
      media.path.match('^(\w+):\/\/((\w|\.)+)((\w|\/)+)$')[4]
25
      URI.parse(media.path).normalize.select(:path, :query).compact.join('?')
25 26
    end
26 27
  end
27 28

  
28
-