← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1303091] [NEW] workflow contributes() should not return None

 

Public bug reported:

Several number of workflow classes use the following manner:

    def contribute(self, data, context):
        context = super(AddIPSecPolicyStep, self).contribute(data, context)
        context.update({'lifetime': {'units': data['lifetime_units'],
                                     'value': data['lifetime_value']}})
        context.pop('lifetime_units')
        context.pop('lifetime_value')
        if data:
            return context

A return value of contribute() is passed to contributes() of subsequent steps,
so context should be returned from contributes.
Otherwise it leads to resetting self.context in workflow class.

https://github.com/openstack/horizon/blob/master/horizon/workflows/base.py#L656

Fortunately, we have the wrong style in a workflow with a single step.

** Affects: horizon
     Importance: Low
     Assignee: Akihiro Motoki (amotoki)
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1303091

Title:
  workflow contributes() should not return None

Status in OpenStack Dashboard (Horizon):
  New

Bug description:
  Several number of workflow classes use the following manner:

      def contribute(self, data, context):
          context = super(AddIPSecPolicyStep, self).contribute(data, context)
          context.update({'lifetime': {'units': data['lifetime_units'],
                                       'value': data['lifetime_value']}})
          context.pop('lifetime_units')
          context.pop('lifetime_value')
          if data:
              return context

  A return value of contribute() is passed to contributes() of subsequent steps,
  so context should be returned from contributes.
  Otherwise it leads to resetting self.context in workflow class.

  https://github.com/openstack/horizon/blob/master/horizon/workflows/base.py#L656

  Fortunately, we have the wrong style in a workflow with a single step.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1303091/+subscriptions


Follow ups

References