diff options
author | Jason DeTiberus <jdetiber@redhat.com> | 2015-07-10 13:53:19 -0400 |
---|---|---|
committer | Jason DeTiberus <jdetiber@redhat.com> | 2015-07-10 13:57:49 -0400 |
commit | 85966c8d520fbd166e651a2850e701e6339f5835 (patch) | |
tree | e08bb4dba26c1bc997d80470bd177f47527a23c4 /bin | |
parent | 4e2ccc174f033c72b5b5aa02989d0e350e67a3da (diff) | |
download | openshift-85966c8d520fbd166e651a2850e701e6339f5835.tar.gz openshift-85966c8d520fbd166e651a2850e701e6339f5835.tar.bz2 openshift-85966c8d520fbd166e651a2850e701e6339f5835.tar.xz openshift-85966c8d520fbd166e651a2850e701e6339f5835.zip |
bin/cluster supports boto credentials as well as env variables
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cluster | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/cluster b/bin/cluster index fbbffadc9..0d760c342 100755 --- a/bin/cluster +++ b/bin/cluster @@ -143,8 +143,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: |