diff options
author | Jason DeTiberus <jdetiber@redhat.com> | 2015-03-13 03:00:42 -0400 |
---|---|---|
committer | Jason DeTiberus <jdetiber@redhat.com> | 2015-03-13 04:26:07 -0400 |
commit | da9b9dbd77f753b4a680f5ffe7c83649e2602eee (patch) | |
tree | ae7252b0fc7be1dabffb826b9e7f4df56f7c2687 | |
parent | a14cfe60471b053175d0bc225caa4fe1353b4873 (diff) | |
download | openshift-da9b9dbd77f753b4a680f5ffe7c83649e2602eee.tar.gz openshift-da9b9dbd77f753b4a680f5ffe7c83649e2602eee.tar.bz2 openshift-da9b9dbd77f753b4a680f5ffe7c83649e2602eee.tar.xz openshift-da9b9dbd77f753b4a680f5ffe7c83649e2602eee.zip |
Update openshift_register_node module for changes in .kubeconfig format following latest kubernetes rebase
-rw-r--r-- | roles/openshift_node/library/openshift_register_node.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/roles/openshift_node/library/openshift_register_node.py b/roles/openshift_node/library/openshift_register_node.py index 4b306db9f..63079e59b 100644 --- a/roles/openshift_node/library/openshift_register_node.py +++ b/roles/openshift_node/library/openshift_register_node.py @@ -108,7 +108,9 @@ def main(): client_context = module.params['client_context'] if client_context: - if client_context not in config['contexts']: + config_context = next((context for context in config['contexts'] + if context['name'] == client_context), None) + if not config_context: module.fail_json(msg="Context %s not found in client config" % client_context) if not config['current-context'] or config['current-context'] != client_context: @@ -116,18 +118,22 @@ def main(): client_user = module.params['client_user'] if client_user: - if client_user not in config['users']: + config_user = next((user for user in config['users'] + if user['name'] == client_user), None) + if not config_user: module.fail_json(msg="User %s not found in client config" % client_user) - if client_user != config['contexts'][client_context]['user']: + if client_user != config_context['context']['user']: client_opts.append("--user=%s" % client_user) client_cluster = module.params['client_cluster'] if client_cluster: - if client_cluster not in config['clusters']: + config_cluster = next((cluster for cluster in config['clusters'] + if cluster['name'] == client_cluster), None) + if not client_cluster: module.fail_json(msg="Cluster %s not found in client config" % client_cluster) - if client_cluster != config['contexts'][client_context]['cluster']: + if client_cluster != config_context['context']['cluster']: client_opts.append("--cluster=%s" % client_cluster) node_def = dict( |