Class: PuavoRest::BootServer

Inherits:
LdapModel show all
Defined in:
resources/boot_servers.rb

Constant Summary

Constant Summary

Constants inherited from LdapModel

LdapModel::ESCAPES, LdapModel::ESCAPE_RE, LdapModel::KRB_LOCK, LdapModel::PROF

Instance Attribute Summary

Attributes inherited from LdapModel

#ldap_attr_store, #serialize_attrs

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from LdapModel

#[], #[]=, _class_store, #add, #add_validation_error, after, all, #as_json, #assert_validation, before, by_attr, by_attr!, by_dn, by_dn!, by_dn_array, by_id, by_id!, by_ldap_attr, by_ldap_attr!, callable_from_instance, #changed?, class_store, clear_setup, computed_attr, connection, #create!, create_connection, create_filter_lambda, #dirty?, dn_bind, #empty?, escape, filter, from_ldap_hash, #get_own, #get_raw, inherited, #initialize, is_dn, is_not_found?, ldap_attrs, ldap_map, #ldap_merge!, ldap_op, #ldap_set, #link, #merge, #new?, #object_model, organisation, organisation?, pretty_attrs_to_ldap, raw_by_dn, raw_filter, sasl_bind, #save!, search, search_filters, #set, settings, settings=, setup, skip_serialize, #to_hash, #to_json, #to_ldap_hash, #transform, #update!, #validate, #validate!, #validate_unique, #write_raw

Constructor Details

This class inherits a constructor from LdapModel

Class Method Details

+ (Object) base_filter

Bootservers are saved to same ldap branch as ltsp servers so we must filter with type too



52
53
54
# File 'resources/boot_servers.rb', line 52

def self.base_filter
  "(puavoDeviceType=bootserver)"
end

+ (Object) by_hostname(hostname)



56
57
58
# File 'resources/boot_servers.rb', line 56

def self.by_hostname(hostname)
  by_attr(:hostname, hostname)
end

+ (Object) by_hostname!(hostname)



60
61
62
# File 'resources/boot_servers.rb', line 60

def self.by_hostname!(hostname)
  by_attr!(:hostname, hostname)
end

+ (Object) current!



35
36
37
# File 'resources/boot_servers.rb', line 35

def self.current!
  BootServer.by_dn!(current_dn)
end

+ (Object) current_dn



23
24
25
26
27
28
29
30
31
32
33
# File 'resources/boot_servers.rb', line 23

def self.current_dn
  return if not running_on?

  if ENV["RACK_ENV"] == "test"
    if !PuavoRest.test_boot_server_dn.nil?
      return PuavoRest.test_boot_server_dn
    end
  end

  PUAVO_ETC.ldap_dn
end

+ (Object) current_image

return current bootserver image or nil



40
41
42
43
44
# File 'resources/boot_servers.rb', line 40

def self.current_image
  if running_on?
    current!.preferred_image
  end
end

+ (Object) ldap_base



46
47
48
# File 'resources/boot_servers.rb', line 46

def self.ldap_base
  "ou=Servers,ou=Hosts,#{ organisation["base"] }"
end

+ (Boolean) running_on?

Return true if the current puavo-rest server is running on a boot server

Returns:

  • (Boolean)


19
20
21
# File 'resources/boot_servers.rb', line 19

def self.running_on?
  !!CONFIG["bootserver"]
end

Instance Method Details

- (Object) schools



64
65
66
67
68
# File 'resources/boot_servers.rb', line 64

def schools
  self["school_dns"].map do |school_dn|
    School.by_dn(school_dn)
  end
end