Change auth_url depending on the version of the fuel

* detect fuel version via puppet manifes file
* change auth_url settings depending on the version of the fuel

Change-Id: Ia7cd130fe86420e72f2960360ec93b3a10d8a258
Closes-bug: #1512633
This commit is contained in:
Artem Savinov 2015-11-06 22:18:48 +03:00
parent 2d9a31771b
commit 918d28895a
6 changed files with 58 additions and 3 deletions

View File

@ -1,3 +1,5 @@
notice('fuel-plugin-nsxv: patch-neutron-manifest.pp')
class { '::nsxv::patch_neutron_manifest': }
class { '::nsxv::patch_neutron_manifest':
plugin_name => 'NAME',
}

View File

@ -44,6 +44,15 @@ $syslog_log_facility_neutron = hiera('syslog_log_facility_neutron', 'LOG_LOCAL4
$queue_provider = hiera('queue_provider', 'rabbitmq')
$amqp_hosts = split(hiera('amqp_hosts', ''), ',')
case hiera('nsxv_fuel_version') {
'7.0': {
$auth_url = "http://${service_endpoint}:35357/v2.0"
}
default: {
$auth_url = "http://${service_endpoint}:5000"
}
}
class { 'l23network' :
use_ovs => false
}
@ -101,7 +110,7 @@ class { 'openstack::network':
# keystone
admin_password => $neutron_user_password,
auth_url => "http://${service_endpoint}:5000",
auth_url => $auth_url,
identity_uri => "http://${service_endpoint}:35357",
neutron_url => "http://${neutron_endpoint}:9696",
admin_tenant_name => $keystone_tenant,

View File

@ -87,4 +87,10 @@ class nsxv::hiera_override (
line => " - override/${plugin_name}",
after => ' - override/module/%{calling_module}',
}
file_line {"${plugin_name}_hiera_override_pre_deployment":
path => '/etc/hiera.yaml',
line => " - override/${plugin_name}_pre_deployment",
after => " - override/${plugin_name}",
require => File_line["${plugin_name}_hiera_override"],
}
}

View File

@ -1,12 +1,49 @@
class nsxv::patch_neutron_manifest (
$manifest_file = '/etc/puppet/modules/osnailyfacter/modular/openstack-network/openstack-network-controller.pp',
$policy_file = '/etc/puppet/files/policy.json',
$plugin_name,
) {
$override_file = "/etc/hiera/override/${plugin_name}_pre_deployment.yaml"
$override_dir = dirname($override_file)
$fuel_version = inline_template("<%-
flag_file = '/etc/puppet/modules/osnailyfacter/modular/openstack-network/openstack-network-controller.pp'
fuel_version = '7.0MU1'
File.open(flag_file, 'r') do |file|
file.each_line do |line|
if line.include? 'auth_url'
if line =~ /^\s*auth_url\s*=>\s*\"http:\\/\\/\\$\\{service_endpoint\\}:35357\\/v2.0\"/
fuel_version = '7.0'
break
end
end
end
end
-%>
<%= fuel_version %>")
file { $override_dir:
ensure => directory,
} ->
concat { $override_file:
ensure => present,
ensure_newline => true,
order => 'numeric',
replace => true,
}
concat::fragment{ 'set_fuel_version':
ensure => present,
target => $override_file,
content => "nsxv_fuel_version: ${fuel_version}",
order => '01'
}
file { $manifest_file:
ensure => file,
source => "puppet:///modules/${module_name}/openstack-network-controller.pp",
mode => '0644',
replace => true,
require => [Concat[$override_file],Concat::Fragment['set_fuel_version']]
}
file { $policy_file:
ensure => file,

View File

@ -12,4 +12,5 @@ name=$(sed -rn 's/^name:\s*(.*)/\1/p' $ROOT/metadata.yaml)
sed -i "s/NAME/$name/" $ROOT/deployment_scripts/puppet/manifests/hiera-override.pp
sed -i "s/NAME/$name/" $ROOT/deployment_scripts/puppet/manifests/repo-priority.pp
sed -i "s/NAME/$name/" $ROOT/deployment_scripts/puppet/manifests/patch-neutron-manifest.pp
sed -i "s/VERSION/$version/" $ROOT/deployment_scripts/puppet/manifests/repo-priority.pp

View File

@ -10,7 +10,7 @@
type: puppet
parameters:
puppet_manifest: puppet/manifests/patch-neutron-manifest.pp
puppet_modules: puppet/modules
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 120
- role: ['primary-controller']
stage: post_deployment/6010