Author: arkurth
Date: Wed May  1 19:03:14 2013
New Revision: 1478143

URL: http://svn.apache.org/r1478143
Log:
VCL-691
Fixed bug in utils.pm::get_production_imagerevision_info which occurs if an 
image name is passed which is not the production revision. Updated query to 
strip off the version from the image name.

Modified:
    vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1478143&r1=1478142&r2=1478143&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Wed May  1 19:03:14 2013
@@ -4337,7 +4337,10 @@ EOF
                $select_statement .= "imagerevision.imageid = 
'$image_identifier'";
        }
        else{
-               $select_statement .= "imagerevision.imagename = 
\'$image_identifier\'";
+               # Assume $image_identifier is the image name, strip off '-v*' 
from the end
+               # Otherwise query may fail if production version is not the 
exact revision passed as the argument
+               $image_identifier =~ s/-\v\d+$/-v%/;
+               $select_statement .= "imagerevision.imagename LIKE 
\'$image_identifier\'";
        }
 
        # Call the database select subroutine
@@ -4357,8 +4360,9 @@ EOF
        
        my $imagerevision_info = get_imagerevision_info($imagerevision_id);
        
+       my $image_name = $imagerevision_info->{imagename};
        $ENV{production_imagerevision_info}{$image_identifier} = 
$imagerevision_info;
-       notify($ERRORS{'DEBUG'}, 0, "retrieved info from database for 
production revision of image '$image_identifier'");
+       notify($ERRORS{'DEBUG'}, 0, "retrieved info from database for 
production revision for image identifier '$image_identifier', production image: 
'$image_name'");
        return $ENV{production_imagerevision_info}{$image_identifier};
        
 } ## end sub get_production_imagerevision_info


Reply via email to