def get_snapshot_image()

in footmark/ecs/connection.py [0:0]


    def get_snapshot_image(self, snapshot_id):
        params = {}
        results = []
        progress = ''
        changed = False
        counter = 0
        try:
            while changed == False:
                self.build_list_params(params, [snapshot_id], 'SnapshotIds')

                if counter > 20:
                    break
                obtained_results = self.get_object('DescribeSnapshots', params, ResultSet)
                counter += 1
                if obtained_results and len(obtained_results.snapshots['snapshot']) > 0:
                    status = str(obtained_results.snapshots['snapshot'][0]['status'])
                    progress = str(obtained_results.snapshots['snapshot'][0]['progress'])

                    if not '100%' in progress:
                        time.sleep(60)
                    else:
                        changed = True
                        progress = '100'
                        break
                else:
                    results.append({"Error Code": "Invalid.SnapshotId", "Error Message": "The snapshot id not found"})
                    break
        except ServerException as e:
            results.append({"Error Code": e.error_code, "Error Message": e.message,
                            "RequestId": e.request_id, "Http Status": e.http_status})
        except Exception as e:
            results.append({"Error:": e})

        return results, progress, changed