def test_1001_delete_images_shil(self):
        try:
            authTokenId = self.authent_id

            print 'Obtaining the Image List...'
            image_list = []
            glanceUrl = self.getServiceUrl('image')
            _, img_list = glanceUtils.listImages(self.glanceUrl, authTokenId)
            to_be_deleted = []
            image_list = []
            if img_list:
                imageList = img_list['images']
            if imageList:
                for img in imageList:
                    to_be_deleted.append(img)

            if to_be_deleted:
                for image in to_be_deleted:
                    print 'name=', image['name'], 'id=', image['id']
                    image_list.append({
                        'name': image['name'],
                        'id': image['id']
                    })
            print 'The number of images in the imagelist is %d' % len(
                image_list)

            get_deleted_image_list(authTokenId, self.glanceUrl, image_list)
        except HttpError, e:
            print 'HTTP Error: {0}'.format(e.body)
            exit(1)
Example #2
0
def get_named_image(authTokenId, glanceUrl, image_name):
    imageRef = None
    response, bodyJSON = glanceUtils.listImages(glanceUrl, authTokenId)

    for image in bodyJSON['images']:
        if image['name'] == image_name:
            imageRef = image['id']
    return imageRef
Example #3
0
def get_image(cls, tester, name):
    authTokenId = tester.authent_id
    glanceUrl = tester.getServiceUrl('image')
    imageRef = None
    listImagesResponse, listImagesResponseBodyJSON = \
        glanceUtils.listImages(glanceUrl, authTokenId)

    for image in listImagesResponseBodyJSON['images']:
        print('image name=', image['name'])
        if image['name'] == name:
            imageRef = image['id']
            print('Image for {0} found: {1}'.format(name, imageRef))
    return imageRef