summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cluster23
-rwxr-xr-xbin/ohi2
-rwxr-xr-xbin/oscp2
-rwxr-xr-xbin/ossh2
4 files changed, 21 insertions, 8 deletions
diff --git a/bin/cluster b/bin/cluster
index 954322482..fbbffadc9 100755
--- a/bin/cluster
+++ b/bin/cluster
@@ -3,8 +3,9 @@
import argparse
import ConfigParser
-import sys
import os
+import sys
+import traceback
class Cluster(object):
@@ -141,6 +142,11 @@ class Cluster(object):
os.environ[key] = config.get('ec2', key)
inventory = '-i inventory/aws/hosts'
+
+ missing = [key for key in ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY'] if key not in os.environ]
+ if len(missing) > 0:
+ raise ValueError("PROVIDER aws requires {} environment variable(s). See README_AWS.md".format(missing))
+
elif 'libvirt' == provider:
inventory = '-i inventory/libvirt/hosts'
elif 'openstack' == provider:
@@ -168,7 +174,7 @@ class Cluster(object):
if args.option:
for opt in args.option:
k, v = opt.split('=', 1)
- env['opt_'+k] = v
+ env['cli_' + k] = v
ansible_env = '-e \'{}\''.format(
' '.join(['%s=%s' % (key, value) for (key, value) in env.items()])
@@ -296,7 +302,14 @@ if __name__ == '__main__':
sys.stderr.write('\nACTION [update] aborted by user!\n')
exit(1)
- status = args.func(args)
- if status != 0:
- sys.stderr.write("ACTION [{}] failed with exit status {}\n".format(args.action, status))
+ status = 1
+ try:
+ status = args.func(args)
+ if status != 0:
+ sys.stderr.write("ACTION [{}] failed with exit status {}\n".format(args.action, status))
+ except Exception, e:
+ if args.verbose:
+ traceback.print_exc(file=sys.stderr)
+ else:
+ sys.stderr.write("{}\n".format(e))
exit(status)
diff --git a/bin/ohi b/bin/ohi
index 6f162ac13..d679edcfb 100755
--- a/bin/ohi
+++ b/bin/ohi
@@ -83,7 +83,7 @@ class Ohi(object):
"""Setup the command line parser with the options we want
"""
- parser = argparse.ArgumentParser(description='Openshift Host Inventory')
+ parser = argparse.ArgumentParser(description='OpenShift Host Inventory')
parser.add_argument('--list-host-types', default=False, action='store_true',
help='List all of the host types')
diff --git a/bin/oscp b/bin/oscp
index f6dd2ad88..91fc45cd3 100755
--- a/bin/oscp
+++ b/bin/oscp
@@ -55,7 +55,7 @@ class Oscp(object):
config.read(self.config_path)
def parse_cli_args(self):
- parser = argparse.ArgumentParser(description='Openshift Online SSH Tool.')
+ parser = argparse.ArgumentParser(description='OpenShift Online SSH Tool.')
parser.add_argument('-e', '--env',
action="store", help="Environment where this server exists.")
parser.add_argument('-d', '--debug', default=False,
diff --git a/bin/ossh b/bin/ossh
index 855c5d8b4..2ed033305 100755
--- a/bin/ossh
+++ b/bin/ossh
@@ -53,7 +53,7 @@ class Ossh(object):
config.read(self.config_path)
def parse_cli_args(self):
- parser = argparse.ArgumentParser(description='Openshift Online SSH Tool.')
+ parser = argparse.ArgumentParser(description='OpenShift Online SSH Tool.')
parser.add_argument('-e', '--env', action="store",
help="Which environment to search for the host ")
parser.add_argument('-d', '--debug', default=False,