2022-11-15 16:25:18 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import json
|
2022-11-17 17:08:20 +00:00
|
|
|
|
|
|
|
from helpers.neofs_cli import get_object
|
2022-11-15 16:25:18 +00:00
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('--endpoint', help='Node address')
|
2022-12-15 13:32:34 +00:00
|
|
|
parser.add_argument('--wallet', help='Wallet file path')
|
|
|
|
parser.add_argument('--config', help='Wallet config file path')
|
2022-11-18 10:27:57 +00:00
|
|
|
parser.add_argument('--preset_file', help='JSON file path with preset')
|
2022-11-15 16:25:18 +00:00
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2022-11-18 10:27:57 +00:00
|
|
|
with open(args.preset_file) as f:
|
2022-11-15 16:25:18 +00:00
|
|
|
preset_text = f.read()
|
|
|
|
|
|
|
|
preset = json.loads(preset_text)
|
|
|
|
|
|
|
|
success_objs = 0
|
|
|
|
failed_objs = 0
|
|
|
|
|
2022-12-15 13:32:34 +00:00
|
|
|
wallet = args.wallet
|
|
|
|
wallet_config = args.config
|
|
|
|
|
2022-11-15 16:25:18 +00:00
|
|
|
for obj in preset.get('objects'):
|
|
|
|
oid = obj.get('object')
|
|
|
|
cid = obj.get('container')
|
|
|
|
|
2022-12-15 13:32:34 +00:00
|
|
|
rst = get_object(cid, oid, args.endpoint, "/dev/null", wallet, wallet_config)
|
2022-11-15 16:25:18 +00:00
|
|
|
|
2022-11-17 17:08:20 +00:00
|
|
|
if rst:
|
2022-11-15 16:25:18 +00:00
|
|
|
success_objs += 1
|
|
|
|
else:
|
|
|
|
failed_objs += 1
|
|
|
|
|
|
|
|
print(f'Success objects: {success_objs}')
|
|
|
|
print(f'Failed objects: {failed_objs}')
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-11-17 17:08:20 +00:00
|
|
|
main()
|