Commit 4e3a45df authored by Natasha Pavlovikj's avatar Natasha Pavlovikj
Browse files

Add condition to check if file is empty before uploading it to MongoDB

parent aef122dc
......@@ -12,7 +12,7 @@ parser.add_argument("-f", "--file", dest="file", required=True, help="Path to re
parser.add_argument("-m", "--meta", dest="meta", required=True, help="Path to meta yaml file.")
args = parser.parse_args()
if os.path.isfile(args.file) and os.path.isfile(args.meta):
if os.path.isfile(args.file) and os.path.isfile(args.meta) and os.path.getsize(args.file) > 0:
mdb = chipathlon.db.MongoDB(args.host, args.username, args.password)
with open(args.meta, "r") as rh:
meta = yaml.load(rh)
......
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