def run(uri, kwargs): # Create a temporary working directory tmpdir = None try: tmpdir = tempfile.mkdtemp() uri_type = utils.uri_type(uri) handler = uri_type if uri_type in ['directory', 'file'] else 'download' globals()['handle_{}'.format(handler)](uri, tmpdir, kwargs) except Exception as e: clip.echo('Deployment failed.', err=True) raise e else: clip.echo('Lambda function successfully deployed!') finally: # Clean up our temporary working directory if tmpdir: utils.delete_resource(tmpdir)
def run(uri, dest): uri_type = utils.uri_type(uri) if uri_type in ['directory', 'file']: clip.exit('Cannot download local file, exiting...') return globals()['download_{}'.format(uri_type)](uri, dest)