diff --git a/deployment/puppet/mcollective/examples/mcollective-client-only.pp b/deployment/puppet/mcollective/examples/mcollective-client-only.pp index cfa291014d..f2c0c08efd 100644 --- a/deployment/puppet/mcollective/examples/mcollective-client-only.pp +++ b/deployment/puppet/mcollective/examples/mcollective-client-only.pp @@ -1,5 +1,4 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) $mco_host = $::fuel_settings['ADMIN_NETWORK']['ipaddress'] diff --git a/deployment/puppet/mcollective/examples/mcollective-server-only.pp b/deployment/puppet/mcollective/examples/mcollective-server-only.pp index 4133007cf0..2bdcdf86f0 100644 --- a/deployment/puppet/mcollective/examples/mcollective-server-only.pp +++ b/deployment/puppet/mcollective/examples/mcollective-server-only.pp @@ -1,5 +1,4 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) $mco_host = $::fuel_settings['ADMIN_NETWORK']['ipaddress'] diff --git a/deployment/puppet/nailgun/examples/astute-only.pp b/deployment/puppet/nailgun/examples/astute-only.pp index cdf610e685..d5cf17e7d7 100644 --- a/deployment/puppet/nailgun/examples/astute-only.pp +++ b/deployment/puppet/nailgun/examples/astute-only.pp @@ -1,12 +1,10 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and -$::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } $bootstrap_settings = pick($::fuel_settings['BOOTSTRAP'], {}) diff --git a/deployment/puppet/nailgun/examples/cobbler-only.pp b/deployment/puppet/nailgun/examples/cobbler-only.pp index 4ed67a9598..44f7205933 100644 --- a/deployment/puppet/nailgun/examples/cobbler-only.pp +++ b/deployment/puppet/nailgun/examples/cobbler-only.pp @@ -1,7 +1,12 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -$production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] +} +else { + $production = 'docker' +} + if $production { $env_path = "/usr" $staticdir = "/usr/share/nailgun/static" diff --git a/deployment/puppet/nailgun/examples/host-only.pp b/deployment/puppet/nailgun/examples/host-only.pp index 3f25268edc..6f18b93dbd 100644 --- a/deployment/puppet/nailgun/examples/host-only.pp +++ b/deployment/puppet/nailgun/examples/host-only.pp @@ -1,14 +1,12 @@ # Configuration of Fuel Master node only $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and -$::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } #Purge empty NTP server entries @@ -35,7 +33,7 @@ class { 'osnailyfacter::atop': } class { 'nailgun::host': production => $production, - fuel_version => $::fuel_version['VERSION']['release'], + fuel_version => $::fuel_release, cobbler_host => $::fuel_settings['ADMIN_NETWORK']['ipaddress'], nailgun_group => $nailgun_group, nailgun_user => $nailgun_user, @@ -44,7 +42,7 @@ class { 'nailgun::host': dns_upstream => split($::fuel_settings['DNS_UPSTREAM'], ','), admin_network => $admin_network, extra_networks => $extra_networks, - repo_root => "/var/www/nailgun/${::fuel_version['VERSION']['openstack_version']}", + repo_root => "/var/www/nailgun/${::fuel_openstack_version}", monitord_user => $::fuel_settings['keystone']['monitord_user'], monitord_password => $::fuel_settings['keystone']['monitord_password'], monitord_tenant => 'services', @@ -57,7 +55,7 @@ class { 'openstack::clocksync': } class { 'docker::dockerctl': - release => $::fuel_version['VERSION']['release'], + release => $::fuel_release, production => $production, admin_ipaddress => $::fuel_settings['ADMIN_NETWORK']['ipaddress'], docker_engine => 'native', @@ -65,7 +63,7 @@ class { 'docker::dockerctl': class { "docker": docker_engine => 'native', - release => $::fuel_version['VERSION']['release'], + release => $::fuel_release, } class { 'openstack::logrotate': @@ -85,7 +83,7 @@ class { 'nailgun::client': class { 'nailgun::supervisor': nailgun_env => false, ostf_env => false, - require => File['/etc/supervisord.d/current', "/etc/supervisord.d/${::fuel_version['VERSION']['release']}"], + require => File['/etc/supervisord.d/current', "/etc/supervisord.d/${::fuel_release}"], conf_file => 'nailgun/supervisord.conf.base.erb', } @@ -98,11 +96,11 @@ file { '/etc/supervisord.d': } class { 'docker::supervisor': - release => $::fuel_version['VERSION']['release'], - require => File["/etc/supervisord.d/${::fuel_version['VERSION']['release']}"], + release => $::fuel_release, + require => File["/etc/supervisord.d/${::fuel_release}"], } -file { "/etc/supervisord.d/${::fuel_version['VERSION']['release']}": +file { "/etc/supervisord.d/${::fuel_release}": ensure => directory, require => File['/etc/supervisord.d'], owner => root, @@ -111,8 +109,8 @@ file { "/etc/supervisord.d/${::fuel_version['VERSION']['release']}": file { '/etc/supervisord.d/current': ensure => link, - target => "/etc/supervisord.d/${::fuel_version['VERSION']['release']}", - require => File["/etc/supervisord.d/${::fuel_version['VERSION']['release']}"], + target => "/etc/supervisord.d/${::fuel_release}", + require => File["/etc/supervisord.d/${::fuel_release}"], replace => true, } diff --git a/deployment/puppet/nailgun/examples/host-upgrade.pp b/deployment/puppet/nailgun/examples/host-upgrade.pp index 545dbe59bc..9cc9e3902e 100644 --- a/deployment/puppet/nailgun/examples/host-upgrade.pp +++ b/deployment/puppet/nailgun/examples/host-upgrade.pp @@ -1,12 +1,10 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and -$::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } #Purge empty NTP server entries @@ -32,7 +30,7 @@ class { 'osnailyfacter::atop': } class { 'nailgun::host': production => $production, - fuel_version => $::fuel_version['VERSION']['release'], + fuel_version => $::fuel_release, cobbler_host => $::fuel_settings['ADMIN_NETWORK']['ipaddress'], nailgun_group => $nailgun_group, nailgun_user => $nailgun_user, @@ -41,7 +39,7 @@ class { 'nailgun::host': dns_upstream => split($::fuel_settings['DNS_UPSTREAM'], ','), admin_network => $admin_network, extra_networks => $extra_networks, - repo_root => "/var/www/nailgun/${::fuel_version['VERSION']['openstack_version']}", + repo_root => "/var/www/nailgun/${::fuel_openstack_version}", monitord_user => $::fuel_settings['keystone']['monitord_user'], monitord_password => $::fuel_settings['keystone']['monitord_password'], monitord_tenant => 'services', @@ -54,7 +52,7 @@ class { 'openstack::clocksync': } class { 'docker::dockerctl': - release => $::fuel_version['VERSION']['release'], + release => $::fuel_release, production => $production, admin_ipaddress => $::fuel_settings['ADMIN_NETWORK']['ipaddress'], docker_engine => 'native', @@ -62,7 +60,7 @@ class { 'docker::dockerctl': class { "docker": docker_engine => 'native', - release => $::fuel_version['VERSION']['release'], + release => $::fuel_release, } class { 'openstack::logrotate': @@ -82,4 +80,3 @@ class { 'nailgun::client': class { 'osnailyfacter::ssh': password_auth => 'yes', } - diff --git a/deployment/puppet/nailgun/examples/keystone-only.pp b/deployment/puppet/nailgun/examples/keystone-only.pp index 5bd08e16c3..7cabaf002e 100644 --- a/deployment/puppet/nailgun/examples/keystone-only.pp +++ b/deployment/puppet/nailgun/examples/keystone-only.pp @@ -1,11 +1,10 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and $::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } package { 'python-psycopg2': diff --git a/deployment/puppet/nailgun/examples/nailgun-only.pp b/deployment/puppet/nailgun/examples/nailgun-only.pp index 17e5b903a3..1092fbd236 100644 --- a/deployment/puppet/nailgun/examples/nailgun-only.pp +++ b/deployment/puppet/nailgun/examples/nailgun-only.pp @@ -1,11 +1,10 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and $::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } $env_path = "/usr" diff --git a/deployment/puppet/nailgun/examples/nginx-only.pp b/deployment/puppet/nailgun/examples/nginx-only.pp index b471dc3361..fcc9308247 100644 --- a/deployment/puppet/nailgun/examples/nginx-only.pp +++ b/deployment/puppet/nailgun/examples/nginx-only.pp @@ -1,12 +1,10 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and -$::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } if $fuel_settings['SSL'] { diff --git a/deployment/puppet/nailgun/examples/ostf-only.pp b/deployment/puppet/nailgun/examples/ostf-only.pp index b23ed9e7ba..b5d5695ec2 100644 --- a/deployment/puppet/nailgun/examples/ostf-only.pp +++ b/deployment/puppet/nailgun/examples/ostf-only.pp @@ -1,12 +1,10 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and -$::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } if $production == 'prod'{ diff --git a/deployment/puppet/nailgun/examples/puppetsync-only.pp b/deployment/puppet/nailgun/examples/puppetsync-only.pp index 642b151725..4e1c26c8f6 100644 --- a/deployment/puppet/nailgun/examples/puppetsync-only.pp +++ b/deployment/puppet/nailgun/examples/puppetsync-only.pp @@ -1,12 +1,10 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and -$::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } if $production == 'prod'{ diff --git a/deployment/puppet/nailgun/examples/rabbitmq-only.pp b/deployment/puppet/nailgun/examples/rabbitmq-only.pp index fde27c9108..f6619cc5ce 100644 --- a/deployment/puppet/nailgun/examples/rabbitmq-only.pp +++ b/deployment/puppet/nailgun/examples/rabbitmq-only.pp @@ -1,15 +1,12 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and -$::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } - #astute user $rabbitmq_astute_user = $::fuel_settings['astute']['user'] $rabbitmq_astute_password = $::fuel_settings['astute']['password'] @@ -55,4 +52,3 @@ class { 'nailgun::rabbitmq': 'NODENAME' => "rabbit@${::hostname}", }, } - diff --git a/deployment/puppet/nailgun/examples/rsyslog-only.pp b/deployment/puppet/nailgun/examples/rsyslog-only.pp index 01d0417958..d32aac9e32 100644 --- a/deployment/puppet/nailgun/examples/rsyslog-only.pp +++ b/deployment/puppet/nailgun/examples/rsyslog-only.pp @@ -1,5 +1,4 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) Class['docker::container'] -> Class['rsyslog::server'] -> diff --git a/deployment/puppet/nailgun/examples/site.pp b/deployment/puppet/nailgun/examples/site.pp index 45733a3d72..3d37ea1b02 100644 --- a/deployment/puppet/nailgun/examples/site.pp +++ b/deployment/puppet/nailgun/examples/site.pp @@ -1,11 +1,10 @@ $fuel_settings = parseyaml($astute_settings_yaml) -$fuel_version = parseyaml($fuel_version_yaml) -if is_hash($::fuel_version) and $::fuel_version['VERSION'] and $::fuel_version['VERSION']['production'] { - $production = $::fuel_version['VERSION']['production'] +if $::fuel_settings['PRODUCTION'] { + $production = $::fuel_settings['PRODUCTION'] } else { - $production = 'prod' + $production = 'docker' } $env_path = "/usr" diff --git a/deployment/puppet/nailgun/lib/facter/fuel_openstack_version.rb b/deployment/puppet/nailgun/lib/facter/fuel_openstack_version.rb new file mode 100644 index 0000000000..a354f2e338 --- /dev/null +++ b/deployment/puppet/nailgun/lib/facter/fuel_openstack_version.rb @@ -0,0 +1,16 @@ +require 'facter' + +fuel_openstack_version_path = '/etc/fuel_openstack_version' +# FIXME(kozhukalov): This default value is necessary +# to solve chicken/egg problem. The thing is that +# deployment tests use the ISO where this file is not +# installed. This default value should be removed +# once the ISO is updated. +read_data = "2015.1.0-8.0" + +Facter.add('fuel_openstack_version') do + if File.exist?(fuel_openstack_version_path) + read_data = File.read(fuel_openstack_version_path).strip + end + setcode { read_data } +end diff --git a/deployment/puppet/nailgun/lib/facter/fuel_release.rb b/deployment/puppet/nailgun/lib/facter/fuel_release.rb new file mode 100644 index 0000000000..077c1bf649 --- /dev/null +++ b/deployment/puppet/nailgun/lib/facter/fuel_release.rb @@ -0,0 +1,16 @@ +require 'facter' + +fuel_release_path = '/etc/fuel_release' +# FIXME(kozhukalov): This default value is necessary +# to solve chicken/egg problem. The thing is that +# deployment tests use the ISO where this file is not +# installed. This default value should be removed +# once the ISO is updated. +read_data = "8.0" + +Facter.add('fuel_release') do + if File.exist?(fuel_release_path) + read_data = File.read(fuel_release_path).strip + end + setcode { read_data } +end diff --git a/deployment/puppet/nailgun/lib/facter/fuel_version.rb b/deployment/puppet/nailgun/lib/facter/fuel_version.rb deleted file mode 100644 index b7701f53bb..0000000000 --- a/deployment/puppet/nailgun/lib/facter/fuel_version.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'facter' - -fuel_version_path = [ '/etc/fuel/version.yaml', '/etc/fuel/nailgun/version.yaml', '/etc/nailgun/version.yaml' ] -read_data = "none" - -Facter.add('fuel_version_yaml') do - fuel_version_path.each do |fuel_version_file| - if File.exist?(fuel_version_file) - read_data = File.read(fuel_version_file) - break - end - end - setcode { read_data } -end