Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add admin args option #114

Merged
merged 2 commits into from May 9, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

add arg for admin

  • Loading branch information
kevinegami committed May 8, 2018
commit c9549a1b0321f4fb8a4ddf10be7cd316e2d17f58
@@ -30,6 +30,8 @@
help="s3 bucket name")
parser.add_option("--user", dest="user",
help="user")
parser.add_option("--admin", dest="admin",
help="admin user name")
parser.add_option("--sqsname", dest="sqsname",
help="sqsname")

@@ -40,6 +42,7 @@
acnumber = opts.acnumber
sqsname = opts.sqsname
user = opts.user
admin = opts.admin

if acnumber.isdigit()==False:
print "Please check your account number, it should only contain digits, no other characters."
@@ -51,12 +54,18 @@
secret_key=''
bucket=''

credentials_name = admin if admin else "default"

with open(os.environ['HOME'] + '/.aws/credentials') as f:
for line in f:
if "aws_access_key_id" in line:
access_key = line.split("=",1)[1].strip()
if "aws_secret_access_key" in line:
secret_key = line.split("=",1)[1].strip()
if credentials_name in line:
for line in f:
if "aws_access_key_id" in line:
access_key = line.split("=",1)[1].strip()
if "aws_secret_access_key" in line:
secret_key = line.split("=",1)[1].strip()
break


if not access_key:
print "Please check your ~/.aws/credentials file and make sure that access key and secret access key are set. Run aws configure to set them up"
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.