Adding upstream version 0.8.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
b16cc97368
commit
55e5e7ac79
49 changed files with 4592 additions and 0 deletions
56
bin/cvp-upload
Executable file
56
bin/cvp-upload
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/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)
|
Loading…
Add table
Add a link
Reference in a new issue