Class: Solaris

Inherits:
Operatingsystem show all
Defined in:
app/models/solaris.rb

Constant Summary collapse

PXEFILES =
{:initrd => "x86.miniroot", :kernel => "multiboot"}

Constants inherited from Operatingsystem

Operatingsystem::FAMILIES

Instance Method Summary collapse

Methods inherited from Operatingsystem

#as_json, #bootfile, families, families_as_collection, #family, #family=, #fullname, #initrd, #interpolate_medium_vars, #kernel, #medium_uri, #medium_vars_to_uri, #pxe_files, #release, #repos, #to_s

Methods included from Authorization

#enforce_create_permissions, #enforce_destroy_permissions, #enforce_edit_permissions, #enforce_permissions, included, #permission_failed?

Instance Method Details

#boot_filename(host) ⇒ Object


40
41
42
43
44
45
46
47
# File 'app/models/solaris.rb', line 40

def boot_filename host
  #handle things like gpxelinux/ gpxe / pxelinux here
  if host.jumpstart?
    "Solaris-#{major}.#{minor}-#{release_name}-#{host.model.hardware_model}-inetboot"
  else
    "Solaris-5.#{minor}-#{release_name}-pxegrub"
  end
end

#classObject

Override the class representation, as this breaks many rails helpers


68
69
70
# File 'app/models/solaris.rb', line 68

def class
  Operatingsystem
end

#file_prefixObject


4
5
6
# File 'app/models/solaris.rb', line 4

def file_prefix
  "#{to_s}".gsub(/[\s\(\)]/,"-").gsub("--", "-").gsub(/-$/, "")
end

#image_extensionObject


77
78
79
# File 'app/models/solaris.rb', line 77

def image_extension
  "flar"
end

#jumpstart_params(host, vendor) ⇒ Object


86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'app/models/solaris.rb', line 86

def jumpstart_params host, vendor
  # root server and install server are always the same under Foreman
  server_name = host.medium.media_host
  server_ip   = host.domain.resolver.getaddress(server_name).to_s
  jpath       = jumpstart_path host.medium, host.domain
  ipath       = interpolate_medium_vars(host.medium.media_dir, host.architecture.name, self)

  {
    :vendor => "<#{vendor}>",
    :root_server_ip        => server_ip,                              # 192.168.216.241
    :root_server_hostname  => server_name,                            # mediahost
    :root_path_name        => "#{ipath}/Solaris_#{minor}/Tools/Boot", # /vol/solgi_5.10/sol10_hw0910/Solaris_10/Tools/Boot
    :install_server_ip     => server_ip,                              # 192.168.216.241
    :install_server_name   => server_name,                            # mediahost
    :install_path          => ipath,                                  # /vol/solgi_5.10/sol10_hw0910
    :sysid_server_path     => "#{jpath}/sysidcfg/sysidcfg_primary",   # 192.168.216.241:/vol/jumpstart/sysidcfg/sysidcfg_primary
    :jumpstart_server_path => jpath,                                  # 192.168.216.241:/vol/jumpstart
  }
end

#jumpstart_path(medium, domain) ⇒ Object

Calculates the jumpstart's path in relation to the domain and convert host to an IP


64
65
66
# File 'app/models/solaris.rb', line 64

def jumpstart_path medium, domain
  resolv_nfs_path medium.jumpstart_host, medium.jumpstart_dir, domain
end

#media_path(medium, domain) ⇒ Object

Calculates the media's path in relation to the domain and convert host to an IP


59
60
61
# File 'app/models/solaris.rb', line 59

def media_path medium, domain
  resolv_nfs_path medium.media_host, medium.media_dir, domain
end

#pxe_prefix(architecture = nil) ⇒ Object

sets the prefix for the tftp files based on the OS


9
10
11
# File 'app/models/solaris.rb', line 9

def pxe_prefix(architecture=nil)
  "boot/#{file_prefix}"
end

#pxe_typeObject

The PXE type to use when generating actions and evaluating attributes. jumpstart, kickstart and preseed are currently supported.


18
19
20
# File 'app/models/solaris.rb', line 18

def pxe_type
  "jumpstart"
end

#pxe_variantObject

The variant to use when communicating with the proxy. Syslinux are pxegrub currently supported


23
24
25
# File 'app/models/solaris.rb', line 23

def pxe_variant
  "pxegrub"
end

#pxeconfig_defaultObject


49
50
51
# File 'app/models/solaris.rb', line 49

def pxeconfig_default
  "boot/grub/menu.lst"
end

#pxedirObject


32
33
34
# File 'app/models/solaris.rb', line 32

def pxedir
  "Solaris_#{minor}/Tools/Boot"
end

#require_nfs_access_to_mediumObject

If this OS family requires access to its media via NFS


54
55
56
# File 'app/models/solaris.rb', line 54

def require_nfs_access_to_medium
  true
end

#supports_imageObject

Does this OS family support a build variant that is constructed from a prebuilt archive


73
74
75
# File 'app/models/solaris.rb', line 73

def supports_image
  true
end

#template_kindObject

The kind of PXE configuration template used. PXELinux and PXEGrub are currently supported


28
29
30
# File 'app/models/solaris.rb', line 28

def template_kind
  "PXEGrub"
end

#to_labelObject


13
14
15
# File 'app/models/solaris.rb', line 13

def to_label
  "#{super}#{(' (' + release_name + ')') unless release_name.empty?}"
end

#url_for_boot(file) ⇒ Object


36
37
38
# File 'app/models/solaris.rb', line 36

def url_for_boot(file)
  pxedir + "/" + PXEFILES[file]
end

#use_release_name?Boolean

Does this OS family use release_name in its naming scheme


82
83
84
# File 'app/models/solaris.rb', line 82

def use_release_name?
  true
end