Module: Yast::RelocationServerWizardsInclude

Defined in:
../../src/include/relocation-server/wizards.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) initialize_relocation_server_wizards(include_target)



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File '../../src/include/relocation-server/wizards.rb', line 32

def initialize_relocation_server_wizards(include_target)
  textdomain "relocation-server"

  Yast.import "Arch"
  Yast.import "Sequencer"
  Yast.import "Wizard"
  Yast.import "CWM"
  Yast.import "CWMTab"
  Yast.import "CWMServiceStart"
  Yast.import "CWMFirewallInterfaces"

  Yast.include include_target, "relocation-server/complex.rb"
  Yast.include include_target, "relocation-server/dialogs.rb"
end

- (Object) MainSequence

Main workflow of the relocation-server configuration

Returns:

  • sequence result



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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File '../../src/include/relocation-server/wizards.rb', line 49

def MainSequence
  widgets = {
    "fw-xend" => CWMFirewallInterfaces.CreateOpenFirewallWidget(
      {
        "services"        => ["service:xend-relocation-server"],
        "display_details" => true
      }
    ),
    "xend"    => {
      "widget"        => :custom,
      "help"          => Ops.get_string(@HELPS, "xend_configuration", ""),
      "custom_widget" => XendConfigurationDialogContent(),
      "handle"        => fun_ref(
        method(:HandleXendConfigurationDialog),
        "symbol (string, map)"
      ),
      "init"          => fun_ref(
        method(:InitXendConfigurationDialog),
        "void (string)"
      ),
      "store"         => fun_ref(
        method(:StoreXendConfigurationDialog),
        "void (string, map)"
      )
    },
    "kvm"     => {
      "widget"        => :custom,
      "help"          => Ops.get_string(@HELPS, "kvm_configuration", ""),
      "custom_widget" => KVMConfigurationDialogContent(),
      "handle"        => fun_ref(
        method(:HandleKVMConfigurationDialog),
        "symbol (string, map)"
      ),
      "init"          => fun_ref(
        method(:InitKVMConfigurationDialog),
        "void (string)"
      ),
      "store"         => fun_ref(
        method(:StoreKVMConfigurationDialog),
        "void (string, map)"
      )
    },
    "fw-kvm"  => CWMFirewallInterfaces.CreateOpenFirewallWidget(
      {
        "services"        => [
          "service:libvirtd-relocation-server",
          "service:sshd"
        ],
        "display_details" => true
      }
    )
  }

  tabs = {
    "xend_configuration" => {
      "header"       => _("&Xend"),
      "widget_names" => ["xend", "fw-xend"],
      "contents"     => XendConfigurationDialogContent()
    },
    "kvm_configuration"  => {
      "header"       => _("&KVM"),
      "widget_names" => ["kvm", "fw-kvm"],
      "contents"     => KVMConfigurationDialogContent()
    }
  }

  if !Arch.is_xen0
    Builtins.remove(tabs, "xend_configuration")
  else
    Builtins.remove(tabs, "kvm_configuration")
  end

  wd_arg = {
    "tab_order"    => ["xend_configuration"],
    "tabs"         => tabs,
    "widget_descr" => widgets,
    "initial_tab"  => "xend_configuration"
  }

  if !Arch.is_xen0
    Ops.set(wd_arg, "tab_order", ["kvm_configuration"])
    Ops.set(wd_arg, "initial_tab", "kvm_configuration")
  end

  wd = { "tab" => CWMTab.CreateWidget(wd_arg) }

  contents = VBox("tab")

  w = CWM.CreateWidgets(
    ["tab"],
    Convert.convert(
      wd,
      :from => "map <string, any>",
      :to   => "map <string, map <string, any>>"
    )
  )

  caption = _("Relocation Server Configuration")
  contents = CWM.PrepareDialog(contents, w)

  Wizard.SetContentsButtons(
    caption,
    contents,
    "",
    Label.BackButton,
    Label.OKButton
  )
  Wizard.HideBackButton
  Wizard.SetAbortButton(:abort, Label.CancelButton)
  Wizard.SetDesktopTitleAndIcon("relocation-server")

  CWM.Run(w, { :abort => fun_ref(method(:ReallyExit), "boolean ()") })
end

- (Object) RelocationServerSequence

Whole configuration of relocation-server

Returns:

  • sequence result



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File '../../src/include/relocation-server/wizards.rb', line 165

def RelocationServerSequence
  aliases = {
    "read"  => [lambda { ReadDialog() }, true],
    "main"  => lambda { MainSequence() },
    "write" => [lambda { WriteDialog() }, true]
  }

  sequence = {
    "ws_start" => "read",
    "read"     => { :abort => :abort, :next => "main" },
    "main"     => { :abort => :abort, :next => "write" },
    "write"    => { :abort => :abort, :next => :next }
  }

  Wizard.CreateDialog
  Wizard.SetDesktopTitleAndIcon("relocation-server")

  ret = Sequencer.Run(aliases, sequence)

  UI.CloseDialog
  deep_copy(ret)
end