Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1693722 - Warn when custom attributes contain spaces in their names - they will not work properly in all of reporting
Summary: Warn when custom attributes contain spaces in their names - they will not wor...
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Reporting
Version: unspecified
Hardware: All
OS: All
high
medium
Target Milestone: GA
: 5.10.3
Assignee: Joe Rafaniello
QA Contact: Parthvi Vala
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On: 1662319
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-28 14:25 UTC by Satoe Imaishi
Modified: 2019-04-09 20:39 UTC (History)
13 users (show)

Fixed In Version: 5.10.3.0
Doc Type: Enhancement
Doc Text:
Clone Of: 1662319
Environment:
Last Closed:
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:


Attachments (Terms of Use)

Comment 2 CFME Bot 2019-03-29 17:31:22 UTC
New commit detected on ManageIQ/manageiq/hammer:

https://github.com/ManageIQ/manageiq/commit/14e100cf68085524e229ccdf34fe8acdfa82d85d
commit 14e100cf68085524e229ccdf34fe8acdfa82d85d
Author:     Adam Grare <agrare@redhat.com>
AuthorDate: Tue Mar 19 06:42:19 2019 -0400
Commit:     Adam Grare <agrare@redhat.com>
CommitDate: Tue Mar 19 06:42:19 2019 -0400

    Merge pull request #18538 from jrafanie/deprecate_invalid_column_names_in_custom_attributes

    Deprecate invalid custom attribute names

    (cherry picked from commit a26aa9ddbbb52e9b2027c199cd7782fc8a68c8cb)

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1693722

 app/models/mixins/custom_attribute_mixin.rb | 9 +
 spec/models/mixins/custom_attribute_mixin_spec.rb | 34 +
 2 files changed, 43 insertions(+)

Comment 3 Parthvi Vala 2019-04-08 10:30:52 UTC
Hey Joe,

From what I make of the comments on PR(https://github.com/ManageIQ/manageiq/pull/18538), the problem has not been completely fixed, but a warning is logged somewhere when a custom attribute is created with an invalid name.
I was able to reproduce this BZ, I tested it by creating CA via both REST API and rails console, but I could not see warning anywhere in any of the logs. Can you tell me which log am I supposed to check?

Thanks,
Parthvi

Comment 4 Joe Rafaniello 2019-04-08 14:03:20 UTC
Parthvi, how are you creating the custom attributes?  The methods that are currently raising a deprecation are the common ones used to do this via the custom attribute mixin.  If you bypass the mixin and create the custom attribute directly, it will not log a deprecation warning.

Comment 5 Parthvi Vala 2019-04-08 14:15:18 UTC
I created them via REST API and rails console.
1) via REST API
POST /api/vms/:id/custom_attributes
Query: {
           "action" : "add",
           "resources" : [
               { "name" : "CA with space API", "value" : "value not displayed API" },
               { "name" : "CAwithoutspaceAPI", "value" : "value displayed API" }
           ]
       }
2) via Rails Console:
$evm = MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new)
vm  = $evm.vmdb('vm').find_by_name(:vm_name)
vm.custom_set(key, value)

I am not sure if any of these used custom attribute mixin. If they did not, can you tell me how to create the custom attribute via mixin?

Comment 6 Parthvi Vala 2019-04-08 16:47:44 UTC
Forgot to do it in the last comment #5, so adding a needinfo here.

Comment 7 Joe Rafaniello 2019-04-08 17:50:45 UTC
!) this will not raise a deprecation yet
2) this will raise a deprecation

config.active_support.deprecation in vmdb/config/environments/production.rb is set to :notify by default.  Change it to :log to see the deprecations in the rails log, matching the environment, probably production.log.

When people develop their automate code in development mode, this is the default and it will be seen without changing anything.

Comment 8 Parthvi Vala 2019-04-09 05:43:17 UTC
FIXED. Verified the fix for BZ on 5.10.3. The production log logs warning when invalid CA name is set.


Note You need to log in before you can comment on or make changes to this bug.