diff options
| author | Kenny Woodson <kwoodson@redhat.com> | 2015-10-29 11:14:51 -0400 | 
|---|---|---|
| committer | Kenny Woodson <kwoodson@redhat.com> | 2015-10-29 11:14:51 -0400 | 
| commit | 9bbaa824da5e1a049cdec1a6523c3841d713386c (patch) | |
| tree | 93e80f1577ad0f2f5f8931b493c50cd9aa657c77 /bin/ossh_bash_completion | |
| parent | 15df494fb781dd1509854eeb366e981930b52c22 (diff) | |
| parent | 16d1bce0be2f8c3942489630adcb7030aecadc55 (diff) | |
| download | openshift-9bbaa824da5e1a049cdec1a6523c3841d713386c.tar.gz openshift-9bbaa824da5e1a049cdec1a6523c3841d713386c.tar.bz2 openshift-9bbaa824da5e1a049cdec1a6523c3841d713386c.tar.xz openshift-9bbaa824da5e1a049cdec1a6523c3841d713386c.zip | |
Merge pull request #763 from openshift/master
Merge master into prod.
Diffstat (limited to 'bin/ossh_bash_completion')
| -rwxr-xr-x | bin/ossh_bash_completion | 21 | 
1 files changed, 17 insertions, 4 deletions
| diff --git a/bin/ossh_bash_completion b/bin/ossh_bash_completion index 1467de858..5072161f0 100755 --- a/bin/ossh_bash_completion +++ b/bin/ossh_bash_completion @@ -1,6 +1,12 @@  __ossh_known_hosts(){ -    if [[ -f ~/.ansible/tmp/multi_ec2_inventory.cache ]]; then -        /usr/bin/python -c 'import json,os; z = json.loads(open("%s"%os.path.expanduser("~/.ansible/tmp/multi_ec2_inventory.cache")).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])' +    if python -c 'import openshift_ansible' &>/dev/null; then +      /usr/bin/python -c 'from openshift_ansible import multi_ec2; m=multi_ec2.MultiEc2(); m.run(); z=m.result; print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])' + +    elif [[ -f /dev/shm/.ansible/tmp/multi_ec2_inventory.cache ]]; then +      /usr/bin/python -c 'import json; loc="/dev/shm/.ansible/tmp/multi_ec2_inventory.cache"; z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])' + +    elif [[ -f ~/.ansible/tmp/multi_ec2_inventory.cache ]]; then +      /usr/bin/python -c 'import json,os; loc="%s" % os.path.expanduser("~/.ansible/tmp/multi_ec2_inventory.cache"); z=json.loads(open(loc).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])'      fi  } @@ -19,8 +25,15 @@ _ossh()  complete -F _ossh ossh oscp  __opssh_known_hosts(){ -    if [[ -f ~/.ansible/tmp/multi_ec2_inventory.cache ]]; then -                /usr/bin/python -c 'import json,os; z = json.loads(open("%s"%os.path.expanduser("~/.ansible/tmp/multi_ec2_inventory.cache")).read()); print "\n".join(["%s" % (host["ec2_tag_host-type"]) for dns, host in z["_meta"]["hostvars"].items() if "ec2_tag_host-type" in host])' +    if python -c 'import openshift_ansible' &>/dev/null; then +      /usr/bin/python -c 'from openshift_ansible.multi_ec2 import MultiEc2; m=MultiEc2(); m.run(); print "\n".join(["%s" % (host["ec2_tag_host-type"]) for dns, host in m.result["_meta"]["hostvars"].items() if "ec2_tag_host-type" in host])' + +    elif [[ -f /dev/shm/.ansible/tmp/multi_ec2_inventory.cache ]]; then +      /usr/bin/python -c 'import json; loc="/dev/shm/.ansible/tmp/multi_ec2_inventory.cache"; z=json.loads(open(loc).read()); print "\n".join(["%s" % (host["ec2_tag_host-type"]) for dns, host in z["_meta"]["hostvars"].items() if "ec2_tag_host-type" in host])' + +    elif [[ -f ~/.ansible/tmp/multi_ec2_inventory.cache ]]; then +      /usr/bin/python -c 'import json,os; loc="%s" % os.path.expanduser("/dev/shm/.ansible/tmp/multi_ec2_inventory.cache"); z=json.loads(open(loc).read()); print "\n".join(["%s" % (host["ec2_tag_host-type"]) for dns, host in z["_meta"]["hostvars"].items() if "ec2_tag_host-type" in host])' +      fi  } | 
