Module: Yast::DrbdDialogsInclude

Defined in:
../../src/include/drbd/dialogs.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) Configure1Dialog

Configure1 dialog

Returns:

  • dialog result



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
# File '../../src/include/drbd/dialogs.rb', line 97

def Configure1Dialog
  # Drbd configure1 dialog caption
  caption = _("DRBD Configuration")

  # Drbd configure1 dialog contents
  contents = Label(_("First part of configuration of DRBD"))

  Wizard.SetContentsButtons(
    caption,
    contents,
    Ops.get_string(@HELPS, "c1", ""),
    Label.BackButton,
    Label.NextButton
  )

  ret = nil
  while true
    ret = UI.UserInput

    # abort?
    if ret == :abort || ret == :cancel
      if ReallyAbort()
        break
      else
        next
      end
    elsif ret == :next || ret == :back
      break
    else
      Builtins.y2error("unexpected retcode: %1", ret)
      next
    end
  end

  deep_copy(ret)
end

- (Object) Configure2Dialog

Configure2 dialog

Returns:

  • dialog result



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
162
163
164
165
166
167
168
169
170
171
# File '../../src/include/drbd/dialogs.rb', line 136

def Configure2Dialog
  # Drbd configure2 dialog caption
  caption = _("DRBD Configuration")

  # Drbd configure2 dialog contents
  contents = Label(_("Second part of configuration of DRBD"))

  Wizard.SetContentsButtons(
    caption,
    contents,
    Ops.get_string(@HELPS, "c2", ""),
    Label.BackButton,
    Label.NextButton
  )

  ret = nil
  while true
    ret = UI.UserInput

    # abort?
    if ret == :abort || ret == :cancel
      if ReallyAbort()
        break
      else
        next
      end
    elsif ret == :next || ret == :back
      break
    else
      Builtins.y2error("unexpected retcode: %1", ret)
      next
    end
  end

  deep_copy(ret)
end

- (Object) initialize_drbd_dialogs(include_target)



30
31
32
33
34
35
36
37
38
39
40
41
42
# File '../../src/include/drbd/dialogs.rb', line 30

def initialize_drbd_dialogs(include_target)
  Yast.import "UI"

  textdomain "drbd"

  Yast.import "Label"
  Yast.import "Wizard"
  Yast.import "Drbd"
  Yast.import "Popup"

  Yast.include include_target, "drbd/helps.rb"
  Yast.include include_target, "drbd/common.rb"
end

- (Object) ReadDialog



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File '../../src/include/drbd/dialogs.rb', line 63

def ReadDialog
  Wizard.RestoreHelp(Ops.get_string(@HELPS, "read", ""))
  ret = Drbd.Read
  if ret == false
    Popup.Error(
      Ops.add(
        _("Failed to read DRBD configuration file:\n"),
        Drbd.global_error
      )
    )
  end

  return :abort if update_conf_warning == false

  ret ? :next : :abort
end

- (Object) update_conf_warning



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File '../../src/include/drbd/dialogs.rb', line 44

def update_conf_warning
  if Ops.greater_than(SCR.Read(path(".target.size"), "/etc/drbd.conf"), 0)
    if SCR.Execute(
        path(".target.bash"),
        "/usr/bin/grep '# YaST2 created seperated configuration file' /etc/drbd.conf"
      ) != 0
      return Popup.YesNo(
        _("Warning: YaST2 DRBD module will rename all\n") +
          _(
            "included files for DRBD into a supported schema.\n" +
              "\n" +
              "Do you want to continue?"
          )
      )
    end
  end
  true
end

- (Object) WriteDialog



80
81
82
83
84
85
86
87
88
89
90
91
92
# File '../../src/include/drbd/dialogs.rb', line 80

def WriteDialog
  Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", ""))
  ret = Drbd.Write
  if ret == false
    Popup.Error(
      Ops.add(
        _("Failed to write configuration to disk:\n"),
        Drbd.global_error
      )
    )
  end
  ret ? :next : :main
end