{"record":{"id":"10bcd09ca30f098c","repo":"theforeman/foreman","slug":"the-user-data-template-must-be-a-hash-in-yaml-form","errorCode":null,"errorMessage":"The user-data template must be a hash in YAML format for VM customization to work.","messagePattern":"The user-data template must be a hash in YAML format for VM customization to work\\.","errorType":"validation","errorClass":"Foreman::Exception","httpStatus":null,"severity":"error","filePath":"app/models/compute_resources/foreman/model/vmware.rb","lineNumber":849,"sourceCode":"      vm_attrs\n    end\n\n    def build_vmrc_uri(host, vmid, ticket)\n      uri = URI::Generic.build(:scheme => 'vmrc',\n        :userinfo => \"clone:#{ticket}\",\n        :host     => host,\n        :port     => 443,\n        :path     => '/',\n        :query    => \"moid=#{vmid}\").to_s\n      # VMRC doesn't like brackets around IPv6 addresses\n      uri.sub(/(.*)\\[/, '\\1').sub(/(.*)\\]/, '\\1')\n    end\n\n    def valid_cloudinit_for_customspec?(cloudinit)\n      parsed = YAML.safe_load(cloudinit)\n      return false if parsed.nil?\n      return true if parsed.is_a?(Hash)\n      raise Foreman::Exception.new('The user-data template must be a hash in YAML format for VM customization to work.')\n    rescue Psych::SyntaxError => e\n      Foreman::Logging.exception('Failed to parse user-data template', e)\n      raise Foreman::Exception.new('The user-data template must be valid YAML for VM customization to work.')\n    end\n\n    def cachekey_with_cluster(key, cluster_id = nil)\n      cluster_id.nil? ? key.to_sym : \"#{key}-#{cluster_id}\".to_sym\n    end\n\n    # Generates Secure Boot settings for VMware, based on the provided firmware type.\n    #\n    # @param firmware [String] The firmware type.\n    # @return [Hash] A hash with secure boot settings if applicable.\n    def generate_secure_boot_settings(firmware)\n      firmware == 'uefi_secure_boot' ? { secure_boot: true } : {}\n    end\n\n    # Validates TPM compatibility based on the firmware type and virtual TPM setting.","sourceCodeStart":831,"sourceCodeEnd":867,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/models/compute_resources/foreman/model/vmware.rb#L831-L867","documentation":"Error \"The user-data template must be a hash in YAML format for VM customization to work.\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/models/compute_resources/foreman/model/vmware.rb:849 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}