diff options
author | Jhon Honce <jhonce@redhat.com> | 2015-03-20 09:31:05 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2015-03-24 11:23:25 -0700 |
commit | 2147b1608140f2688ac9781b394824c04e55d07e (patch) | |
tree | a041e636c2ae4bdfa5de267861e1c9d4bb4d9a3a /bin/cluster | |
parent | 9fb5bbc79a6753c6125e4f3ea007040dad0482ef (diff) | |
download | openshift-2147b1608140f2688ac9781b394824c04e55d07e.tar.gz openshift-2147b1608140f2688ac9781b394824c04e55d07e.tar.bz2 openshift-2147b1608140f2688ac9781b394824c04e55d07e.tar.xz openshift-2147b1608140f2688ac9781b394824c04e55d07e.zip |
* Updates from code reviews
Diffstat (limited to 'bin/cluster')
-rwxr-xr-x | bin/cluster | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/cluster b/bin/cluster index ad6e74577..ce17ee6d7 100755 --- a/bin/cluster +++ b/bin/cluster @@ -42,6 +42,7 @@ class Cluster(object): inventory = '-i inventory/aws/ec2.py' else: + # this code should never be reached assert False, "invalid PROVIDER {}".format(self.args.provider) env = {'cluster_id': self.args.cluster_id} @@ -55,11 +56,12 @@ class Cluster(object): playbook = "playbooks/{}/openshift-cluster/terminate.yml".format(self.args.provider) elif 'list' == self.args.action: # todo: implement cluster list - argparse.ArgumentError("ACTION {} not implemented".format(self.args.action)) + raise argparse.ArgumentError("ACTION {} not implemented".format(self.args.action)) elif 'update' == self.args.action: # todo: implement cluster update - argparse.ArgumentError("ACTION {} not implemented".format(self.args.action)) + raise argparse.ArgumentError("ACTION {} not implemented".format(self.args.action)) else: + # this code should never be reached assert False, "invalid ACTION {}".format(self.args.action) verbose = '' @@ -81,13 +83,14 @@ class Cluster(object): sys.stderr.write('RUN [{}]\n'.format(command)) sys.stderr.flush() - os.system(command) + error = os.system(command) + if error != 0: + raise Exception("Ansible run failed with exit code %d".format(error)) + if __name__ == '__main__': parser = argparse.ArgumentParser(description='Manage OpenShift Cluster') - parser.add_argument('-p', '--provider', default='gce', choices=['gce', 'aws'], - help='One of the supported cloud providers') parser.add_argument('-m', '--masters', default=1, type=int, help='number of masters to create in cluster') parser.add_argument('-n', '--nodes', default=2, type=int, help='number of nodes to create in cluster') parser.add_argument('-v', '--verbose', action='count', help='Multiple -v options increase the verbosity') |