Module: Yast::SambaServerComplexInclude

Defined in:
../../src/include/samba-server/complex.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) initialize_samba_server_complex(include_target)



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

def initialize_samba_server_complex(include_target)
  textdomain "samba-server"

  Yast.import "Wizard"

  Yast.import "SambaServer"
  Yast.import "SambaService"
  Yast.import "Progress"
  Yast.import "Report"
  Yast.import "FileUtils"
  Yast.import "Popup"

  Yast.include include_target, "samba-server/helps.rb"
end

- (Object) ProgressStatus

replace with Progress::status() after accepted into the build Function returns current progress status



56
57
58
59
60
61
62
63
# File '../../src/include/samba-server/complex.rb', line 56

def ProgressStatus
  # set new progress
  old_progress = Progress.set(false)
  # set old progress back
  Progress.set(old_progress)
  # return current progress
  old_progress
end

- (Object) ReadDialog

Read settings dialog

Returns:

  • abort if aborted andnext otherwise



48
49
50
51
52
# File '../../src/include/samba-server/complex.rb', line 48

def ReadDialog
  Wizard.RestoreHelp(Ops.get_string(@HELPS, "read", ""))
  ret = SambaServer.Read
  ret ? :next : :abort
end

- (Object) WriteDialog

Write settings dialog

Returns:

  • abort if aborted andnext otherwise



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
# File '../../src/include/samba-server/complex.rb', line 67

def WriteDialog
  Wizard.RestoreHelp(Ops.get_string(@HELPS, "write", ""))
  # Bugzilla #120080 - 'reload' instead of 'restart'
  # If there some connected users, SAMBA is running and should be running also after the Write() operation
  #    and the Progress was turned on before Writing SAMBA conf
  connected_users = SambaService.ConnectedUsers
  Builtins.y2milestone(
    "Number of connected users: %1",
    Builtins.size(connected_users)
  )
  report_restart_popup = Ops.greater_than(Builtins.size(connected_users), 0) &&
    SambaService.GetServiceRunning &&
    SambaService.GetServiceAutoStart &&
    ProgressStatus()

  ret = SambaServer.Write(false)

  # If popup should be shown and SAMBA is still/again running
  if report_restart_popup && SambaService.GetServiceRunning
    # TRANSLATORS: a popup message
    Report.Message(
      _(
        "Because users are currently connected to this Samba server,\n" +
          "the server configuration has been reloaded instead of restarted.\n" +
          "To confirm that all settings are applied despite possibly disconnecting the users,\n" +
          "run '/etc/init.d/smb restart' and '/etc/init.d/nmb restart'"
      )
    )
  end
  ret ? :next : :abort
end