def to_packer
      # Create the new smash
      packer = Smash.new

      # Variables
      packer['variables'] = self['variables'].dup unless self['variables'].nil? || self['variables'].empty?

      # Builders
      packer['builders'] = [] unless self['builders'].nil? || self['builders'].empty?
      logger.info("Processing builders...")
      self['builders'].each do |name,config|
        logger.info("Processing builder: #{name} with type: #{config['type']}")

        # Get the builder for this config
        builder = get_builder(config['type'])

        # Have the builder convert the config to packer format
        packer['builders'] << builder.to_packer(name, config.dup)
      end

      # Provisioners
      packer['provisioners'] = [] unless self['provisioners'].nil? || self['provisioners'].empty?
      logger.info("Processing provisioners...")
      self['provisioners'].sort.map do |index, provisioners|
        provisioners.each do |name,config|
          logger.debug("Processing provisioner: #{name}")
         packer['provisioners'] << config.dup
        end
      end

      # Post-Processors
      packer['post-processors'] = [] unless self['postprocessors'].nil? || self['postprocessors'].empty?
      logger.info("Processing post-processors...")
      self['postprocessors'].each do |name,config|
        logger.debug("Processing post-processor: #{name}")
        packer['post-processors'] << config.dup unless config.nil?
      end

      packer
    end
def to_packer
      # Create the new smash
      packer = Smash.new

      # Variables
      packer['variables'] = self['variables'].dup unless self['variables'].nil? || self['variables'].empty?

      # Builders
      packer['builders'] = [] unless self['builders'].nil? || self['builders'].empty?
      logger.info("Processing builders...")
      self['builders'].each do |name,config|
        logger.info("Processing builder: #{name} with type: #{config['type']}")

        # Get the builder for this config
        builder = get_builder(config['type'])

        # Have the builder convert the config to packer format
        packer['builders'] << builder.to_packer(name, config.dup)
      end

      # Provisioners
      packer['provisioners'] = [] unless self['provisioners'].nil? || self['provisioners'].empty?
      logger.info("Processing provisioners...")
      self['provisioners'].sort.map do |index, provisioners|
        provisioners.each do |name,config|
          logger.debug("Processing provisioner: #{name}")
         packer['provisioners'] << config.dup
        end
      end

      # Post-Processors
      packer['post-processors'] = [] unless self['postprocessors'].nil? || self['postprocessors'].empty?
      logger.info("Processing post-processors...")
      self['postprocessors'].each do |name,config|
        logger.debug("Processing post-processor: #{name}")
        packer['post-processors'] << config.dup unless config.nil?
      end

      packer
    end
This formats the template into packer format hash