Commit 1214cd70 authored by Rayan  CHIKHI's avatar Rayan CHIKHI
Browse files

fixing deleting bug

parent 2bb842cb
......@@ -62,28 +62,29 @@ def main():
region = "us-east-1"
delete_original = False
#try:
if "InputBucket" in os.environ:
inputBucket = os.environ.get("InputBucket")
if "FileName" in os.environ:
fileName = os.environ.get("FileName")
if "Region" in os.environ:
region = os.environ.get("Region")
if "DeleteOriginal" in os.environ:
delete_original = True
try:
parser = argparse.ArgumentParser()
parser.add_argument("--bucketName", "-b", type=str, required=True)
parser.add_argument("--fileName", "-f", type=str, required=True)
parser.add_argument("--region", "-r", type=str, required=True)
parser.add_argument("--delete-original", "-d", dest='delete_original', action='store_true')
args = parser.parse_args()
if inputBucket == "" or fileName == "":
parser = argparse.ArgumentParser()
parser.add_argument("--bucketName", "-b", type=str, required=True)
parser.add_argument("--fileName", "-f", type=str, required=True)
parser.add_argument("--region", "-r", type=str, required=True)
parser.add_argument("--delete-original", "-d", dest='delete_original', action='store_true')
args = parser.parse_args()
inputBucket = args.bucketName
fileName = args.fileName
region = args.region
delete_original = args.delete_original
delete_original = args.delete_original
except Exception as ex:
logMessage(fileName, "Unexpected error during arg parsing (due to lack of environment variables):" + str(ex), LOGTYPE_ERROR)
......
......@@ -241,7 +241,8 @@ Resources:
"environment": [
{"name": "InputBucket", "value": bucketName},
{"name": "FileName", "value": inputFileName},
{"name": "Region", "value": region}
{"name": "Region", "value": region},
{"name": "DeleteOriginal", "value": "True"}
]
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment