Skip to content

Commit

Permalink
Updated deploy, added account to credentials management
Browse files Browse the repository at this point in the history
  • Loading branch information
dogversioning committed Nov 22, 2023
1 parent 80ef663 commit cfed0b6
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.aws-sam
.python-version
samconfig.toml
samconfig.*toml
data/
auth.json
metadata.json
Expand Down
19 changes: 13 additions & 6 deletions scripts/credential_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,38 @@ def delete_meta(client, bucket_name: str, site: str) -> bool:
Please note the order requested in each argument's description"""
)
parser.add_argument(
"-b", "--bucket", default="cumulus-aggregator-site-counts", help="bucket name"
"-b",
"--bucket",
default="cumulus-aggregator-site-counts",
help="base bucket name",
)
parser.add_argument("-a", "--account", help="aws account number")
parser.add_argument("-e", "--env", default="dev", help="Name of deploy environment")
s3_modification = parser.add_mutually_exclusive_group(required=True)
s3_modification.add_argument(
"--create_auth",
"--create-auth",
action="extend",
nargs="+",
help="Create auth. Expects: User Auth Site",
)
s3_modification.add_argument("--delete_auth", help="Delete auth. Expects: SiteId")
s3_modification.add_argument("--delete-auth", help="Delete auth. Expects: SiteId")
s3_modification.add_argument(
"--create_meta",
"--create-meta",
action="extend",
nargs="+",
help="Create metadata. Expects: Site Folder",
)
s3_modification.add_argument("--delete_meta", help="Delete metadata. Expects: Site")
s3_modification.add_argument("--delete-meta", help="Delete metadata. Expects: Site")
args = parser.parse_args()
if args.env == "prod":
response = input("🚨🚨 Modifying production, are you sure? (y/N) 🚨🚨\n")
if response.lower() != "y":
sys.exit()
s3_client = boto3.client("s3")
bucket = f"{args.bucket}-{args.env}"
if args.account is not None:
bucket = f"{args.bucket}-{args.account}-{args.env}"
else:
bucket = f"{args.bucket}-{args.env}"
if args.create_auth:
id_str = create_auth(
s3_client,
Expand Down
Loading

0 comments on commit cfed0b6

Please sign in to comment.