def run_ec2_import(self, config_file_location, description, region='us-east-1'):
        """
        Runs the command to import an uploaded vmdk to aws ec2
        :param config_file_location: config file of import param location
        :param description: description to attach to the import task
        :return: the import task id for the given ami
        """
        import_cmd = "aws ec2 import-image --description '{}' --profile '{}' --region '{}' --output 'json'" \
                     " --disk-containers file://{}"\
            .format(description, self.aws_project, region, config_file_location)
        try:
            res = subprocess.check_output(shlex.split(import_cmd), stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError as e:
            print "Error importing to ec2"
            print "output: {}".format(e.output)
            sys.exit(5)

        print "got res: {}".format(res)
        res_json = json.loads(res)
        task_running, import_id = self.check_task_status_and_id(res_json)
        return import_id
def run_ec2_import ( self , config_file_location , description , region = 'us-east-1' ) : import_cmd = "aws ec2 import-image --description '{}' --profile '{}' --region '{}' --output 'json'" " --disk-containers file://{}" . format ( description , self . aws_project , region , config_file_location ) try : res = subprocess . check_output ( shlex . split ( import_cmd ) , stderr = subprocess . STDOUT ) except subprocess . CalledProcessError as e : print "Error importing to ec2" print "output: {}" . format ( e . output ) sys . exit ( 5 ) print "got res: {}" . format ( res ) res_json = json . loads ( res ) task_running , import_id = self . check_task_status_and_id ( res_json ) return import_id
Runs the command to import an uploaded vmdk to aws ec2
        :param config_file_location: config file of import param location
        :param description: description to attach to the import task
        :return: the import task id for the given ami