summaryrefslogtreecommitdiffstats
path: root/bin/ossh
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-02-05 16:02:36 -0500
committerKenny Woodson <kwoodson@redhat.com>2015-02-05 16:02:36 -0500
commitee96928a2d1c21c5d2319418f4cf6ca774a3e010 (patch)
tree0472b4be53d3b93b34b8d0491949628d4baca8b0 /bin/ossh
parent55b7f22404da7a0cfcdbce467e9581f6b8509320 (diff)
downloadopenshift-ee96928a2d1c21c5d2319418f4cf6ca774a3e010.tar.gz
openshift-ee96928a2d1c21c5d2319418f4cf6ca774a3e010.tar.bz2
openshift-ee96928a2d1c21c5d2319418f4cf6ca774a3e010.tar.xz
openshift-ee96928a2d1c21c5d2319418f4cf6ca774a3e010.zip
Attempting to only refresh cache when doing --list on ossh.
Diffstat (limited to 'bin/ossh')
-rwxr-xr-xbin/ossh18
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/ossh b/bin/ossh
index 7f7acc6c2..1fa987d21 100755
--- a/bin/ossh
+++ b/bin/ossh
@@ -39,15 +39,15 @@ class Ossh(object):
self.ansible = ansibleutil.AnsibleUtil()
- self.host_inventory = self.get_hosts()
+ # get a dict of host inventory
+ if self.args.list:
+ self.get_hosts()
+ else:
+ self.get_hosts(True)
if self.args.debug:
print self.args
- # get a dict of host inventory
- self.get_hosts()
-
-
# perform the SSH
if self.args.list:
self.list_hosts()
@@ -106,7 +106,7 @@ class Ossh(object):
if self.args.login_name:
self.user = self.args.login_name
- def get_hosts(self):
+ def get_hosts(self, cache=False):
'''Query our host inventory and return a dict where the format
equals:
@@ -114,7 +114,11 @@ class Ossh(object):
'''
# TODO: perform a numerical sort on these hosts
# and display them
- self.host_inventory = self.ansible.build_host_dict()
+
+ if not cache:
+ self.host_inventory = self.ansible.build_host_dict()
+ else:
+ self.host_inventory = self.ansible.build_host_dict(['--cache-only'])
def select_host(self, regex=False):
'''select host attempts to match the host specified