Bug 1573714

Summary: [REF] the apb tool should support the token auth
Product: OpenShift Container Platform Reporter: Jian Zhang <jiazha>
Component: Service BrokerAssignee: David Zager <dzager>
Status: CLOSED CURRENTRELEASE QA Contact: Jian Zhang <jiazha>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.10.0CC: aos-bugs
Target Milestone: ---   
Target Release: 3.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-20 21:12:35 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 Jian Zhang 2018-05-02 06:15:16 UTC
Description of problem:
We need to add authentication token to apb as a parameter. It works
with any auth configuration unlike basic auth. 
The upstream discussion is here: https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/pull/258

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

How reproducible:
always

Steps to Reproduce:
1. Install the apb tool and run `apb --help`

Actual results:
No token auth option.
[jzhang@localhost ~]$ apb --help
usage: apb [-h] [--debug] [--project BASE_PATH]
           {relist,run,help,test,prepare,setup,bootstrap,list,remove,init,version,build,push,serviceinstance}
           ...

APB tooling for assisting in building and packaging APBs.

optional arguments:
  -h, --help            show this help message and exit
  --debug               Enable debug output
  --project BASE_PATH, -p BASE_PATH
                        Specify a path to your project. Defaults to CWD.


Expected results:
Should add the token auth option.

Additional info:

Comment 3 Jian Zhang 2018-05-08 07:37:45 UTC
Verify failed, as below:
[root@localhost config]# oc whoami -t
y3RNSUB4vQv9ANeAokn8BVDi5BRZikoJ99-z7sWmlxI
[root@localhost config]# apb --token y3RNSUB4vQv9ANeAokn8BVDi5BRZikoJ99-z7sWmlxI list
Contacting the ansible-service-broker at: https://asb-1338-openshift-ansible-service-broker.apps.0507-azb.qe.rhcloud.com/ansible-service-broker/v2/catalog
Error: Attempt to list APBs in the broker returned status: 403
Unable to list APBs in Ansible Service Broker.

I submit a PR(https://github.com/ansibleplaybookbundle/ansible-playbook-bundle/pull/284) for fixing this, looking for your comments.

Comment 5 Jian Zhang 2018-05-15 09:37:39 UTC
verify success.

ASB version: 1.2.11
The apb tool version: 1.2.8
[root@dhcp-140-58 jzhang]# apb version
Version: apb-1.2.8


[root@dhcp-140-58 jzhang]# apb --token _7pOUPQ-Uy-CyzaQBPayoyLF7oPx_BqouqJ_5LXZtBI list
Contacting the ansible-service-broker at: https://asb-1338-openshift-ansible-service-broker.apps.0514-2b2.qe.rhcloud.com/ansible-service-broker/v2/catalog
ID                                NAME               DESCRIPTION                        
67042296c7c95e84142f21f58da2ebfe  dh-mariadb-apb     Mariadb apb implementation         
f6c4486b7fb0cdac4b58e193607f7011  dh-mediawiki-apb   Mediawiki apb implementation       
ddd528762894b277001df310a126d5ad  dh-mysql-apb       Software Collections MySQL APB     
1dda1477cace09730bd8ed7a6505607e  dh-postgresql-apb  SCL PostgreSQL apb implementation