VPNaaS: StrongSwanProcess changes DIALECT_MAP from base class at init

Bug #1477570 reported by Elena Ezhova
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Elena Ezhova

Bug Description

__init__ method of StrongSwanProcess [1] changes the DIALECT_MAP the following way:

    def __init__(self, conf, process_id, vpnservice, namespace):
        self.DIALECT_MAP['v1'] = 'ikev1'
        self.DIALECT_MAP['v2'] = 'ikev2'
        super(StrongSwanProcess, self).__init__(conf, process_id,
                                                vpnservice, namespace)

DIALECT_MAP is a class variable of BaseSwanProcess which is a base class for StrongSwanProcess and OpenSwanProcess [2]. Overwriting class variables at instance init is not safe and it leads to sideefects, i.e. when running UTs for both StrongSwanProcess and OpenSwanProcess.

DIALECT_MAP should be instead be redefined in StrongSwanProcess class namespace.

[1] https://github.com/openstack/neutron-vpnaas/blob/master/neutron_vpnaas/services/vpn/device_drivers/strongswan_ipsec.py#L61
[2] https://github.com/openstack/neutron-vpnaas/blob/master/neutron_vpnaas/services/vpn/device_drivers/ipsec.py#L89

Tags: vpnaas
Elena Ezhova (eezhova)
tags: added: vpnaas
Changed in neutron:
assignee: nobody → Elena Ezhova (eezhova)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron-vpnaas (master)

Fix proposed to branch: master
Review: https://review.openstack.org/205084

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-vpnaas (master)

Reviewed: https://review.openstack.org/205084
Committed: https://git.openstack.org/cgit/openstack/neutron-vpnaas/commit/?id=bbd38e5e1663049835ef0c7fbe89c3f5623ab8bc
Submitter: Jenkins
Branch: master

commit bbd38e5e1663049835ef0c7fbe89c3f5623ab8bc
Author: Elena Ezhova <email address hidden>
Date: Thu Jul 23 16:28:46 2015 +0300

    StrongSwanProcess: redefine DIALECT_MAP at class level

    DIALECT_MAP is a class variable of BaseSwanProcess which is a base
    class for StrongSwanProcess and OpenSwanProcess. Overwriting class
    variables at instance init is not safe and it leads to sideefects,
    i.e. when running UTs for both StrongSwanProcess and OpenSwanProcess.

    DIALECT_MAP should be instead be redefined in StrongSwanProcess class
    namespace.

    Change-Id: I705ea4863a14fc6ecf3e0f16142e4f375c75cd62
    Closes-Bug: #1477570

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: liberty-3 → 7.0.0
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.