[Solved] Can't create a tag with more than 30 characters


How to reproduce:

tag='1234567890123456789012345678901' #-> 31 characters
category = 'owner'
$evm.execute('tag_create', category, :name => tag, :description => "#{tag}")

The problem is on tag name (not with description).
On database, the tag value is “text” (large enough).

 psql -d vmdb_production -U postgres -c "\d tags"
                         Table "public.tags"
 Column |  Type  |                     Modifiers                     
 id     | bigint | not null default nextval('tags_id_seq'::regclass)
 name   | text   | 
    "tags_pkey" PRIMARY KEY, btree (id)



Do you want to create a tag having length of more than 30 characters? Why ? Its true that the variable length for ‘text’ data type in postgres is unlimited, ManageIQ actually enforces this limitation using its validation logic.

validates_presence_of :name, :description
validates_length_of :name, :maximum => 30, :message => "must not exceed 30 characters"
validates_length_of :description, :maximum => 255, :message => "must not exceed 255 characters"
validates_inclusion_of :syntax,

See full code here : https://raw.githubusercontent.com/ManageIQ/manageiq/22666335d1947ea1c859942d489fa05f94e1955d/app/models/classification.rb


Yes, I need to create larger tags.
I’m using tag names based on Cloud Provider and OpenStack Tenant Names to preform properly the reports.
With you info I can workaround my problem, but I think it’s a good feature to add.



Here is the pull request to change the maximum allowed length of tag to 50 characters https://github.com/ManageIQ/manageiq/pull/4747