<s> from fabric . api import run , settings , env <EOL> from cloudferry . lib . base import image <EOL> from cloudferry . lib . base . action import action <EOL> from cloudferry . lib . utils . utils import forward_agent <EOL> class ConvertImageToFile ( action . Action ) : <EOL> def run ( self , image_id = None , base_filename = None , ** kwargs ) : <EOL> cfg = self . cloud . cloud_config . cloud <EOL> ssh_attempts = self . cloud . cloud_config . migrate . ssh_connection_attempts <EOL> with settings ( host_string = cfg . ssh_host , <EOL> connection_attempts = ssh_attempts ) : <EOL> with forward_agent ( env . key_filename ) : <EOL> cmd = image . glance_image_download_cmd ( cfg , image_id , <EOL> base_filename ) <EOL> run ( cmd ) </s>
