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
This commit is contained in:
Pradeep Kilambi 2014-07-18 16:52:49 -04:00
parent fef5d17087
commit 3848a2b411
3 changed files with 7 additions and 27 deletions

View File

@ -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'],
}
}
}

View File

@ -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']]
}
}

View File

@ -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