From c885df333df4194a23ed9fa4a1c16a1ecf75b56e Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 28 Mar 2013 20:17:03 +0100 Subject: [PATCH 01/19] Make build system work with ruby 2.0 --- share/scons/po2json.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/scons/po2json.rb b/share/scons/po2json.rb index 46dbd89579..347362ce64 100755 --- a/share/scons/po2json.rb +++ b/share/scons/po2json.rb @@ -17,7 +17,7 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -if RUBY_VERSION =~ /1.9/ +if RUBY_VERSION >= "1.9" Encoding.default_external = Encoding::UTF_8 Encoding.default_internal = Encoding::UTF_8 end From 3fa17131f50d8e4f7135db9b18fc5ff0a0d652a6 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Mon, 1 Apr 2013 12:17:19 +0200 Subject: [PATCH 02/19] Change rubygems generator for 3.9.80 --- share/rubygems/generate | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/rubygems/generate b/share/rubygems/generate index a7313b843d..8ec88eae6f 100755 --- a/share/rubygems/generate +++ b/share/rubygems/generate @@ -21,7 +21,7 @@ require 'tmpdir' DEFAULTS={ - :version => "3.9.0.beta", + :version => "3.9.80.beta", :date => Time.now.strftime("%Y-%m-%d"), :dependencies => [] } @@ -30,7 +30,7 @@ TEMPLATE=< { - :name => 'oca', + :name => 'opennebula', :files => [ ['src/oca/ruby/opennebula.rb', '/lib'], ['src/oca/ruby/opennebula/*.rb', '/lib/opennebula'], @@ -66,7 +66,7 @@ GEM_DESCRIPTION={ }, :cli => { - :name => 'cli', + :name => 'opennebula-cli', :files => [ ['src/cli/one[a-z]*', '/bin'], ['src/cli/*.rb', '/lib'], @@ -77,7 +77,7 @@ GEM_DESCRIPTION={ :summary => 'OpenNebula Client API', :description => 'Commands used to talk to OpenNebula', :dependencies => [ - ['opennebula-oca', "= #{DEFAULTS[:version]}"] + ['opennebula', "= #{DEFAULTS[:version]}"] ] } } From 6c0421c863e5aff7a75129b726a88319fe7ff7e4 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Mon, 1 Apr 2013 16:02:50 +0200 Subject: [PATCH 03/19] Show CLI help in order even in ruby 1.8.x --- src/cli/command_parser.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cli/command_parser.rb b/src/cli/command_parser.rb index a75362b9d3..019f54a6e8 100644 --- a/src/cli/command_parser.rb +++ b/src/cli/command_parser.rb @@ -56,6 +56,7 @@ module CommandParser def initialize(args=[], &block) @available_options = Array.new @commands = Hash.new + @command_list = Array.new @formats = Hash.new @main = nil @@ -288,6 +289,7 @@ module CommandParser end } cmd[:proc] = block + @command_list << name.to_sym @commands[name.to_sym] = cmd end @@ -617,7 +619,9 @@ module CommandParser puts "## OPTIONS" shown_opts = Array.new - @commands.each do |key,value| + @command_list.each do |key| + value = @commands[key] + value[:options].flatten.each do |o| if shown_opts.include?(o[:name]) next @@ -659,11 +663,12 @@ module CommandParser else puts "## COMMANDS" - @commands.each{ |key,value| + @command_list.each do |key| + value = @commands[key] printf cmd_format5, "* #{key} " print_command(value) - } + end end end From b37396fad49d7223b17211366cd132382f3a35f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 26 Mar 2013 18:09:17 +0100 Subject: [PATCH 04/19] Feature #1797: Update states-simple.dot (cherry picked from commit 3371302024e66dc63da82942787a37c96f756b75) --- share/doc/states/states-simple.dot | 32 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/share/doc/states/states-simple.dot b/share/doc/states/states-simple.dot index f288cb3eb5..f3ac7e7e69 100644 --- a/share/doc/states/states-simple.dot +++ b/share/doc/states/states-simple.dot @@ -21,7 +21,7 @@ digraph OpenNebula { subgraph { rank = min; user} # subgraph { rank = same; pending; hold; color="white"} subgraph { rank = same; prolog; boot; color="white" } - subgraph { rank = same; migrate; save; shutdown; unknown; hotplug; + subgraph { rank = same; migrate; save; shutdown; unknown; hotplug; snapshot; color="white" } subgraph { rank = max; suspended; done; failure; stopped; poweroff; color="white" } @@ -43,8 +43,8 @@ digraph OpenNebula { shutdown -> poweroff [label="poweroff", style="dashed"]; # livemigrate - running -> migrate [label="livemigrate"]; - migrate -> running [label="livemigrate", style="dashed"]; + running -> migrate [label="migrate\n--live"]; + migrate -> running [label="migrate\n--live", style="dashed"]; # migrate running -> save [label="migrate"]; @@ -62,9 +62,6 @@ digraph OpenNebula { save -> epilog [label="stop", style="dashed"]; epilog -> stopped [label="stop", style="dashed"]; -# cancel - running -> shutdown [label="cancel"]; - # suspend running -> save [label="suspend"]; save -> suspended [label="suspend", style="dashed"]; @@ -74,22 +71,27 @@ digraph OpenNebula { suspended -> boot [label="resume"]; # delete - ANY -> done [label="delete"]; + ANY -> done [label="destroy"]; # restart - unknown -> boot [label="restart"]; - boot -> boot [label="restart"]; - poweroff -> boot [label="restart"]; + unknown -> boot [label="boot"]; + boot -> boot [label="boot"]; + poweroff -> boot [label="boot"]; -# reboot, reset - running -> running [label="reboot / reset"]; +# reboot + running -> running [label="reboot"]; -# attachdisk - running -> hotplug [label="attachdisk / detachdisk"] +# disk-attach nic-attach +# running -> hotplug [label="disk / nic -\n attach / detach"] + running -> hotplug [label="disk / nic\nattach"] hotplug -> running [style="dashed"]; +# snapshot + running -> snapshot [label="snapshot-*"] + snapshot -> running [style="dashed"]; + # resubmit - "ANY \\ {suspended,done}" -> pending [label="resubmit"]; + "ANY \\ {suspended,poweroff,done}" -> pending [label="destroy --recreate"]; # failures and misc. ANY -> failure [style="dotted"]; From dbd1aabe8c2eea47c84626898b99e02788803b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 1 Apr 2013 17:15:27 +0200 Subject: [PATCH 05/19] Feature #1797: Update states-complete.dot --- share/doc/states/states-complete.dot | 76 +++++++++++++++++----------- 1 file changed, 47 insertions(+), 29 deletions(-) diff --git a/share/doc/states/states-complete.dot b/share/doc/states/states-complete.dot index 798ec6c2a0..e34c972deb 100644 --- a/share/doc/states/states-complete.dot +++ b/share/doc/states/states-complete.dot @@ -46,6 +46,11 @@ digraph OpenNebula { shutdown -> running [style="dotted"]; +# shutdown --hard + running -> cancel [label="shutdown --hard"]; + cancel -> epilog [style="dashed"]; + cancel -> running [style="dotted"]; + # poweroff running -> shutdown_poweroff [label="poweroff"]; shutdown_poweroff -> poweroff [style="dashed"]; @@ -53,7 +58,7 @@ digraph OpenNebula { shutdown_poweroff -> running [style="dotted"]; # livemigrate - running -> migrate [label="livemigrate"]; + running -> migrate [label="migrate --live"]; migrate -> running [style="dashed"]; # migrate @@ -74,11 +79,6 @@ digraph OpenNebula { save_stop -> running [style="dotted"]; epilog_stop -> stopped [style="dashed"]; -# cancel - running -> cancel [label="cancel"]; - cancel -> epilog [style="dashed"]; - cancel -> running [style="dotted"]; - # suspend running -> save_suspend [label="suspend"]; save_suspend -> suspended [style="dashed"]; @@ -91,31 +91,49 @@ digraph OpenNebula { suspended -> boot_suspended [label="resume"]; boot_suspended -> running [style="dashed"]; -# delete - ANY -> done [label="delete"]; - -# restart - boot -> boot [label="restart"]; - boot_suspended -> boot_suspended [label="restart"]; - boot_stopped -> boot_stopped [label="restart"]; - - poweroff -> boot_poweroff [label="restart"]; - boot_poweroff -> boot_poweroff [label="restart"]; - boot_poweroff -> running [style="dashed"]; - - unknown -> boot_unknown [label="restart"]; - boot_unknown -> boot_unknown [label="restart"]; - boot_unknown -> running [style="dashed"]; - -# reboot, reset - running -> running [label="reboot / reset"]; - -# attachdisk - running -> hotplug [label="attachdisk /\ndetachdisk"] - hotplug -> running [style="dashed"]; +# destroy + ANY -> done [label="destroy"]; # resubmit - "ANY \\ {suspended,poweroff,done}" -> pending [label="resubmit"]; + "ANY \\ {suspended,poweroff,done}" -> pending [label="destroy --recreate"]; + +# boot + boot -> boot [label="boot"]; + boot_suspended -> boot_suspended [label="boot"]; + boot_stopped -> boot_stopped [label="boot"]; + + poweroff -> boot_poweroff [label="boot"]; + boot_poweroff -> boot_poweroff [label="boot"]; + boot_poweroff -> running [style="dashed"]; + + unknown -> boot_unknown [label="boot"]; + boot_unknown -> boot_unknown [label="boot"]; + boot_unknown -> running [style="dashed"]; + +# reboot + running -> running [label="reboot"]; + +# disk-attach + running -> hotplug [label="disk-attach /\n-detach"] + hotplug -> running [style="dashed"]; + +# nic-attach + running -> hotplug_nic [label="nic-attach /\n-detach"] + hotplug_nic -> running [style="dashed"]; + +# snapshot + running -> hotplug_snapshot [label="snapshot-create /\n-revert /\n-delete"] + hotplug_snapshot -> running [style="dashed"]; + +# disk-snapshot + running -> hotplug_saveas [label="disk-snapshot"] + hotplug_saveas -> running [style="dashed"]; + + poweroff -> hotplug_saveas_poweroff [label="disk-snapshot"] + hotplug_saveas_poweroff -> poweroff [style="dashed"]; + + suspended -> hotplug_saveas_suspended [label="disk-snapshot"] + hotplug_saveas_suspended -> suspended [style="dashed"]; # failures and misc. epilog_stop -> failure [style="dotted"]; From 01d8ad7010fd297150ec5713d1b48141a27da025 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Mon, 1 Apr 2013 16:54:11 +0200 Subject: [PATCH 06/19] Notify the user when VNC proxy starts --- src/sunstone/OpenNebulaVNC.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sunstone/OpenNebulaVNC.rb b/src/sunstone/OpenNebulaVNC.rb index 0e063196e0..59653d183d 100644 --- a/src/sunstone/OpenNebulaVNC.rb +++ b/src/sunstone/OpenNebulaVNC.rb @@ -103,6 +103,8 @@ class OpenNebulaVNC return false end + STDOUT.puts "VNC proxy started" + true end From 78db804413f00da0f3332d339415806ea198b41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 1 Apr 2013 17:51:38 +0200 Subject: [PATCH 07/19] Update xsd files --- share/doc/xsd/cluster.xsd | 1 + share/doc/xsd/datastore.xsd | 2 +- share/doc/xsd/group.xsd | 71 ++++++++++++++++ share/doc/xsd/group_pool.xsd | 153 ++++++++++++++++++++++++++++++++++- share/doc/xsd/test.sh | 4 +- share/doc/xsd/user.xsd | 71 ++++++++++++++++ share/doc/xsd/user_pool.xsd | 151 +++++++++++++++++++++++++++++++++- share/doc/xsd/vnet.xsd | 5 +- 8 files changed, 451 insertions(+), 7 deletions(-) diff --git a/share/doc/xsd/cluster.xsd b/share/doc/xsd/cluster.xsd index 7fdacacb8d..c2639f3004 100644 --- a/share/doc/xsd/cluster.xsd +++ b/share/doc/xsd/cluster.xsd @@ -6,6 +6,7 @@ + diff --git a/share/doc/xsd/datastore.xsd b/share/doc/xsd/datastore.xsd index e3a0788e83..7f815de702 100644 --- a/share/doc/xsd/datastore.xsd +++ b/share/doc/xsd/datastore.xsd @@ -28,7 +28,7 @@ - + diff --git a/share/doc/xsd/group.xsd b/share/doc/xsd/group.xsd index 97e1ed63b6..56c2438f7c 100644 --- a/share/doc/xsd/group.xsd +++ b/share/doc/xsd/group.xsd @@ -78,6 +78,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/doc/xsd/group_pool.xsd b/share/doc/xsd/group_pool.xsd index c8dc69c06b..a217be7b08 100644 --- a/share/doc/xsd/group_pool.xsd +++ b/share/doc/xsd/group_pool.xsd @@ -1,11 +1,160 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/doc/xsd/test.sh b/share/doc/xsd/test.sh index 265f69025b..ad1622f166 100755 --- a/share/doc/xsd/test.sh +++ b/share/doc/xsd/test.sh @@ -33,8 +33,8 @@ onegroup create newgroup # Host -onehost create host01 --im im_dummy --vm vmm_dummy --net dummy -onehost create host02 --im im_dummy --vm vmm_dummy --net dummy +onehost create host01 --im dummy --vm dummy --net dummy +onehost create host02 --im dummy --vm dummy --net dummy onecluster addhost newcluster host02 diff --git a/share/doc/xsd/user.xsd b/share/doc/xsd/user.xsd index db53b82d34..f851f688f0 100644 --- a/share/doc/xsd/user.xsd +++ b/share/doc/xsd/user.xsd @@ -77,6 +77,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/doc/xsd/user_pool.xsd b/share/doc/xsd/user_pool.xsd index 96657f384d..dc1b1289a0 100644 --- a/share/doc/xsd/user_pool.xsd +++ b/share/doc/xsd/user_pool.xsd @@ -5,7 +5,156 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/doc/xsd/vnet.xsd b/share/doc/xsd/vnet.xsd index 825da54bd6..2e14b16270 100644 --- a/share/doc/xsd/vnet.xsd +++ b/share/doc/xsd/vnet.xsd @@ -50,8 +50,11 @@ - + + + + From c189e304b2560c12529cd54e7d2577dda143015e Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 2 Apr 2013 11:04:59 +0200 Subject: [PATCH 08/19] Generate deprecated opennebula-oca rubygem --- share/rubygems/deprecated/README | 1 + share/rubygems/generate | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 share/rubygems/deprecated/README diff --git a/share/rubygems/deprecated/README b/share/rubygems/deprecated/README new file mode 100644 index 0000000000..3d0fbd9915 --- /dev/null +++ b/share/rubygems/deprecated/README @@ -0,0 +1 @@ +This gem is deprecated, use "opennebula" gem instead. diff --git a/share/rubygems/generate b/share/rubygems/generate index 8ec88eae6f..4914aa454e 100755 --- a/share/rubygems/generate +++ b/share/rubygems/generate @@ -74,11 +74,23 @@ GEM_DESCRIPTION={ ['NOTICE', ''], ['LICENSE', ''] ], - :summary => 'OpenNebula Client API', + :summary => 'OpenNebula Command Line Interface', :description => 'Commands used to talk to OpenNebula', :dependencies => [ ['opennebula', "= #{DEFAULTS[:version]}"] ] + }, + + :oca_deprecated => { + :name => 'opennebula-oca', + :files => [ + ['share/rubygems/deprecated/README', ''] + ], + :summary => 'OpenNebula Client API (deprecated)', + :description => 'Use opennebula gem instead', + :dependencies => [ + ['opennebula', "= #{DEFAULTS[:version]}"] + ] } } From 4d2cb9b1149735468468613759052d90c03e4cf8 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 2 Apr 2013 15:17:31 +0200 Subject: [PATCH 09/19] bug #1846: Fix live migration in Sunstone --- .../models/OpenNebulaJSON/VirtualMachineJSON.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb index 12dc37e3d0..f8a6e28aad 100644 --- a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb @@ -47,8 +47,8 @@ module OpenNebulaJSON when "deploy" then self.deploy(action_hash['params']) when "finalize" then self.finalize when "hold" then self.hold - when "livemigrate" then self.live_migrate(action_hash['params']) - when "migrate" then self.migrate(action_hash['params']) + when "livemigrate" then self.migrate(action_hash['params'], true) + when "migrate" then self.migrate(action_hash['params'], false) when "resume" then self.resume when "release" then self.release when "stop" then self.stop @@ -87,12 +87,9 @@ module OpenNebulaJSON super(params['host_id']) end - def live_migrate(params=Hash.new) - super(params['host_id']) - end - - def migrate(params=Hash.new) - super(params['host_id']) + def migrate(params=Hash.new, live=false, enforce=false) + # TODO add enforce parameter + super(params['host_id'], live) end def save_as(params=Hash.new) From 7a11e5b0bbdffdcfdda142585360c1501caf9d23 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 2 Apr 2013 15:25:28 +0200 Subject: [PATCH 10/19] Add support for deprecated CLI commands --- src/cli/command_parser.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/cli/command_parser.rb b/src/cli/command_parser.rb index 019f54a6e8..23c9f6b770 100644 --- a/src/cli/command_parser.rb +++ b/src/cli/command_parser.rb @@ -293,6 +293,20 @@ module CommandParser @commands[name.to_sym] = cmd end + def deprecated_command(name, new_command) + cmd = Hash.new + cmd[:desc] = "Deprecated, use #{new_command} instead" + cmd[:arity] = 0 + cmd[:options] = [] + cmd[:args_format] = [[:string, nil]] * 20 + cmd[:deprecated] = new_command + cmd[:proc] = lambda do + print_deprecated(new_command) + end + + @commands[name.to_sym] = cmd + end + # Defines a new action for the command, several actions can be defined # for a command. For example: create, delete, list. # The options and args variables can be used inside the block, and @@ -420,6 +434,10 @@ module CommandParser exit -1 end + if comm[:deprecated] + print_deprecated(comm[:deprecated]) + end + extra_options = comm[:options] if comm parse(extra_options) @@ -718,6 +736,12 @@ module CommandParser } end + def print_deprecated(new_command) + puts "This command is deprecated, use instead:" + puts " $ #{File.basename $0} #{new_command}" + exit(-1) + end + def word_wrap(size, text, first_size=nil) output=[] line="" From 8f3c1f701c49185f09da9e1c320cc9d32cc75cb0 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 2 Apr 2013 15:25:47 +0200 Subject: [PATCH 11/19] Add onevm deprecated actions --- src/cli/onevm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/cli/onevm b/src/cli/onevm index 4b3ea234f6..8b74945d54 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -746,4 +746,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do vm.resize(template, enforce) end end + + # Deprecated commands + + deprecated_command(:attachdisk, 'disk-attach') + deprecated_command(:detachdisk, 'disk-detach') + deprecated_command(:saveas, 'disk-snapshot') + deprecated_command(:livemigrate, 'migrate --live') + deprecated_command(:cancel, 'shutdown --hard') + deprecated_command(:reset, 'reboot --hard') + deprecated_command(:restart, 'boot') + deprecated_command(:delete, 'destroy') + deprecated_command(:resubmit, 'destroy --recreate') end From 9defeb449c979f0a7567b50aeeed1785b91e1818 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 2 Apr 2013 16:24:20 +0200 Subject: [PATCH 12/19] feature #1825: Fix add ssh and network context checkboxes --- src/sunstone/public/css/app.css | 6 + .../public/js/plugins/templates-tab.js | 140 +++++++++++------- src/sunstone/public/js/sunstone-util.js | 2 +- src/sunstone/public/sass/app.scss | 5 + 4 files changed, 96 insertions(+), 57 deletions(-) diff --git a/src/sunstone/public/css/app.css b/src/sunstone/public/css/app.css index 318cc99e2b..6fe6775220 100644 --- a/src/sunstone/public/css/app.css +++ b/src/sunstone/public/css/app.css @@ -6854,3 +6854,9 @@ div.time-picker li.selected { .columns { line-height: 2; } + +/* line 786, ../sass/app.scss */ +.transparent_table, .transparent_table tr { + background: none !important; + border: 0px !important; +} diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index da43df0e36..a1ceb141b1 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -751,7 +751,7 @@ function generate_disk_tab_content(str_disk_tab_id, str_datatable_id){ ''+ ''+ '
'+ - '
'+ + '
'+ '
'+ '
'+ ''+ @@ -1376,10 +1376,13 @@ function updateTemplateInfo(request,template){ }; var template_tab = { title: tr("Template"), - content: '\ - '+ - prettyPrintJSON(template_info.TEMPLATE)+ - '
'+tr("Template")+'
' + content: '
\ +
\ + '+ + prettyPrintJSON(template_info.TEMPLATE)+'\ +
\ +
\ +
' }; $("#div_edit_rename_link").die(); @@ -1515,42 +1518,49 @@ function setupCreateTemplateDialog(){ var removeEmptyObjects = function(obj){ for (elem in obj){ var remove = false; - var value = obj[elem]; - if (value instanceof Array) - { - if (value.length == 0) - remove = true; - else if (value.length > 0) - { - value = jQuery.grep(value, function (n) { - var obj_length = 0; - for (e in n) - obj_length += 1; - - if (obj_length == 0) - return false; - - return true; - }); + if (elem == 'undefined') { + remove = true; + } + else { + var value = obj[elem]; + if (value instanceof Array) + { if (value.length == 0) - remove = true; - } - } - else if (value instanceof Object) - { - var obj_length = 0; - for (e in value) - obj_length += 1; - if (obj_length == 0) - remove = true; - } - else - { - value = String(value); - if (value.length == 0) - remove = true; + remove = true; + else if (value.length > 0) + { + value = jQuery.grep(value, function (n) { + var obj_length = 0; + for (e in n) + obj_length += 1; + + if (obj_length == 0) + return false; + + return true; + }); + + if (value.length == 0) + remove = true; + } + } + else if (value instanceof Object) + { + var obj_length = 0; + for (e in value) + obj_length += 1; + if (obj_length == 0) + remove = true; + } + else + { + value = String(value); + if (value.length == 0) + remove = true; + } } + if (remove) delete obj[elem]; } @@ -2324,37 +2334,45 @@ function setupCreateTemplateDialog(){ '
'+ ''+tr("SSH")+''+ '
'+ - '
'+ - ''+ + '
'+ + ''+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + '
'+tr("Add an ssh public key to the context. If the Public Key textarea is empty then the user variable SSH_PUBLIC_KEY will be used.")+'
'+ '
'+ '
'+ - '
'+ '
'+ - '
'+ - ''+ - '
'+ - '
'+ - ''+ - '
'+ - '
'+ + '
'+ + ''+ '
'+ '
'+ + '
'+ + '