Class: Yast::HostClient

Inherits:
Client
  • Object
show all
Defined in:
src/clients/host.rb

Instance Method Summary collapse

Instance Method Details

#HostGUIObject

Main hosts GUI


90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'src/clients/host.rb', line 90

def HostGUI
  Host.Read

  Wizard.CreateDialog
  Wizard.SetDesktopTitleAndIcon("host")
  Wizard.SetNextButton(:next, Label.FinishButton)

  # main ui function
  ret = HostsMainDialog(true)

  Host.Write if ret == :next && Host.GetModified

  UI.CloseDialog
end

#ListHandler(_options) ⇒ Object

Handler for action "list"


107
108
109
110
111
112
113
114
115
# File 'src/clients/host.rb', line 107

def ListHandler(_options)
  # Command line output Headline
  # configuration of hosts
  summary = "\n" + _("Host Configuration Summary:") + "\n\n" +
    RichText.Rich2Plain(Host.Summary) + "\n"

  CommandLine.Print(summary)
  true
end

#mainObject


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'src/clients/host.rb', line 34

def main
  Yast.import "UI"

  textdomain "network"

  # The main ()
  Builtins.y2milestone("----------------------------------------")
  Builtins.y2milestone("Host module started")

  Yast.import "Host"
  Yast.import "Label"
  Yast.import "Wizard"

  Yast.import "CommandLine"
  Yast.import "RichText"

  Yast.include self, "network/runtime.rb"
  Yast.include self, "network/services/host.rb"

  # Command line definition
  @cmdline = {
    # Commandline help title
    # configuration of hosts
    "help"       => _(
      "Host Configuration"
    ),
    "id"         => "host",
    "guihandler" => fun_ref(method(:HostGUI), "any ()"),
    "initialize" => fun_ref(Host.method(:Read), "boolean ()"),
    "finish"     => fun_ref(Host.method(:Write), "boolean ()"), # FIXME
    "actions"    => {
      "list" => {
        # Commandline command help
        "help"    => _(
          "Display configuration summary"
        ),
        "handler" => fun_ref(
          method(:ListHandler),
          "boolean (map <string, string>)"
        )
      }
    }
  }

  @ret = CommandLine.Run(@cmdline)
  Builtins.y2debug("ret=%1", @ret)

  # Finish
  Builtins.y2milestone("Host module finished")
  Builtins.y2milestone("----------------------------------------")
  deep_copy(@ret)

  # EOF
end