Bug 1221786

Summary: [RFE] Provide a way for users to set a usage_account_id in the database
Product: OpenShift Container Platform Reporter: Eric Rich <erich>
Component: NodeAssignee: Luke Meyer <lmeyer>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: unspecified Docs Contact:
Priority: high    
Version: 2.2.0CC: adellape, akostadi, bleanhar, cryan, jialiu, jokerman, libra-onpremise-devel, mmccomas, nicholas_schuetz, pruan, tiwillia, xiama
Target Milestone: ---Keywords: NeedsTestCase
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-broker-util-1.35.2.3-1 Doc Type: Enhancement
Doc Text:
When implementing a custom billing provider, the usage_account_id field must be set for tracked users. Previously, there was no tool to set the usage_account_id field, and the database had to be modified manually to set this field. With this enhancement, administrators can now use the oo-admin-ctl-user command with the --setusageaccountid option to set the usage_account_id field for users without direct modifications to the database.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-21 19:12:43 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 Eric Rich 2015-05-14 20:45:14 UTC
Description of problem:

In order to create a custom billing provider you need to manually modify the database because of https://github.com/openshift/origin-server/blob/master/broker-util/oo-admin-ctl-usage#L155-L175 checks for the account number. 

Version-Release number of selected component (if applicable): 2.2 

How reproducible: 100% 

Steps to Reproduce:
1. Follow https://mojo.redhat.com/docs/DOC-1012698

Suggested Action: 

Allow for oo-admin-ctl-user to set a usage_account_id

    # oo-admin-ctl-user -l admin --setplanquantity 1 --setplan free \
       --setusage_account_id 12345

Comment 2 Brenton Leanhardt 2015-05-15 18:26:07 UTC
Upstream PR: https://github.com/openshift/origin-server/pull/6141

Comment 3 openshift-github-bot 2015-05-16 00:07:01 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/d723c169a6eefb54546b9d27d804ea463f9a72fb
Bug 1221786 - Provide a way for users to set a usage_account_id

Comment 6 Ma xiaoqiang 2015-05-19 06:41:27 UTC
Check on puddle [2.2.6/2015-05-18.1]

1. list the user info
# oo-admin-ctl-user -l xiaom                     
User xiaom1:
                            plan: 
                usage account id: 
<--snip-->

2. set the usage account id 
# oo-admin-ctl-user -l xiaom --setusageaccountid 1234


Setting usage account id 1234 for user xiaom... Done.

User xiaom:
                            plan: 
                usage account id: 1234

3. check the value in the database
# mongo -u openshift -p mongopass openshift_broker   
MongoDB shell version: 2.4.6
connecting to: openshift_broker
> db.cloud_users.findOne()
<--snip-->
        "usage_account_id" : "1234"
}

Comment 9 errata-xmlrpc 2015-07-21 19:12:43 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://rhn.redhat.com/errata/RHBA-2015-1463.html