Skip to content

Commit

Permalink
Allow user to specify OAuth 2.0 token to use
Browse files Browse the repository at this point in the history
  • Loading branch information
twaugh committed Apr 1, 2016
1 parent dd0c5c4 commit 7a173f7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions osbs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def __init__(self, openshift_configuration, build_configuration):
kerberos_ccache=self.os_conf.get_kerberos_ccache(),
use_auth=self.os_conf.get_use_auth(),
verify_ssl=self.os_conf.get_verify_ssl(),
token=self.os_conf.get_oauth2_token(),
namespace=self.os_conf.get_namespace())
self._bm = None

Expand Down
2 changes: 2 additions & 0 deletions osbs/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ def cli():
metavar="NAMESPACE", action="store", default=DEFAULT_NAMESPACE)
parser.add_argument("--capture-dir", metavar="DIR", action="store",
help="capture JSON responses and save them in DIR")
parser.add_argument("--oauth2-token", metavar="TOKEN", action="store",
help="OAuth 2.0 token")
args = parser.parse_args()
return parser, args

Expand Down
3 changes: 3 additions & 0 deletions osbs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,6 @@ def get_git_push_username(self):

def get_build_image(self):
return self._get_value("build_image", self.conf_section, "build_image")

def get_oauth2_token(self):
return self._get_value("oauth2_token", self.conf_section, "oauth2_token")
3 changes: 2 additions & 1 deletion osbs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(self, openshift_api_url, openshift_api_version, openshift_oauth_url
verbose=False, username=None, password=None, use_kerberos=False,
kerberos_keytab=None, kerberos_principal=None, kerberos_ccache=None,
client_cert=None, client_key=None, verify_ssl=True, use_auth=None,
token=None,
namespace=DEFAULT_NAMESPACE):
self.os_api_url = openshift_api_url
self.k8s_api_url = k8s_api_url
Expand All @@ -76,7 +77,7 @@ def __init__(self, openshift_api_url, openshift_api_version, openshift_oauth_url
self.kerberos_keytab = kerberos_keytab
self.kerberos_principal = kerberos_principal
self.kerberos_ccache = kerberos_ccache
self.token = None
self.token = token
self.ca = None
auth_credentials_provided = bool(use_kerberos or
(username and password))
Expand Down

0 comments on commit 7a173f7

Please sign in to comment.