2015-07-23 13:24:59 |
Elena Ezhova |
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. 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 |
__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 |
|