summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorThomas Wiest <twiest@users.noreply.github.com>2015-03-13 11:34:09 -0400
committerThomas Wiest <twiest@users.noreply.github.com>2015-03-13 11:34:09 -0400
commita65e9404c6421dc1eee165f5efd066792ec0e471 (patch)
treeae7252b0fc7be1dabffb826b9e7f4df56f7c2687 /roles
parenta14cfe60471b053175d0bc225caa4fe1353b4873 (diff)
parentda9b9dbd77f753b4a680f5ffe7c83649e2602eee (diff)
downloadopenshift-a65e9404c6421dc1eee165f5efd066792ec0e471.tar.gz
openshift-a65e9404c6421dc1eee165f5efd066792ec0e471.tar.bz2
openshift-a65e9404c6421dc1eee165f5efd066792ec0e471.tar.xz
openshift-a65e9404c6421dc1eee165f5efd066792ec0e471.zip
Merge pull request #113 from detiber/kubeFormat
Update openshift_register_node module for changes in .kubeconfig format ...
Diffstat (limited to 'roles')
-rw-r--r--roles/openshift_node/library/openshift_register_node.py16
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(