Module: Yast::DhcpServerRoutinesInclude
- Defined in:
- ../../src/include/dhcp-server/routines.rb
Instance Method Summary (collapse)
-
- (Hash) createNewSection(what)
Create new section.
-
- (Array) getItems(type, id)
Get children declarations of a declaration.
- - (Object) initialize_dhcp_server_routines(include_target)
-
- (Object) key2typeid(key)
Split section type and id to two separate strings.
-
- (Object) RestartDhcpDaemon
Restart the DHCP daemon.
-
- (Object) typeid2key(type, id)
Merge section id and key together to one identifier.
Instance Method Details
- (Hash) createNewSection(what)
Create new section
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File '../../src/include/dhcp-server/routines.rb', line 77 def createNewSection(what) if what == :global return { "default-lease-time" => 600, "max-lease-time" => 7200, "ddns-update-style" => "none", "ddns-updates" => "off", "log-facility" => "local7", "authoritative" => "" } elsif what == :subnet return { "subnet" => "", "netmask" => "", "range" => "", "option routers" => "" } elsif what == :host return { "host" => "", "hardware" => "", "fixed-address" => "" } end {} end |
- (Array) getItems(type, id)
Get children declarations of a declaration
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File '../../src/include/dhcp-server/routines.rb', line 49 def getItems(type, id) entries = DhcpServer.GetChildrenOfEntry(type, id) return [] if entries == nil ret = Builtins.maplist(entries) do |e| type2 = Ops.get_string(e, "type", "group") id2 = Ops.get_string(e, "id", "") subentries = DhcpServer.GetChildrenOfEntry(type2, id2) full_id = typeid2key(type2, id2) if Ops.greater_than(Builtins.size(subentries), 0) next Item(Id(full_id), full_id, true, getItems(type2, id2)) end Item(Id(full_id), full_id) end deep_copy(ret) end |
- (Object) initialize_dhcp_server_routines(include_target)
15 16 17 |
# File '../../src/include/dhcp-server/routines.rb', line 15 def initialize_dhcp_server_routines(include_target) textdomain "dhcp-server" end |
- (Object) key2typeid(key)
Split section type and id to two separate strings
37 38 39 40 41 42 43 |
# File '../../src/include/dhcp-server/routines.rb', line 37 def key2typeid(key) return { "type" => "", "id" => "" } if key == " " return nil if !Builtins.regexpmatch(key, "^[^ ]+ .+$") type = Builtins.regexpsub(key, "^([^ ]+) .+$", "\\1") id = Builtins.regexpsub(key, "^[^ ]+ (.+)$", "\\1") { "type" => type, "id" => id } end |
- (Object) RestartDhcpDaemon
Restart the DHCP daemon
20 21 22 23 24 |
# File '../../src/include/dhcp-server/routines.rb', line 20 def RestartDhcpDaemon Service.RunInitScript("dhcpd", "restart") nil end |
- (Object) typeid2key(type, id)
Merge section id and key together to one identifier
30 31 32 |
# File '../../src/include/dhcp-server/routines.rb', line 30 def typeid2key(type, id) Builtins.sformat("%1 %2", type, id) end |