1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

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

This commit is contained in:
Diego del Corral 2017-11-17 21:20:54 +01:00 committed by Ruben S. Montero
parent 9b7919eb5a
commit 253738d6e8
4 changed files with 17 additions and 13 deletions

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

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:

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
@ -390,13 +395,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
@ -405,7 +410,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}")

View File

@ -30,7 +30,7 @@ define(function(require) {
/*
TEMPLATES
*/
var TemplateTable = require('utils/panel/template-table');
/*