Commit 15325999 authored by Jérémie Gaidamour's avatar Jérémie Gaidamour
Browse files

[dev] Improved error messages in oar-properties.rb

parent 0dd2e2cc
......@@ -139,9 +139,7 @@ def get_nodelist_properties(site_uid, site)
return properties
end
def diff_node_properties(node_properties_oar, node_properties_ref)
node_properties_oar ||= {}
node_properties_ref ||= {}
def ignore_keys()
# default OAR at resource creation:
# available_upto: '2147483647'
......@@ -210,6 +208,12 @@ def diff_node_properties(node_properties_oar, node_properties_ref)
"wattmeter" # TODO
]
end
def diff_node_properties(node_properties_oar, node_properties_ref)
node_properties_oar ||= {}
node_properties_ref ||= {}
ignore_keys.each { |key| node_properties_oar.delete(key) }
ignore_keys.each { |key| node_properties_ref.delete(key) }
......@@ -344,7 +348,7 @@ def oarcmd_create_properties(properties_keys)
elsif type == String
command += "oarproperty -a #{key} --varchar || true\n"
else
raise "Error: the type of the '#{key}' property is unknown (Integer/String). Cannot generate the corresponding 'oarproperty' command."
raise "Error: the type of the '#{key}' property is unknown (Integer/String). Cannot generate the corresponding 'oarproperty' command. You must create this property manually ('oarproperty -a #{key} [--varchar]')"
end
}
return command
......
......@@ -273,8 +273,12 @@ if options[:diff]
puts "Properties that need to be created on the server: #{properties_keys["diff"].keys.to_a.join(', ')}" if options[:verbose] && properties_keys["diff"].keys.size>0
# Detect unknown properties
# unknown_properties = properties_keys["oar"].keys.to_set - properties_keys["ref"].keys.to_set
# puts "Properties existing on the server but not managed by the generator: #{unknown_properties.to_a.join(', ')}" if options[:verbose] && unknown_properties.size>0
unknown_properties = properties_keys["oar"].keys.to_set - properties_keys["ref"].keys.to_set
ignore_keys.each { |key| unknown_properties.delete(key) }
if options[:verbose] && unknown_properties.size>0
puts "Properties existing on the server but not managed/known by the generator: #{unknown_properties.to_a.join(', ')}."
puts "Hint: you can delete properties with 'oarproperty -d <property>' or add them to the ignore list in lib/lib-oar-properties.rb."
end
end # if options[:diff]
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment