def upload(args): # pragma: no cover check = check_repo() if check is False: _repo_error() error = False loader = Loader() upload_service = args.service if upload_service is None: log.error('Must provide service name') error = True if error is False: pyu = PyUpdater(loader.load_config()) try: pyu.set_uploader(upload_service, args.keep) except UploaderError as err: log.error(err) error = True except UploaderPluginError as err: log.debug(err) error = True log.error('Invalid upload plugin') log.error('Use "pyupdater plugins" to get a ' 'list of installed plugins') if error is False: try: pyu.upload() except Exception as e: msg = ('Looks like you forgot to add USERNAME ' 'and/or REMOTE_DIR') log.debug(e, exc_info=True) log.error(msg)
def _cmd_upload(*args): # pragma: no cover check_repo_ex(exit_on_error=True) ns = args[0] # The upload plugin requested upload_service = ns.service # We need something to work with if upload_service is None: log.error("Must provide service name") return cm = ConfigManager() pyu = PyUpdater(cm.load_config()) try: # Configure PyUpdater to use the requested upload plugin pyu.set_uploader(upload_service, ns.keep) # Something happened during uploading except UploaderError as err: log.error(err) return # Something happened with the upload plugin except UploaderPluginError as err: log.debug(err) log.error("Invalid upload plugin") log.error('Use "pyupdater plugins" to get a ' "list of installed plugins") return # Try to upload the files in the deploy directory. Get it... # In all seriousness, I really want this to go smoothly. log.info("Starting upload") try: complete = pyu.upload() except Exception as err: complete = False log.debug(err, exc_info=True) log.error(err) if complete: print("") log.info("Upload successful") else: log.error("Upload failed!")
def _cmd_upload(*args): # pragma: no cover check_repo_ex(exit_on_error=True) ns = args[0] # The upload plugin requested upload_service = ns.service # We need something to work with if upload_service is None: log.error('Must provide service name') return cm = ConfigManager() pyu = PyUpdater(cm.load_config()) try: # Configure PyUpdater to use the requested upload plugin pyu.set_uploader(upload_service, ns.keep) # Something happened during uploading except UploaderError as err: log.error(err) return # Something happened with the upload plugin except UploaderPluginError as err: log.debug(err) log.error('Invalid upload plugin') log.error('Use "pyupdater plugins" to get a ' 'list of installed plugins') return # Try to upload the files in the deploy directory. Get it... # In all seriousness, I really want this to go smoothly. log.info("Starting upload") try: complete = pyu.upload() except Exception as err: complete = False log.debug(err, exc_info=True) log.error(err) if complete: log.info("Upload successful") else: log.error("Upload failed!")
def upload(args): # pragma: no cover check = check_repo() if check is False: _repo_error() error = False loader = Loader() upload_service = args.service if upload_service is None: log.error('Must provide service name') error = True if error is False: pyu = PyUpdater(loader.load_config()) try: pyu.set_uploader(upload_service) except UploaderError as err: log.error(err) error = True except UploaderPluginError as err: log.debug(err) error = True mgr = stevedore.ExtensionManager(settings.UPLOAD_PLUGIN_NAMESPACE) plugin_names = mgr.names() log.debug('Plugin names: {}'.format(plugin_names)) if len(plugin_names) == 0: msg = ('*** No upload plugins instaled! ***\nYou can install ' 'the aws s3 plugin with\n$ pip install PyUpdater' '[s3]\n\nOr the scp plugin with\n$ pip install ' 'PyUpdater[scp]') else: msg = ('Invalid Uploader\n\nAvailable options:\n' '{}'.format(' '.join(plugin_names))) log.error(msg) if error is False: try: pyu.upload() except Exception as e: msg = ('Looks like you forgot to add USERNAME ' 'and/or REMOTE_DIR') log.debug(e, exc_info=True) log.error(msg)
def upload(args): # pragma: no cover error = False check_repo() db = Storage() loader = Loader(db) upload_service = args.service if upload_service is None: log.error('Must provide service name') error = True if error is False: pyu = PyUpdater(loader.load_config(), db) try: pyu.set_uploader(upload_service) except UploaderError as err: log.error(str(err)) error = True except UploaderPluginError as err: log.debug(str(err)) error = True mgr = stevedore.ExtensionManager(settings.UPLOAD_PLUGIN_NAMESPACE) plugin_names = mgr.names() log.debug('Plugin names: {}'.format(plugin_names)) if len(plugin_names) == 0: msg = ('*** No upload plugins instaled! ***\nYou can install ' 'the aws s3 plugin with\n$ pip install PyUpdater' '[s3]\n\nOr the scp plugin with\n$ pip install ' 'PyUpdater[scp]') else: msg = ('Invalid Uploader\n\nAvailable options:\n' '{}'.format(' '.join(plugin_names))) log.error(msg) if error is False: try: pyu.upload() except Exception as e: msg = ('Looks like you forgot to add USERNAME ' 'and/or REMOTE_DIR') log.debug(str(e), exc_info=True) log.error(msg) db._sync_db()