Skip to content

Commit

Permalink
show popup only once (bnc #926621)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabi2 committed Jun 18, 2015
1 parent 9ce2ea8 commit 91df73b
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/include/iscsi-client/widgets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ def validateInitName(key, event)
# is freely selectable. For further details please check the iSCSI spec.

i_name = Convert.to_string(UI.QueryWidget(:initiator_name, :Value))

# name not changed at all or already saved after checking it
if IscsiClientLib.initiatorname == i_name
return true
end

# regexp for "yyyy-mm."
reg1 = "[[:digit:]]{4}-[[:digit:]]{2}."
# regexp for "cz.suse" or just "suse", "cz.su-se"
Expand All @@ -419,18 +425,20 @@ def validateInitName(key, event)
Builtins.regexpmatch(i_name, Builtins.sformat("^eui.%1%2$", reg1, reg2))

if !correct
continue = Popup.ContinueCancel(
go_on = Popup.YesNoHeadline( _("Incorrect InitiatorName"),
_(
"Incorrect InitiatorName.\n" +
"The correct syntax is\n" +
"iqn.yyyy-mm.reversed.domain.name[:identifier]\n" +
"or eui.yyyy-mm.reversed.domain.name[:identifier]\n" +
"\n" +
"Example:\n" +
"iqn.2007-04.cz.server:storage.disk.sdb\n"
"\n" +
"The correct syntax is\n" +
"iqn.yyyy-mm.reversed.domain.name[:identifier]\n" +
"or eui.yyyy-mm.reversed.domain.name[:identifier]\n" +
"\n" +
"Example:\n" +
"iqn.2007-04.cz.server:storage.disk.sdb\n" +
"\n" +
"Do you want to use the name?\n"
)
)
return continue
return go_on
else
return true
end
Expand Down

0 comments on commit 91df73b

Please sign in to comment.