# File lib/simp/cli/config/items/set_server_hieradata_action_item.rb, line 20 def apply "#{@hiera_to_add} not set!" if @hiera_to_add.nil? @applied_status = :failed fqdn = get_item( 'cli::network::hostname' ).value @file = File.join( @dir, "#{fqdn}.yaml") if File.exists?(@file) @hiera_to_add.each do |key| verify_item_present(key) yaml_hash = YAML.load(IO.read(@file)) if yaml_hash.key?(key) replace_line(key) else add_yaml_entry(key) end @applied_status = :succeeded end else error( "\nERROR: file not found: #{@file}", [:RED] ) end end