Problem with backward compatibility: if not <string> raises exception

Bug #1504073 reported by Anastasia Kuznetsova
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
YAQL
Fix Released
High
Stan Lagun
Liberty
Fix Committed
High
Stan Lagun
Mitaka
Fix Released
High
Stan Lagun

Bug Description

Steps to reproduce:
1. Create application with following class:
Namespaces:
  =: io.murano.apps
  std: io.murano
  sys: io.murano.system

Name: HelloReporter
Extends: std:Application
Properties:
  name:
    Contract: $.string().notNull()
Workflow:
  initialize:
    Body:
      - $.environment: $.find(std:Environment).require()
  deploy:
    Body:
      - If: not $.getAttr(deployed, false)
        Then:
          - $.environment.reporter.report($this, 'Starting deployment! Hello!')
          - $.setAttr(deployed, True)

2. Create environment and add this application to it
3. Deploy it
4. After deploy add one more app to the env
5. Deploy it again

Observed result:
Deployment failure:
ERROR murano.common.engine [-]
  yaql.language.exceptions.NoMatchingFunctionException: No function "#unary_operator_not" matches supplied arguments
  Traceback (most recent call last):
    File "/tmp/murano-packages-cache/7f060584ee32479d81e3b267ff4ad793/a8a4390870d147349a467e9f277b0094/Classes/Environment.yaml", line 70:9 in method deploy of class io.murano.Environment
        $.applications.pselect($.deploy())
    File "/tmp/murano-packages-cache/7f060584ee32479d81e3b267ff4ad793/439241e09e6049c589c5de5c9f1b72b0/Classes/HelloReporter.yaml", line 22:13 in method deploy of class io.murano.apps.HelloReporter
        not $.getAttr(deployed, false)
    File "/opt/stack/murano/murano/dsl/macros.py", line 121 in method execute
        res = self._condition(context)
    File "/opt/stack/murano/murano/dsl/yaql_expression.py", line 82 in method __call__
        return self._parsed_expression.evaluate(context=context)
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/expressions.py", line 165 in method evaluate
        return self(utils.NO_VALUE, context, self.engine)
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/expressions.py", line 156 in method __call__
        return super(Statement, self).__call__(receiver, context, engine)
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/expressions.py", line 37 in method __call__
        return context(self.name, engine, receiver, context)(*self.args)
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/contexts.py", line 65 in method <lambda>
        data_context, use_convention, function_filter)
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/runner.py", line 49 in method call
        name, all_overloads, engine, receiver, data_context, args, kwargs)
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/runner.py", line 117 in method choose_overload
        args = tuple(arg_evaluator(i, arg) for i, arg in enumerate(args))
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/runner.py", line 117 in method <genexpr>
        args = tuple(arg_evaluator(i, arg) for i, arg in enumerate(args))
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/runner.py", line 113 in method <lambda>
        and not isinstance(arg, expressions.Constant))
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/expressions.py", line 37 in method __call__
        return context(self.name, engine, receiver, context)(*self.args)
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/contexts.py", line 65 in method <lambda>
        data_context, use_convention, function_filter)
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/runner.py", line 49 in method call
        name, all_overloads, engine, receiver, data_context, args, kwargs)
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/runner.py", line 141 in method choose_overload
        raise_not_found()
    File "/usr/local/lib/python2.7/dist-packages/yaql/language/runner.py", line 70 in method raise_not_found
        raise exceptions.NoMatchingFunctionException(name)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to yaql (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/233248

Changed in yaql:
importance: Undecided → Critical
assignee: nobody → Stan Lagun (slagun)
status: New → Confirmed
milestone: none → 1.0.3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to yaql (stable/liberty)

Reviewed: https://review.openstack.org/233248
Committed: https://git.openstack.org/cgit/stackforge/yaql/commit/?id=ed1bbf9cb7088120665a957fc0a3d3fed2eabc80
Submitter: Jenkins
Branch: stable/liberty

commit ed1bbf9cb7088120665a957fc0a3d3fed2eabc80
Author: Stan Lagun <email address hidden>
Date: Fri Oct 9 22:44:25 2015 +0300

    Allow "not X" expressions on non-boolean X

    Change-Id: I6c41d6113fddbbd04c8d68f1a965ae924af8fa3f
    Closes-Bug: #1504073

Changed in yaql:
status: Confirmed → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to yaql (master)

Reviewed: https://review.openstack.org/233246
Committed: https://git.openstack.org/cgit/stackforge/yaql/commit/?id=14da1c15ddc9e62ad2e2ea76802537bd12972418
Submitter: Jenkins
Branch: master

commit 14da1c15ddc9e62ad2e2ea76802537bd12972418
Author: Stan Lagun <email address hidden>
Date: Fri Oct 9 22:44:25 2015 +0300

    Allow "not X" expressions on non-boolean X

    Change-Id: I6c41d6113fddbbd04c8d68f1a965ae924af8fa3f
    Closes-Bug: #1504073

Stan Lagun (slagun)
Changed in yaql:
status: Fix Committed → Fix Released
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.