Added error message for change-body function + trailling spaces fixed

(cherry picked from commit 253738d6e8)
This commit is contained in:
Diego del Corral authored and Ruben S. Montero committed 2017-11-17 21:22:00 +01:00
1 parent 889086d141
commit ca99f70760
4 files changed
+17 -13

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ module OpenNebula
EALLOCATE = 0x4000
ENOTDEFINED = 0xF001
EXML_RPC_CALL = 0xF002
attr_reader :message, :errno
# +message+ Description of the error
+1 -1
View File
@@ -570,7 +570,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
* --id: vm id, example: 156
* --seq: sequence number of the record, example: 0
The new value for this elemente is set in the third parameter.
The new value for this elemente is set in the third parameter.
Change the the hostname of first record:
+14 -10
View File
@@ -82,22 +82,27 @@ class OneDBLive
def select(table, where)
sql = "SELECT * FROM #{table} WHERE #{where}"
res = db_query(sql, "Error querying database")
element = OpenNebula::XMLElement.new(
OpenNebula::XMLElement.build_xml(res, '/SQL_COMMAND'))
hash = element.to_hash
row = hash['SQL_COMMAND']['RESULT']['ROW'] rescue nil
row = hash['SQL_COMMAND']['RESULT']['ROW'] rescue nil
if !row
raise "Empty SQL query result: "
end
[row].flatten.compact
end
def db_query(sql, error_msg)
rc = system_db.sql_query_command(sql)
if OpenNebula.is_error?(rc)
raise "#{error_msg}: #{rc.message}"
end
rc
end
@@ -370,13 +375,13 @@ class OneDBLive
def change_body(object, xpath, value, options = {})
table, object, federate = get_pool_config(object)
if !value && !options[:delete]
raise "A value or --delete should specified"
end
object.info_all
rc = object.info_all
raise rc.message if OpenNebula.is_error?(rc)
object.each do |o|
if options[:id]
next unless o.id.to_s.strip == options[:id].to_s
@@ -385,7 +390,6 @@ class OneDBLive
elsif options[:expr]
next unless check_expr(o, options[:expr])
end
# Get body from the database
begin
db_data = select(table, "oid = #{o.id}")
@@ -30,7 +30,7 @@ define(function(require) {
/*
TEMPLATES
*/
var TemplateTable = require('utils/panel/template-table');
/*