Skip to content

Commit

Permalink
fixed some changes proposed by jreidinger
Browse files Browse the repository at this point in the history
  • Loading branch information
vpereira committed Oct 5, 2016
1 parent a5ce056 commit 126b874
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 29 deletions.
19 changes: 3 additions & 16 deletions src/clients/security_auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,13 @@ def main
Ops.get_string(@param, "encryption", "des")
)
end
@ret = Security.Import(
Map.KeysToUpper(
Convert.convert(@param, from: "map", to: "map <string, any>")
)
)
@ret = Security.Import(Map.KeysToUpper(@param))
# Return required packages
when "Packages"
@ret = {}
# Return actual state
when "Export"
@ret = Map.KeysToLower(
Convert.convert(
Security.Export,
from: "map",
to: "map <string, any>"
)
)
@ret = Security.Import(Map.KeysToUpper(Security.Export))
# Read current state
when "Read"
Yast.import "Progress"
Expand All @@ -130,10 +120,7 @@ def main
Builtins.y2debug("ret=%1", @ret)
Builtins.y2milestone("Security auto finished")
Builtins.y2milestone("----------------------------------------")

# is it needed?
deep_copy(@ret)
# EOF
@ret
end
end
end
Expand Down
7 changes: 3 additions & 4 deletions src/include/security/dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def DisplayHelpPopup(help_id)
if help_id == "MANDATORY_SERVICES"
missing = Security.MissingMandatoryServices

if !missing.nil? && missing != []
if missing && !missing.empty?
srvs = ""

Builtins.foreach(missing) do |l|
Expand All @@ -370,8 +370,7 @@ def DisplayHelpPopup(help_id)
end
elsif help_id == "EXTRA_SERVICES"
extra = Security.ExtraServices

if !extra.nil? && extra != []
if extra && !extra.empty?
srvs = Builtins.mergestring(extra, "<BR>")
help +=
_("<P>These extra services are enabled:<BR><B>%s</B></P>") % srvs
Expand All @@ -381,7 +380,7 @@ def DisplayHelpPopup(help_id)
end
end

if !help.nil? && help != ""
if help && !help.empty?
Popup.LongText(
Ops.get(@label_mapping, help_id, _("Description")),
RichText(help),
Expand Down
10 changes: 3 additions & 7 deletions src/include/security/routines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def settings2widget(_ID)
# "Widget" == "IntField"
if widget == "IntField"
intval = Builtins.tointeger(value)
intval = 0 if intval.nil?
intval ||= 0
return VBox(
Left(IntField(Id(_ID), label, minval, maxval, intval)),
VSeparator()
Expand All @@ -112,7 +112,7 @@ def settings2widget(_ID)
# string|list it
Builtins.y2debug("li=%1 (%2)", li, i)
it = Ops.get(li, i)
it = "" if it.nil?
it ||= ""
Builtins.y2debug("it=%1", it)
id_t = ""
id_s = ""
Expand Down Expand Up @@ -158,11 +158,7 @@ def widget2settings(_ID)
ret = UI.QueryWidget(Id(_ID), :Value)
new = ""
if Ops.is_boolean?(ret)
new = if ret == true
"yes"
else
"no"
end
new = ret ? "yes" : "no"
elsif Ops.is_integer?(ret)
new = Builtins.sformat("%1", ret)
elsif Ops.is_string?(ret)
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Security.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def PollAbort
# Abort function
# @return false
def Abort
return Builtins.eval(@AbortFunction) == true if !@AbortFunction.nil?
return Builtins.eval(@AbortFunction) == true if @AbortFunction
false
end

Expand Down Expand Up @@ -755,7 +755,7 @@ def Summary
summary = _("Current Security Level: Custom settings")
if current != :custom
# Summary text
summary = _("Current Security Level: #{@LevelsNames[current]}")
summary = _("Current Security Level: %s") % @LevelsNames[current]
end
[summary, []]
end
Expand Down

0 comments on commit 126b874

Please sign in to comment.