Bug 1328905

Summary: [RFE] Expose an 'Account' Active Record as a Service Model, with an association from MiqAeServiceVm
Product: Red Hat CloudForms Management Engine Reporter: Peter McGowan <pmcgowan>
Component: AutomateAssignee: Lucy Fu <lufu>
Status: CLOSED ERRATA QA Contact: Matouš Mojžíš <mmojzis>
Severity: high Docs Contact:
Priority: high    
Version: 5.5.0CC: cpelland, gmccullo, jhardy, mkanoor, mmojzis, obarenbo, psavage, simaishi, tfitzger
Target Milestone: GAKeywords: FutureFeature
Target Release: 5.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.6.0.5 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-29 15:51:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Peter McGowan 2016-04-20 14:22:54 UTC
Description of problem:

We would like to be able to access the list of users and groups returned from SmartState Analysis, from an Automate Method. This seems to be in the 'accounts' table, but there is no corresponding service model.

It would be extremely useful to be able to access this list of users and groups via an association from the VM service model object.

Comment 3 Greg McCullough 2016-04-22 18:37:45 UTC
Lucy - Please create the Account service model for automate and expose the accounts, users and groups relationships for the vm_or_template model.

They are exposed on the active_record model here:
https://github.com/ManageIQ/manageiq/blob/96d0d63389b57a530a31da7a69e0bc8877ac3b4d/app/models/vm_or_template.rb#L77

Comment 5 CFME Bot 2016-04-26 23:15:40 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/2a7d26df597d79bf25cc192af7949ac672c77df5

commit 2a7d26df597d79bf25cc192af7949ac672c77df5
Author:     Lucy Fu <lufu>
AuthorDate: Tue Apr 26 15:57:50 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Tue Apr 26 15:59:22 2016 -0400

    Expose Account to automate.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1328905

 lib/miq_automation_engine/service_models/miq_ae_service_account.rb | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_account.rb

Comment 6 CFME Bot 2016-04-26 23:15:45 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/3e8dfa998d5d886d32fda6b53d0722edafcd1677

commit 3e8dfa998d5d886d32fda6b53d0722edafcd1677
Author:     Lucy Fu <lufu>
AuthorDate: Tue Apr 26 15:58:36 2016 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Tue Apr 26 15:59:22 2016 -0400

    Expose the accounts, users and groups relationships for the vm_or_template model to automate.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1328905

 .../service_models/miq_ae_service_vm_or_template.rb                   | 4 ++++
 1 file changed, 4 insertions(+)

Comment 7 Matouš Mojžíš 2016-05-11 15:49:18 UTC
Verified in: 5.6.0.5-beta2.4.20160503153816_1fb554f 
I was able to list vm.accounts, vm.users and vm.groups from rails console.

Comment 10 errata-xmlrpc 2016-06-29 15:51:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1348