Skip to content

Commit

Permalink
Read/Write cleanup - removed sleep() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Oct 14, 2014
1 parent 401834f commit 173f868
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions src/modules/Instserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1147,12 +1147,8 @@ def ServiceValid(config)
def Read
# Instserver read dialog caption
caption = _("Initializing Configuration")

steps = 4

sl = 1
Builtins.sleep(sl)

# We do not set help text here, because it was set outside
Progress.New(
caption,
Expand Down Expand Up @@ -1180,10 +1176,12 @@ def Read
Progress.NextStage
c = {}


if SCR.Read(path(".target.size"), @ConfigFile) != -1
c = XML.XMLToYCPFile(@ConfigFile)
# TRANSLATORS: Error message
Report.Error(_("Cannot read current settings.")) unless c
end

all = Ops.get_list(c, "configurations", [])
@ServerSettings = Ops.get_map(c, "servers", {})

Expand All @@ -1197,7 +1195,7 @@ def Read
Builtins.y2milestone("Server config: %1", @ServerSettings)

# check the server status here
if @ServerSettings == {} || !ServiceValid(@ServerSettings)
if @ServerSettings.empty? || !ServiceValid(@ServerSettings)
@FirstDialog = "settings"
end

Expand All @@ -1207,54 +1205,35 @@ def Read
SuSEFirewall.Read
Progress.set(prg)

Builtins.sleep(sl)


# read current settings
return false if Abort()
Progress.NextStage


@Detected = DetectMedia()

# Error message
Report.Error(_("Cannot read current settings.")) if false
Builtins.sleep(sl)


return false if Abort()
# Progress finished
Progress.NextStage
Builtins.sleep(sl)

return false if Abort()
@modified = false
true
end



# Prepare map for writing into XML
# @return [Array]s of configurations
def PrepareConfigs
c = Builtins.maplist(@Configs) { |k, v| v }
deep_copy(c)
end


# Write all instserver settings
# @return true on success
def Write
Builtins.y2debug("Instserver::Write() called")

# Instserver read dialog caption
caption = _("Saving Installation Server Configuration")

steps = 2

sl = 1
Builtins.sleep(sl)

# We do not set help text here, because it was set outside
Progress.New(
caption,
Expand Down Expand Up @@ -1286,8 +1265,7 @@ def Write
ret = XML.YCPToXMLFile(:instserver, xml, @ConfigFile)

# Error message
Report.Error(_("Cannot write settings.")) if false
Builtins.sleep(sl)
Report.Error(_("Cannot write settings.")) unless ret

# run SuSEconfig
return false if Abort()
Expand Down Expand Up @@ -1318,7 +1296,6 @@ def Write
end
end


# Remove the SLP files of removed or SLP disabled repositories
Builtins.foreach(regs_delete) do |c2|
regfile = Builtins.sformat("/etc/slp.reg.d/YaST-%1.reg", c2)
Expand Down Expand Up @@ -1360,7 +1337,7 @@ def Write
end
end


return false if Abort()

# slp service reload is required - the configuration has been changed
if slpreload
Expand All @@ -1371,16 +1348,12 @@ def Write
end
end

return false if Abort()
# Progress finished
Progress.NextStage
Builtins.sleep(sl)

return false if Abort()
true
end


def UpdateConfig
Builtins.y2debug("current config: %1", @Configs)

Expand Down

0 comments on commit 173f868

Please sign in to comment.