lib/percheron/unit.rb in percheron-0.8.0 vs lib/percheron/unit.rb in percheron-0.8.1
- old
+ new
@@ -6,19 +6,23 @@
extend Forwardable
extend ConfigDelegator
include Unit::ImageHelper
def_delegators :unit_config, :name, :pseudo_name, :docker_image
- def_config_item_with_default :unit_config, [], :env, :ports, :volumes, :needed_unit_names,
- :pre_build_scripts, :post_start_scripts, :start_args, :dns
+ def_config_item_with_default :unit_config, [], :env, :ports, :volumes, :pre_build_scripts,
+ :post_start_scripts, :start_args, :dns
def_config_item_with_default :unit_config, true, :startable
def initialize(config, stack, unit_name)
@config = config
@stack = stack
@unit_name = unit_name
@unit_config = stack.unit_configs[unit_name] || Hashie::Mash.new({}) # FIXME
self
+ end
+
+ def needed_unit_names
+ unit_config.fetch('needed_unit_names', unit_config.fetch('dependant_unit_names', []))
end
def needed_units
needed_unit_names.each_with_object({}) do |unit_name, all|
all[unit_name] = stack.units[unit_name]