From 26cac87f1cb90abc2fac2144a39ad88b3b70031d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 10 Oct 2023 11:54:13 +0200 Subject: Adding upstream version 0.9.0. Signed-off-by: Daniel Baumann --- bin/cvp-upload | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100755 bin/cvp-upload (limited to 'bin/cvp-upload') diff --git a/bin/cvp-upload b/bin/cvp-upload deleted file mode 100755 index 74213fe..0000000 --- a/bin/cvp-upload +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/python - -import sys -import os -import argparse -from eos_downloader.cvp import CvFeatureManager, CvpAuthenticationItem -from loguru import logger - -ARISTA_AVD_CV_TOKEN = os.getenv('ARISTA_AVD_CV_TOKEN', '') - - -def read_cli(): - parser = argparse.ArgumentParser(description='Cloudvision Image uploader script.') - parser.add_argument('--token', required=False, - default=ARISTA_AVD_CV_TOKEN, - help='CVP Authentication token - can use ENV:ARISTA_AVD_CV_TOKEN') - parser.add_argument('--image', required=False, - default='EOS', help='Type of EOS image required') - parser.add_argument('--cloudvision', required=True, - help='Cloudvision instance where to upload image') - parser.add_argument('--create_bundle', required=False, action='store_true', - help="Option to create image bundle with new uploaded image") - parser.add_argument('--timeout', required=False, - default=1200, - help='Timeout connection. Default is set to 1200sec') - parser.add_argument('--verbose', required=False, - default='info', help='Script verbosity') - return parser.parse_args() - - -if __name__ == '__main__': - - cli_options = read_cli() - - logger.remove() - logger.add(sys.stderr, level=str(cli_options.verbose).upper()) - - cv_authentication = CvpAuthenticationItem( - server=cli_options.cloudvision, - token=cli_options.token, - port=443, - timeout=cli_options.timeout, - validate_cert=False - ) - - my_cvp_uploader = CvFeatureManager(authentication=cv_authentication) - result_upload = my_cvp_uploader.upload_image(cli_options.image) - if result_upload and cli_options.create_bundle: - bundle_name = os.path.basename(cli_options.image) - logger.info('Creating image bundle {}'.format(bundle_name)) - my_cvp_uploader.create_bundle( - name=bundle_name, - images_name=[bundle_name] - ) - - sys.exit(0) -- cgit v1.2.3