Commit a59c4d05 authored by Florent Didier's avatar Florent Didier

[dev] oar-properties: fix the creation of disk properties

Before this commit, new disk properties were not created.
Now the following command is generated: oarproperty -a disk_tech --varchar
parent 51943e5d
......@@ -351,8 +351,8 @@ def diff_properties(type, properties_oar, properties_ref)
end
# These keys will not be created neither compared with the -d option
# ignore_keys is only applied to resources of type 'default'
def ignore_keys()
# ignore_default_keys is only applied to resources of type 'default'
def ignore_default_keys()
# default OAR at resource creation:
# available_upto: '2147483647'
# besteffort: 'YES'
......@@ -376,7 +376,7 @@ def ignore_keys()
# state_num: 3
# suspended_jobs: 'NO'
# type: default
ignore_keys = [
ignore_default_keys = [
"chassis",
"slash_16",
"slash_17",
......@@ -418,11 +418,23 @@ def ignore_keys()
"pdu",
"id", # id from API (= resource_id from oarnodes)
"api_timestamp", # from API
"links", # from API
"links" # from API
]
return ignore_default_keys
end
# Properties of resources of type 'disk' to ignore (for example, when
# comparing resources of type 'default' with the -d option)
def ignore_disk_keys()
ignore_disk_keys = [
"disk",
"diskpath"
]
return ignore_keys
return ignore_disk_keys
end
def ignore_keys()
return ignore_default_keys() + ignore_disk_keys()
end
def oarcmd_script_header()
......
......@@ -217,7 +217,7 @@ properties['ref'] = get_oar_properties_from_the_ref_repo(global_hash, options)
# Get the list of property keys from the reference-repo (['ref'])
properties_keys = {}
properties_keys['ref'] = get_property_keys(properties['ref'])
ignore_keys = ignore_keys()
ignore_default_keys = ignore_default_keys()
# Diff
if options[:diff]
......@@ -321,11 +321,11 @@ Those nodes should be marked as 'retired' in the reference-repo.\n"
end
end
puts "Properties that need to be created on the server: #{properties_keys['diff'].keys.to_a.delete_if { |e| ignore_keys.include?(e) }.join(', ')}" if options[:verbose] && properties_keys['diff'].keys.to_a.delete_if { |e| ignore_keys.include?(e) }.size > 0
puts "Properties that need to be created on the server: #{properties_keys['diff'].keys.to_a.delete_if { |e| ignore_default_keys.include?(e) }.join(', ')}" if options[:verbose] && properties_keys['diff'].keys.to_a.delete_if { |e| ignore_default_keys.include?(e) }.size > 0
# Detect unknown properties
unknown_properties = properties_keys['oar'].keys.to_set - properties_keys['ref'].keys.to_set
ignore_keys.each do |key|
ignore_default_keys.each do |key|
unknown_properties.delete(key)
end
......@@ -351,7 +351,7 @@ if options[:output] || options[:exec]
cmd << oarcmd_separator
# Create properties keys
properties_keys[opt].delete_if { |k, _v| ignore_keys.include?(k) }
properties_keys[opt].delete_if { |k, _v| ignore_default_keys.include?(k) }
unless properties_keys[opt].empty?
cmd << oarcmd_create_properties(properties_keys[opt]) + "\n"
cmd << oarcmd_separator
......
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