components/ruby/puppet-modules/openstack-neutron/patches/06-launchpad-1476680.patch
changeset 6817 e4a26f447d0c
parent 6816 bb11bcf4ebf8
child 6818 4079d968549c
equal deleted inserted replaced
6816:bb11bcf4ebf8 6817:e4a26f447d0c
     1 Upstream patch to address
       
     2 https://bugs.launchpad.net/puppet-openstack/+bug/1476680
       
     3 
       
     4 This is fixed in 7.0.0 or newer releases of this module.
       
     5 
       
     6 
       
     7 From f4a0f2aa66bd04a930b02e2c2b3f9f0377a451e7 Mon Sep 17 00:00:00 2001
       
     8 From: Sergey Kolekonov <[email protected]>
       
     9 Date: Tue, 21 Jul 2015 19:17:20 +0300
       
    10 Subject: [PATCH] Fix 'shared' parameter check in neutron_network provider
       
    11 
       
    12 Use stricter check for 'shared' parameter
       
    13 
       
    14 Change-Id: I36149b42943238dc342f8c6e71c1261f00e01c4a
       
    15 Closes-bug: #1476680
       
    16 
       
    17 --- openstack-neutron-6.1.0/lib/puppet/provider/neutron_network/neutron.rb.orig	2016-04-21 08:24:23.864059475 -0700
       
    18 +++ openstack-neutron-6.1.0/lib/puppet/provider/neutron_network/neutron.rb	2016-04-21 08:25:01.467129260 -0700
       
    19 @@ -1,3 +1,7 @@
       
    20 +#######################################################################
       
    21 +# Oracle has modified the originally distributed contents of this file.
       
    22 +#######################################################################
       
    23 +
       
    24  require File.join(File.dirname(__FILE__), '..','..','..',
       
    25                    'puppet/provider/neutron')
       
    26  
       
    27 @@ -53,7 +57,7 @@
       
    28    def create
       
    29      network_opts = Array.new
       
    30  
       
    31 -    if @resource[:shared]
       
    32 +    if @resource[:shared] =~ /true/i
       
    33        network_opts << '--shared'
       
    34      end
       
    35  
       
    36 --- openstack-neutron-6.1.0/spec/unit/provider/neutron_network/neutron_spec.rb.orig	2016-04-21 08:24:29.372659168 -0700
       
    37 +++ openstack-neutron-6.1.0/spec/unit/provider/neutron_network/neutron_spec.rb	2016-04-21 08:25:06.247381103 -0700
       
    38 @@ -1,3 +1,7 @@
       
    39 +#######################################################################
       
    40 +# Oracle has modified the originally distributed contents of this file.
       
    41 +#######################################################################
       
    42 +
       
    43  require 'puppet'
       
    44  require 'spec_helper'
       
    45  require 'puppet/provider/neutron_network/neutron'
       
    46 @@ -31,7 +35,33 @@
       
    47  
       
    48    shared_examples 'neutron_network' do
       
    49  
       
    50 -    describe 'when creating a network' do
       
    51 +    describe 'when creating a non-shared network' do
       
    52 +
       
    53 +      it 'should call net-create with appropriate command line options' do
       
    54 +        provider.class.stubs(:get_tenant_id).returns(net_attrs[:tenant_id])
       
    55 +
       
    56 +        output = 'Created a new network:
       
    57 +admin_state_up="True"
       
    58 +id="d9ac3494-20ea-406c-a4ba-145923dfadc9"
       
    59 +name="net1"
       
    60 +shared="False"
       
    61 +status="ACTIVE"
       
    62 +subnets=""
       
    63 +tenant_id="60f9544eb94c42a6b7e8e98c2be981b1"'
       
    64 +
       
    65 +        provider.expects(:auth_neutron).with('net-create',
       
    66 +                                             '--format=shell', ["--tenant_id=#{net_attrs[:tenant_id]}"],
       
    67 +                                             net_name).returns(output)
       
    68 +
       
    69 +        provider.create
       
    70 +      end
       
    71 +    end
       
    72 +
       
    73 +    describe 'when creating a shared network' do
       
    74 +
       
    75 +      let :local_attrs do
       
    76 +        attrs = net_attrs.merge({:shared => 'True'})
       
    77 +      end
       
    78  
       
    79        it 'should call net-create with appropriate command line options' do
       
    80          provider.class.stubs(:get_tenant_id).returns(net_attrs[:tenant_id])