image addition fails when the image id contains a capital letter in image.json

Bug #1732339 reported by Venkatesh Velpula
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R4.1
Invalid
High
Abhay Joshi
Trunk
Invalid
High
Abhay Joshi

Bug Description

build-id :4.1.0.0-1
build type :Official Build
DISTRO. :Ubuntu 16.04.2 LTS
SKU :newton

root@nodec21:~# server-manager add image -f image.json

{
    "return_code": 8,
    "return_data": null,
    "return_msg": "Invalid image id. The image id cannot begin with a number, cannot contain capital letters and can contain only alphanumeric and _ characters in it"<<<<<<<<<<<<<<<<<<
}
root@nodec21:~# cat image.json
{
    "image": [
        {
            "category": "package",
            "path": "/root/contrail-cloud-docker_4.1.0.0-1-newton_xenial.tgz",
            "version": "R4.1",
            "type": "contrail-ubuntu-package",
            "id": "newton_R1"
        }
    ]
}

root@nodec21:~#

Changed in juniperopenstack:
milestone: none → r4.1.0.0-fcs
Revision history for this message
Venkatesh Velpula (vvelpula) wrote :

From the error message and the code snippet ,looks like we are intentional in doing this check for some reason but user can very much prone to give capital letters.

def is_valid_imageid(self, image_id, image_type):
         pattern = re.compile("[^0-9].*$")
         if not pattern.match(image_id):
             return False
         if (image_type == "contrail-ubuntu-package" or image_type == "contrail-centos-package"):
             pattern = re.compile("[a-z0-9_]*$")<<<<<<<
             if not pattern.match(image_id):
                 return False
         return True

Revision history for this message
Abhay Joshi (abhayj) wrote :

This is intentional as there are issues in tools used underneath like puppet, sensible, when image name has capital letters. That's the reason very clear error message is put.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.