You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, currently I am using sparkleformation heavily with a custom CLI to support a particular workflow with Azure. I'm making heavy use of compile-time parameters and generally things are great. One restriction I am bumping into is the limited type support for compile-time parms, e.g. just number or strings. I'd like to have arrays and hashes available. Here's an example that I hope illustrates my use case:
module MyStuff
module Params
DATA_DISK = {}
(0..4).each do |idx|
DATA_DISK["data_disk#{idx}_lun".to_sym] = { type: :number, description: "LUN to use for this disk.", default: nil }
DATA_DISK["data_disk#{idx}_size".to_sym] = { type: :string, description: "Disk size in GB.", default: nil }
DATA_DISK["data_disk#{idx}_caching_type".to_sym] = { type: :string, description: "Cache type for this disk", allowed_values: %w(None ReadOnly ReadWrite), default: "None" }
DATA_DISK["data_disk#{idx}_create_option".to_sym] = { type: :string, description: "How to create this disk", allowed_values: %w(fromImage empty attach), default: "empty" }
DATA_DISK["data_disk#{idx}_account_type".to_sym] = { type: :string, description: "Storage account type for this disk.", allowed_values: %w(Standard_LRS Premium_LRS), default: "Standard_LRS" }
end
DATA_DISK.freeze
end
end
Template:
SparkleFormation.new(:generic_host, :provider => :azure, :compile_time_parameters => ::MyStuff::Params::DATA_DISK.merge(... other params)).load(:base) do
data_disks = (0..4).collect {|idx|
disk_cfg = %w(lun size caching_type create_option account_type).collect{ |key|
[key.to_sym, state!("data_disk#{idx}_#{key}".to_sym)]
}.to_h
# Get rid of empty disks in this array
if disk_cfg[:size].nil?
nil
else
disk_cfg
end
}.compact
dynamic!(:my_node, :node1, {data_disks: data_disks, ... other params})
end
I'm not sure the best way to capture the DATA_DISK definition in this context, but perhaps inspiration can be drawn from strong_params? That might be overkill, anyway, just a thought.
The text was updated successfully, but these errors were encountered:
Hi, currently I am using sparkleformation heavily with a custom CLI to support a particular workflow with Azure. I'm making heavy use of compile-time parameters and generally things are great. One restriction I am bumping into is the limited type support for compile-time parms, e.g. just number or strings. I'd like to have arrays and hashes available. Here's an example that I hope illustrates my use case:
YAML params:
Compile-param definition:
Template:
What I would like to do is something more like:
Yaml:
Compile param definition:
I'm not sure the best way to capture the
DATA_DISK
definition in this context, but perhaps inspiration can be drawn fromstrong_params
? That might be overkill, anyway, just a thought.The text was updated successfully, but these errors were encountered: