VMware Cloud Community
qc4vmware
Virtuoso
Virtuoso

vCD 5.1 plugin (prerelease) for vCO 5.5 query service errors

I am testing out the vCD 5.1 (prerelease) plugin for vCO 5.5 o11nplugin-vcloud-5.1-562.vmoapp and all of my queries using the vcloud query service are breaking.  I am loading up an array with expressions then passing the array into a filter object and the following error is being generated in my 5.5 instance.  The works fine in vCO 5.1 + vCD 5.1 plugin.

Cannot convert org.mozilla.javascript.NativeArray@5b5c7f6d to com.vmware.vmo.plugin.vcloud.model.query.Filter[] (Dynamic Script Module name : QCvclqueryByNameConvertToProperties#18).

I basically load up the array with one or more VclExpression types and when I set a filter like so the above error is generated.

var filter = new VclFilter(expressions,VclFilterType.AND);

Here is a code snippet:

var vAppTemplates = new Array();

var matchCatalog = true;

var vcdHost = System.getModule("com.qualcomm.basic").QCgetConstant("Qualcomm","QCloud","vcdRoot");

var matchCatalog = (!System.getModule("com.qualcomm.basic").QCisBlank(catalogName) ) ;

var items = new Array();

var queryService = System.getModule("com.vmware.library.vCloud.Query").getQueryService(vcdHost);

Is anyone else seeing this?  Do I need to modify something in my queries for this upcoming release?

var expressions = new Array();

var expression1 = new VclExpression(VclQueryAdminVAppTemplateField.NAME, itemName , VclExpressionType.EQUALS);

expressions.push(expression1);

if (goldMaster) {

  var expression2 = new VclExpression(VclQueryAdminVAppTemplateField.ISGOLDMASTER, true , VclExpressionType.EQUALS);

  expressions.push(expression2);

}

if (matchCatalog) {

  var expression3 = new VclExpression(VclQueryAdminVAppTemplateField.CATALOGNAME, catalogName , VclExpressionType.EQUALS);

  expressions.push(expression3);

}

if (published) {

  var expression4 = new VclExpression(VclQueryAdminVAppTemplateField.ISPUBLISHED, true , VclExpressionType.EQUALS);

  expressions.push(expression4);

}

// Error happens here!

var filter = new VclFilter(expressions,VclFilterType.AND);

var params = new VclQueryParams();

0 Kudos
3 Replies
qc4vmware
Virtuoso
Virtuoso

With some additional testing it seems like a very simple filter is working.  Something like this:

var expression1 = new VclExpression(VclQueryOrgField.NAME, name , VclExpressionType.EQUALS);

var filter = new VclFilter(expression1);

Once I add the VclFilterType.AND is where everything seems to blow up.  So this causes an error:

var filter = new VclFilter(expression1,VclFilterType.AND);

It doesn't seem to matter if the first argument is an array or not.

0 Kudos
qc4vmware
Virtuoso
Virtuoso

After some additional testing I may have found a work around.  If I load up an array with type VclFilter and then pass those in along with a VclFilterType this is seeming to work.  I think I may have filed a similar bug where the reverse of this was broken in the previous plugin.  This code is working:

var expression1 = new VclExpression(VclQueryAdminVAppTemplateField.NAME, itemName , VclExpressionType.EQUALS);

var filter1 = new VclFilter(expression1);

var filters = [filter1];

if (goldMaster) {

  var expression2 = new VclExpression(VclQueryAdminVAppTemplateField.ISGOLDMASTER, true , VclExpressionType.EQUALS);

  var filter2 = new VclFilter(expression2);

  filters.push(filter2);

}

if (matchCatalog) {

  var expression3 = new VclExpression(VclQueryAdminVAppTemplateField.CATALOGNAME, catalogName , VclExpressionType.EQUALS);

  var filter3 = new VclFilter(expression3);

  filters.push(filter3);

}

if (published) {

  var expression4 = new VclExpression(VclQueryAdminVAppTemplateField.ISPUBLISHED, true , VclExpressionType.EQUALS);

  var filter4 = new VclFilter(expression4);

  filters.push(filter4);

}

var filter = new VclFilter(filters,VclFilterType.AND);

0 Kudos
qc4vmware
Virtuoso
Virtuoso

I just went back to my vCO 5.1 + vCD 5.1 plugin environment and tested and using an array of filters there breaks with the same errors.  So it appears that in the released plugin passing VclFilter an array of filters will break and in the prerelease passing VclFilter an array of expressions breaks.  The documentation for the scriptable object shows three possible combinations it can be passed.  A single expression, an array of expressions along with a filter type, or an array of filters along with a filter type.

0 Kudos