You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sh...@apache.org on 2015/07/09 19:23:41 UTC
spark git commit: [SPARK-8863] [EC2] Check aws access key from aws
credentials if there is no boto config
Repository: spark
Updated Branches:
refs/heads/master f6c0bd5c3 -> c59e268d1
[SPARK-8863] [EC2] Check aws access key from aws credentials if there is no boto config
'spark_ec2.py' use boto to control ec2.
And boto can support '~/.aws/credentials' which is AWS CLI default configuration file.
We can check this information from ref of boto.
"A boto config file is a text file formatted like an .ini configuration file that specifies values for options that control the behavior of the boto library. In Unix/Linux systems, on startup, the boto library looks for configuration files in the following locations and in the following order:
/etc/boto.cfg - for site-wide settings that all users on this machine will use
(if profile is given) ~/.aws/credentials - for credentials shared between SDKs
(if profile is given) ~/.boto - for user-specific settings
~/.aws/credentials - for credentials shared between SDKs
~/.boto - for user-specific settings"
* ref of boto: http://boto.readthedocs.org/en/latest/boto_config_tut.html
* ref of aws cli : http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
However 'spark_ec2.py' only check boto config & environment variable even if there is '~/.aws/credentials', and 'spark_ec2.py' is terminated.
So I changed to check '~/.aws/credentials'.
cc rxin
Jira : https://issues.apache.org/jira/browse/SPARK-8863
Author: JPark <JP...@JPark.me>
Closes #7252 from JuhongPark/master and squashes the following commits:
23c5792 [JPark] Check aws access key from aws credentials if there is no boto config
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c59e268d
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c59e268d
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c59e268d
Branch: refs/heads/master
Commit: c59e268d17cf10e46dbdbe760e2a7580a6364692
Parents: f6c0bd5
Author: JPark <JP...@JPark.me>
Authored: Thu Jul 9 10:23:36 2015 -0700
Committer: Shivaram Venkataraman <sh...@cs.berkeley.edu>
Committed: Thu Jul 9 10:23:36 2015 -0700
----------------------------------------------------------------------
ec2/spark_ec2.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/c59e268d/ec2/spark_ec2.py
----------------------------------------------------------------------
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index dd0c12d..ae4f2ec 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -325,14 +325,16 @@ def parse_args():
home_dir = os.getenv('HOME')
if home_dir is None or not os.path.isfile(home_dir + '/.boto'):
if not os.path.isfile('/etc/boto.cfg'):
- if os.getenv('AWS_ACCESS_KEY_ID') is None:
- print("ERROR: The environment variable AWS_ACCESS_KEY_ID must be set",
- file=stderr)
- sys.exit(1)
- if os.getenv('AWS_SECRET_ACCESS_KEY') is None:
- print("ERROR: The environment variable AWS_SECRET_ACCESS_KEY must be set",
- file=stderr)
- sys.exit(1)
+ # If there is no boto config, check aws credentials
+ if not os.path.isfile(home_dir + '/.aws/credentials'):
+ if os.getenv('AWS_ACCESS_KEY_ID') is None:
+ print("ERROR: The environment variable AWS_ACCESS_KEY_ID must be set",
+ file=stderr)
+ sys.exit(1)
+ if os.getenv('AWS_SECRET_ACCESS_KEY') is None:
+ print("ERROR: The environment variable AWS_SECRET_ACCESS_KEY must be set",
+ file=stderr)
+ sys.exit(1)
return (opts, action, cluster_name)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org