diff options
Diffstat (limited to 'bin/cluster')
-rwxr-xr-x | bin/cluster | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bin/cluster b/bin/cluster index fbbffadc9..746c0349a 100755 --- a/bin/cluster +++ b/bin/cluster @@ -51,6 +51,7 @@ class Cluster(object): env['num_masters'] = args.masters env['num_nodes'] = args.nodes + env['num_etcd'] = args.etcd return self.action(args, inventory, env, playbook) @@ -143,8 +144,14 @@ class Cluster(object): 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: + key_vars = ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY'] + key_missing = [key for key in key_vars if key not in os.environ] + + boto_conf_files = ['~/.aws/credentials', '~/.boto'] + conf_exists = lambda conf: os.path.isfile(os.path.expanduser(conf)) + 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(missing)) elif 'libvirt' == provider: @@ -255,6 +262,8 @@ if __name__ == '__main__': help='number of masters to create in cluster') create_parser.add_argument('-n', '--nodes', default=2, type=int, help='number of nodes to create in cluster') + create_parser.add_argument('-e', '--etcd', default=0, type=int, + help='number of external etcd hosts to create in cluster') create_parser.set_defaults(func=cluster.create) config_parser = action_parser.add_parser('config', |