theforeman/foreman · error · Foreman::Exception

The user-data template must be a hash in YAML format for VM

Error message

The user-data template must be a hash in YAML format for VM customization to work.

What it means

Error "The user-data template must be a hash in YAML format for VM customization to work." thrown in theforeman/foreman.

Source

Thrown at app/models/compute_resources/foreman/model/vmware.rb:849

      vm_attrs
    end

    def build_vmrc_uri(host, vmid, ticket)
      uri = URI::Generic.build(:scheme => 'vmrc',
        :userinfo => "clone:#{ticket}",
        :host     => host,
        :port     => 443,
        :path     => '/',
        :query    => "moid=#{vmid}").to_s
      # VMRC doesn't like brackets around IPv6 addresses
      uri.sub(/(.*)\[/, '\1').sub(/(.*)\]/, '\1')
    end

    def valid_cloudinit_for_customspec?(cloudinit)
      parsed = YAML.safe_load(cloudinit)
      return false if parsed.nil?
      return true if parsed.is_a?(Hash)
      raise Foreman::Exception.new('The user-data template must be a hash in YAML format for VM customization to work.')
    rescue Psych::SyntaxError => e
      Foreman::Logging.exception('Failed to parse user-data template', e)
      raise Foreman::Exception.new('The user-data template must be valid YAML for VM customization to work.')
    end

    def cachekey_with_cluster(key, cluster_id = nil)
      cluster_id.nil? ? key.to_sym : "#{key}-#{cluster_id}".to_sym
    end

    # Generates Secure Boot settings for VMware, based on the provided firmware type.
    #
    # @param firmware [String] The firmware type.
    # @return [Hash] A hash with secure boot settings if applicable.
    def generate_secure_boot_settings(firmware)
      firmware == 'uefi_secure_boot' ? { secure_boot: true } : {}
    end

    # Validates TPM compatibility based on the firmware type and virtual TPM setting.

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at app/models/compute_resources/foreman/model/vmware.rb:849 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theforeman/foreman@6b05625475 (2026-08-23). Data as JSON: /api/errors/10bcd09ca30f098c. Report an issue: GitHub.