Project

General

Profile

Actions

Bug #25071

closed

Mysql2::Error: Data too long for column 'action'

Added by Björn Zettergren over 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
foreman_chef
Target version:
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

When trying to import facts with patches from foreman_chef 0.9.0 i get the following, when foreman tries to import the NIC facts

(linebreaks inserted for readability)


| ActiveRecord::ValueTooLong: Mysql2::Error: Data too long for column 'action' at row 1: UPDATE `foreman_tasks_tasks` 
SET `state` = 'planning', `result` = 'pending', `started_at` = '2018-09-30 14:57:42', `label` = 
'Actions::ForemanChef::Host::Update', `action` = 'Update host undefined method `[]\' for nil:NilClass 
(NoMethodError)\n/usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_chef-0.8.1/app/lib/actions/foreman_chef/host/update.rb:29:in `humanized_input\'
\n/usr/share/foreman/vendor/ruby/2.3.0/gems/foreman-tasks-0.13.2/app/models/foreman_tasks/task/dynflow_task.rb:157:in `get_humanized\'

This is due to that the variable "input" is empty when /usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_chef-0.8.1/app/lib/actions/foreman_chef/host/update.rb gets called with the network card. (some other facts before the nic works fine)

after modifying line 29 in the file to look like this:

          input[:host][:name] unless input.empty?

The imports work, but the correct approach would of course be to fix why input is empty to begin with, can't figure that out myself unfortunately.

To test, use the attached "full-chef.json" facts (after editing the name-property and upload with curl:


curl -u admin:password -v -d @/etc/foreman/full-chef.json -H "Content-Type: application/json" http://localhost:3000/api/hosts/facts


Files

full-chef.json full-chef.json 53 KB Björn Zettergren, 09/30/2018 03:21 PM
Actions #1

Updated by Marek Hulán over 5 years ago

  • Category set to foreman_chef
  • Assignee set to Marek Hulán
  • Target version set to foreman_chef 0.9.0
  • Fixed in Releases foreman_chef 0.9.0 added

Actually the fix was correct, this happen in early phase when the wrapping task is asked for human name but yet was not planned, hence does not have input available. I addressed it slightly differently. On other DBs, it's not such an issue but on MySQL it fails hardly on action name length. That's why it was not spotted for a long time.

Actions #2

Updated by Marek Hulán about 5 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF