From 91d6a3495b10f64d4d95378a96a3125fa60541d6 Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Tue, 17 Nov 2015 15:20:54 -0500 Subject: Use field numbers for all formats in bin/cluster for python 2.6 --- bin/cluster | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'bin') diff --git a/bin/cluster b/bin/cluster index 220f11d49..a3d4b629c 100755 --- a/bin/cluster +++ b/bin/cluster @@ -163,7 +163,7 @@ class Cluster(object): boto_configs = [conf for conf in boto_conf_files if conf_exists(conf)] if len(key_missing) > 0 and len(boto_configs) == 0: - raise ValueError("PROVIDER aws requires {} environment variable(s). See README_AWS.md".format(key_missing)) + raise ValueError("PROVIDER aws requires {0} environment variable(s). See README_AWS.md".format(key_missing)) elif 'libvirt' == provider: inventory = '-i inventory/libvirt/hosts' @@ -171,7 +171,7 @@ class Cluster(object): inventory = '-i inventory/openstack/hosts' else: # this code should never be reached - raise ValueError("invalid PROVIDER {}".format(provider)) + raise ValueError("invalid PROVIDER {0}".format(provider)) return inventory @@ -186,18 +186,18 @@ class Cluster(object): verbose = '' if args.verbose > 0: - verbose = '-{}'.format('v' * args.verbose) + verbose = '-{0}'.format('v' * args.verbose) if args.option: for opt in args.option: k, v = opt.split('=', 1) env['cli_' + k] = v - ansible_env = '-e \'{}\''.format( + ansible_env = '-e \'{0}\''.format( ' '.join(['%s=%s' % (key, value) for (key, value) in env.items()]) ) - command = 'ansible-playbook {} {} {} {}'.format( + command = 'ansible-playbook {0} {1} {2} {3}'.format( verbose, inventory, ansible_env, playbook ) @@ -205,16 +205,16 @@ class Cluster(object): command = 'ANSIBLE_CALLBACK_PLUGINS=ansible-profile/callback_plugins ' + command if args.verbose > 1: - command = 'time {}'.format(command) + command = 'time {0}'.format(command) if args.verbose > 0: - sys.stderr.write('RUN [{}]\n'.format(command)) + sys.stderr.write('RUN [{0}]\n'.format(command)) sys.stderr.flush() try: subprocess.check_call(command, shell=True) except subprocess.CalledProcessError as exc: - raise ActionFailed("ACTION [{}] failed: {}" + raise ActionFailed("ACTION [{0}] failed: {1}" .format(args.action, exc)) @@ -325,14 +325,14 @@ if __name__ == '__main__': args = parser.parse_args() if 'terminate' == args.action and not args.force: - answer = raw_input("This will destroy the ENTIRE {} environment. Are you sure? [y/N] ".format(args.cluster_id)) + answer = raw_input("This will destroy the ENTIRE {0} environment. Are you sure? [y/N] ".format(args.cluster_id)) if answer not in ['y', 'Y']: sys.stderr.write('\nACTION [terminate] aborted by user!\n') exit(1) if 'update' == args.action and not args.force: answer = raw_input( - "This is destructive and could corrupt {} environment. Continue? [y/N] ".format(args.cluster_id)) + "This is destructive and could corrupt {0} environment. Continue? [y/N] ".format(args.cluster_id)) if answer not in ['y', 'Y']: sys.stderr.write('\nACTION [update] aborted by user!\n') exit(1) -- cgit v1.2.3 From b169e206f7964b3dcf3c1d142d945042618782a7 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Tue, 24 Nov 2015 14:47:54 -0500 Subject: more aws support for scaleup --- bin/cluster | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'bin') diff --git a/bin/cluster b/bin/cluster index a3d4b629c..9b02b4347 100755 --- a/bin/cluster +++ b/bin/cluster @@ -67,6 +67,21 @@ class Cluster(object): self.action(args, inventory, env, playbook) + def addNodes(self, args): + """ + Add nodes to an existing cluster for given provider + :param args: command line arguments provided by user + """ + env = {'cluster_id': args.cluster_id, + 'deployment_type': self.get_deployment_type(args)} + playbook = "playbooks/{0}/openshift-cluster/addNodes.yml".format(args.provider) + inventory = self.setup_provider(args.provider) + + env['num_nodes'] = args.nodes + env['num_infra'] = args.infra + + self.action(args, inventory, env, playbook) + def terminate(self, args): """ Destroy OpenShift cluster @@ -292,6 +307,16 @@ if __name__ == '__main__': help='number of external etcd hosts to create in cluster') create_parser.set_defaults(func=cluster.create) + + create_parser = action_parser.add_parser('addNodes', help='Add nodes to a cluster', + parents=[meta_parser]) + create_parser.add_argument('-n', '--nodes', default=1, type=int, + help='number of nodes to add to the cluster') + create_parser.add_argument('-i', '--infra', default=1, type=int, + help='number of infra nodes to add to the cluster') + create_parser.set_defaults(func=cluster.addNodes) + + config_parser = action_parser.add_parser('config', help='Configure or reconfigure a cluster', parents=[meta_parser]) -- cgit v1.2.3