From 3848a2b411f9a78b7f773b789a2d57daff176cc5 Mon Sep 17 00:00:00 2001 From: Pradeep Kilambi Date: Fri, 18 Jul 2014 16:52:49 -0400 Subject: [PATCH] minor fixes for cisco nexus ml2 plugin This fix resolves the issue where the ssh keyscan uses username instead of ip address and clean up unneeded file path code. Change-Id: Ie6c7889937f56b40dc72b551eb859dfc2d670193 --- manifests/plugins/ml2/cisco/nexus.pp | 17 +---------------- manifests/plugins/ml2/cisco/nexus_creds.pp | 11 ++++++----- spec/classes/neutron_plugins_cisco_ml2_spec.rb | 6 ------ 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/manifests/plugins/ml2/cisco/nexus.pp b/manifests/plugins/ml2/cisco/nexus.pp index 079226134..ab034ac6a 100644 --- a/manifests/plugins/ml2/cisco/nexus.pp +++ b/manifests/plugins/ml2/cisco/nexus.pp @@ -22,6 +22,7 @@ class neutron::plugins::ml2::cisco::nexus ( $nexus_config = undef, ) { + if !$nexus_config { fail('No nexus config specified') } @@ -41,23 +42,7 @@ class neutron::plugins::ml2::cisco::nexus ( content => template('neutron/ml2_conf_cisco.ini.erb'), } ~> Service['neutron-server'] - file {'/var/lib/neutron/.ssh': - ensure => directory, - owner => 'neutron', - require => Package['neutron-server'] - } - create_resources(neutron::plugins::ml2::cisco::nexus_creds, $nexus_config) - if $::osfamily == 'Debian' { - file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG': - path => '/etc/default/neutron-server', - match => '^NEUTRON_PLUGIN_CONFIG=(.*)$', - line => "NEUTRON_PLUGIN_CONFIG=${::neutron::params::cisco_ml2_config_file}", - require => [ Package['neutron-server'], - Package['neutron-plugin-ml2']], - notify => Service['neutron-server'], - } - } } diff --git a/manifests/plugins/ml2/cisco/nexus_creds.pp b/manifests/plugins/ml2/cisco/nexus_creds.pp index 451cfbe54..16c262cb0 100644 --- a/manifests/plugins/ml2/cisco/nexus_creds.pp +++ b/manifests/plugins/ml2/cisco/nexus_creds.pp @@ -16,15 +16,16 @@ define neutron::plugins::ml2::cisco::nexus_creds( $ssh_port ) { - neutron_plugin_cisco_credentials { - "${username}/username": value => $username; - "${password}/password": value => $password; + file {'/var/lib/neutron/.ssh': + ensure => directory, + owner => 'neutron', + require => Package['neutron-server'] } exec {'nexus_creds': unless => "/bin/cat /var/lib/neutron/.ssh/known_hosts | /bin/grep ${username}", - command => "/usr/bin/ssh-keyscan -t rsa ${username} >> /var/lib/neutron/.ssh/known_hosts", + command => "/usr/bin/ssh-keyscan -t rsa ${ip_address} >> /var/lib/neutron/.ssh/known_hosts", user => 'neutron', - require => Package['neutron-server'] + require => [Package['neutron-server'], File['/var/lib/neutron/.ssh']] } } diff --git a/spec/classes/neutron_plugins_cisco_ml2_spec.rb b/spec/classes/neutron_plugins_cisco_ml2_spec.rb index a9a318525..7fd3d4a12 100644 --- a/spec/classes/neutron_plugins_cisco_ml2_spec.rb +++ b/spec/classes/neutron_plugins_cisco_ml2_spec.rb @@ -57,12 +57,6 @@ describe 'neutron::plugins::ml2::cisco::nexus' do ) end - it 'configures /etc/default/neutron-server' do - should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with( - :line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/ml2/ml2_conf_cisco.ini', - :require => ['Package[neutron-server]', 'Package[neutron-plugin-ml2]'] - ) - end end end