Use a new ruby 2.1 in the master node as a single ruby version.
* install Astute as package; * setup supervisor to use system ruby instead of rbenv ruby; * code is given in accordance with Ruby 1.9 or higher; * remove symbolic link to astute bin agent. Implements: blueprint fuel-new-system-ruby-in-master-node Change-Id: I41d23330443b592d045186dc989df9e4dc72d387
This commit is contained in:
parent
d25d2a32d6
commit
b8dc57bbe1
@ -161,16 +161,6 @@ echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" >> /etc/sysctl.
|
||||
chmod 777 /var/log/coredump
|
||||
echo -e "* soft core unlimited\n* hard core unlimited" >> /etc/security/limits.conf
|
||||
|
||||
gem install httpclient --version 2.2.5 --source <%= @gem_source %> --no-ri --no-rdoc
|
||||
gem install json --version 1.6.1 --source <%= @gem_source %> --no-ri --no-rdoc
|
||||
gem install ohai --version 6.14.0 --source <%= @gem_source %> --no-ri --no-rdoc
|
||||
gem install rethtool --version 0.0.3 --source <%= @gem_source %> --no-ri --no-rdoc
|
||||
mkdir -p /etc/nailgun-agent/
|
||||
cat > /etc/nailgun-agent/config.yaml << EOA
|
||||
---
|
||||
url: '<%= scope.lookupvar('nailgun::nailgun_api_url') %>'
|
||||
EOA
|
||||
|
||||
# COBBLER EMBEDDED SNIPPET: 'log_ks_post'
|
||||
# CONFIGURES %post LOGGING
|
||||
$SNIPPET('log_ks_post')
|
||||
@ -220,6 +210,19 @@ $SNIPPET('centos_authorized_keys')
|
||||
# PUTS IN IT ALL THE REPOSITORIES DEFINED IN ks_repo VARIABLE
|
||||
$SNIPPET('nailgun_repo')
|
||||
|
||||
rpm -e --nodeps ruby
|
||||
yum install --exclude=ruby-2.1.1* -y ruby ruby-devel rubygems
|
||||
|
||||
gem install httpclient --version 2.2.5 --source <%= @gem_source %> --no-ri --no-rdoc
|
||||
gem install json --version 1.6.1 --source <%= @gem_source %> --no-ri --no-rdoc
|
||||
gem install ohai --version 6.14.0 --source <%= @gem_source %> --no-ri --no-rdoc
|
||||
gem install rethtool --version 0.0.3 --source <%= @gem_source %> --no-ri --no-rdoc
|
||||
mkdir -p /etc/nailgun-agent/
|
||||
cat > /etc/nailgun-agent/config.yaml << EOA
|
||||
---
|
||||
url: '<%= scope.lookupvar('nailgun::nailgun_api_url') %>'
|
||||
EOA
|
||||
|
||||
# COBBLER EMBEDDED SNIPPET: 'kernel_lt_if_enabled'
|
||||
# INSTALLS kernel-lt PACKAGE IF kernel_lt VARIABLE IS SET TO 1
|
||||
$SNIPPET('centos_post_kernel_lt_if_enabled')
|
||||
|
@ -175,51 +175,56 @@ Puppet::Type.type(:service).provide :pacemaker, :parent => Puppet::Provider::Cor
|
||||
self.class.get_cib
|
||||
self.class.get_nodes
|
||||
@last_successful_operations = []
|
||||
@@nodes.each do |node|
|
||||
next unless node[:state] == :online
|
||||
debug("getting last ops on #{node[:uname]} for #{@resource[:name]}")
|
||||
all_operations = XPath.match(@@cib,"cib/status/node_state[@uname='#{node[:uname]}']/lrm/lrm_resources/lrm_resource/lrm_rsc_op[starts-with(@id,'#{@resource[:name]}')]")
|
||||
debug("ALL OPERATIONS:\n\n #{all_operations.inspect}")
|
||||
next if all_operations.nil?
|
||||
completed_ops = all_operations.select{|op| op.attributes['op-status'].to_i != -1 }
|
||||
debug("COMPLETED OPERATIONS:\n\n #{completed_ops.inspect}")
|
||||
next if completed_ops.nil?
|
||||
start_stop_ops = completed_ops.select{|op| ["start","stop","monitor","promote"].include? op.attributes['operation']}
|
||||
debug("START/STOP OPERATIONS:\n\n #{start_stop_ops.inspect}")
|
||||
next if start_stop_ops.nil?
|
||||
sorted_operations = start_stop_ops.sort do
|
||||
|a,b| a.attributes['call-id'].to_i <=> b.attributes['call-id'].to_i
|
||||
end
|
||||
good_operations = sorted_operations.select do |op|
|
||||
op.attributes['rc-code'] == '0' or
|
||||
op.attributes['operation'] == 'monitor'
|
||||
end
|
||||
debug("GOOD OPERATIONS :\n\n #{good_operations.inspect}")
|
||||
next if good_operations.nil?
|
||||
last_op = good_operations.last
|
||||
debug("LAST GOOD OPERATION :\n\n '#{last_op.inspect}' '#{last_op.nil?}' '#{last_op}'")
|
||||
next if last_op.nil?
|
||||
last_successful_op = nil
|
||||
if ['promote','start','stop'].include?(last_op.attributes['operation'])
|
||||
debug("last operations: #{last_op.attributes['operation']}")
|
||||
last_successful_op = last_op.attributes['operation']
|
||||
else
|
||||
if last_op.attributes['rc-code'].to_i == 0
|
||||
last_successful_op = 'start'
|
||||
elsif last_op.attributes['rc-code'].to_i == 8
|
||||
last_successful_op = 'start'
|
||||
begin
|
||||
@@nodes.each do |node|
|
||||
next unless node[:state] == :online
|
||||
debug("getting last ops on #{node[:uname]} for #{@resource[:name]}")
|
||||
all_operations = XPath.match(@@cib,"cib/status/node_state[@uname='#{node[:uname]}']/lrm/lrm_resources/lrm_resource/lrm_rsc_op[starts-with(@id,'#{@resource[:name]}')]")
|
||||
debug("ALL OPERATIONS:\n\n #{all_operations.inspect}")
|
||||
next if all_operations.nil?
|
||||
completed_ops = all_operations.select{|op| op.attributes['op-status'].to_i != -1 }
|
||||
debug("COMPLETED OPERATIONS:\n\n #{completed_ops.inspect}")
|
||||
next if completed_ops.nil?
|
||||
start_stop_ops = completed_ops.select{|op| ["start","stop","monitor","promote"].include? op.attributes['operation']}
|
||||
debug("START/STOP OPERATIONS:\n\n #{start_stop_ops.inspect}")
|
||||
next if start_stop_ops.nil?
|
||||
sorted_operations = start_stop_ops.sort do
|
||||
|a,b| a.attributes['call-id'].to_i <=> b.attributes['call-id'].to_i
|
||||
end
|
||||
good_operations = sorted_operations.select do |op|
|
||||
op.attributes['rc-code'] == '0' or
|
||||
op.attributes['operation'] == 'monitor'
|
||||
end
|
||||
debug("GOOD OPERATIONS :\n\n #{good_operations.inspect}")
|
||||
next if good_operations.nil?
|
||||
last_op = good_operations.last
|
||||
debug("LAST GOOD OPERATION :\n\n '#{last_op.inspect}' '#{last_op.nil?}' '#{last_op}'")
|
||||
next if last_op.nil?
|
||||
last_successful_op = nil
|
||||
if ['promote','start','stop'].include?(last_op.attributes['operation'])
|
||||
debug("last operations: #{last_op.attributes['operation']}")
|
||||
last_successful_op = last_op.attributes['operation']
|
||||
else
|
||||
last_successful_op = 'stop'
|
||||
if last_op.attributes['rc-code'].to_i == 5 and node[:uname] == Facter.value(:pacemaker_hostname)
|
||||
crm_resource('--cleanup','--resource',get_service_name,'--node',Facter.value(:pacemaker_hostname))
|
||||
sleep 15
|
||||
self.class.get_cib
|
||||
retry
|
||||
if last_op.attributes['rc-code'].to_i == 0
|
||||
last_successful_op = 'start'
|
||||
elsif last_op.attributes['rc-code'].to_i == 8
|
||||
last_successful_op = 'start'
|
||||
else
|
||||
last_successful_op = 'stop'
|
||||
if last_op.attributes['rc-code'].to_i == 5 and node[:uname] == Facter.value(:pacemaker_hostname)
|
||||
crm_resource('--cleanup','--resource',get_service_name,'--node',Facter.value(:pacemaker_hostname))
|
||||
sleep 15
|
||||
self.class.get_cib
|
||||
raise "repeat"
|
||||
end
|
||||
end
|
||||
end
|
||||
debug("LAST SUCCESSFUL OP :\n\n #{last_successful_op.inspect}")
|
||||
@last_successful_operations << last_successful_op if !last_successful_op.nil?
|
||||
end
|
||||
debug("LAST SUCCESSFUL OP :\n\n #{last_successful_op.inspect}")
|
||||
@last_successful_operations << last_successful_op if !last_successful_op.nil?
|
||||
rescue => e
|
||||
retry if e.message == 'repeat'
|
||||
raise
|
||||
end
|
||||
@last_successful_operations
|
||||
end
|
||||
|
@ -25,12 +25,10 @@ class mcollective::client(
|
||||
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
$mcollective_client_package = "mcollective-client"
|
||||
$mcollective_client_config_template="mcollective/client.cfg.ubuntu.erb"
|
||||
$mcollective_agent_path = "/usr/share/mcollective/plugins/mcollective/agent"
|
||||
}
|
||||
'RedHat': {
|
||||
$mcollective_client_package = "mcollective-client"
|
||||
$mcollective_client_config_template="mcollective/client.cfg.erb"
|
||||
$mcollective_agent_path = "/usr/libexec/mcollective/mcollective/agent"
|
||||
}
|
||||
@ -39,13 +37,32 @@ class mcollective::client(
|
||||
}
|
||||
}
|
||||
|
||||
case $::rubyversion {
|
||||
'2.1.1': {
|
||||
$mcollective_client_package = "ruby21-rubygem-mcollective-client"
|
||||
}
|
||||
'1.8.7': {
|
||||
$mcollective_client_package = "mcollective-client"
|
||||
}
|
||||
}
|
||||
|
||||
package { $mcollective_client_package :
|
||||
ensure => 'present',
|
||||
}
|
||||
|
||||
package { 'nailgun-mcagents': }
|
||||
case $::rubyversion {
|
||||
'2.1.1': {
|
||||
package { 'ruby21-nailgun-mcagents': }
|
||||
}
|
||||
'1.8.7': {
|
||||
package { 'nailgun-mcagents': }
|
||||
}
|
||||
}
|
||||
|
||||
file {"/etc/mcollective/client.cfg" :
|
||||
file { "/etc/mcollective": ensure => directory }
|
||||
|
||||
file { "/etc/mcollective/client.cfg":
|
||||
ensure => present,
|
||||
content => template($mcollective_client_config_template),
|
||||
owner => root,
|
||||
group => root,
|
||||
|
@ -26,10 +26,19 @@ class mcollective::server(
|
||||
case $operatingsystem {
|
||||
/(?i)(centos|redhat)/: {
|
||||
# THIS PACKAGE ALSO INSTALLS REQUIREMENTS
|
||||
# mcollective-common
|
||||
# rubygems
|
||||
# rubygem-stomp
|
||||
$mcollective_package = "mcollective"
|
||||
case $::rubyversion {
|
||||
# ruby21-mcollective-common
|
||||
# ruby21-rubygem-stomp
|
||||
'2.1.1': {
|
||||
$mcollective_package = "ruby21-mcollective"
|
||||
}
|
||||
# mcollective-common
|
||||
# rubygems
|
||||
# rubygem-stomp
|
||||
'1.8.7': {
|
||||
$mcollective_package = "mcollective"
|
||||
}
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported operating system: ${operatingsystem}")
|
||||
|
@ -5,21 +5,19 @@ class nailgun::astute(
|
||||
$gem_source = "http://rubygems.org/",
|
||||
){
|
||||
|
||||
exec { 'install-astute-gem':
|
||||
command => "/opt/rbenv/bin/rbenv exec gem install astute --source $gem_source --version $version --no-ri --no-rdoc",
|
||||
environment => ['RBENV_ROOT=/opt/rbenv', 'RBENV_VERSION=1.9.3-p484'],
|
||||
require => Exec['configure-rubygems'],
|
||||
logoutput => true,
|
||||
}
|
||||
# exec { 'install-astute-gem':
|
||||
# command => "gem install astute --source $gem_source --version $version --no-ri --no-rdoc",
|
||||
# require => Exec['configure-rubygems'],
|
||||
# logoutput => true,
|
||||
# }
|
||||
|
||||
exec { 'configure-rubygems':
|
||||
command => '/opt/rbenv/bin/rbenv exec gem sources -r http://rubygems.org/',
|
||||
environment => ['RBENV_ROOT=/opt/rbenv', 'RBENV_VERSION=1.9.3-p484'],
|
||||
require => Package['rbenv-ruby-1.9.3-p484-0.0.1-1'],
|
||||
logoutput => true,
|
||||
}
|
||||
# exec { 'configure-rubygems':
|
||||
# command => 'gem sources -r http://rubygems.org/',
|
||||
# require => Package['ruby'],
|
||||
# logoutput => true,
|
||||
# }
|
||||
|
||||
package { 'rbenv-ruby-1.9.3-p484-0.0.1-1': }
|
||||
package { 'ruby21-rubygem-astute': }
|
||||
|
||||
file { '/usr/bin/astuted':
|
||||
content => template('nailgun/astuted.erb'),
|
||||
|
@ -17,7 +17,6 @@ class nailgun::packages(
|
||||
nailgun_safe_package { "python-devel": }
|
||||
nailgun_safe_package { "postgresql-libs": }
|
||||
nailgun_safe_package { "postgresql-devel": }
|
||||
nailgun_safe_package { "ruby-devel": }
|
||||
nailgun_safe_package { "gcc": }
|
||||
nailgun_safe_package { "gcc-c++": }
|
||||
nailgun_safe_package { "make": }
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
RBENV_ROOT=/opt/rbenv RBENV_VERSION=1.9.3-p484 /opt/rbenv/bin/rbenv exec \
|
||||
ruby -r 'rubygems' -e "gem 'astute', '>= 0'; load Gem.bin_path('astute', 'astute', '>= 0')" -- $@
|
@ -1,3 +1,2 @@
|
||||
#!/bin/bash
|
||||
RBENV_ROOT=/opt/rbenv RBENV_VERSION=1.9.3-p484 exec /opt/rbenv/bin/rbenv exec \
|
||||
ruby -r 'rubygems' -e "gem 'astute', '>= 0'; load Gem.bin_path('astute', 'astuted', '>= 0')" -- $@
|
||||
ruby -r 'rubygems' -e "gem 'astute', '>= 0'; load Gem.bin_path('astute', 'astuted', '>= 0')" -- $@
|
@ -3,7 +3,8 @@ require 'facter'
|
||||
# This file is created and managed by Astute
|
||||
astute_settings_path = '/etc/astute.yaml'
|
||||
|
||||
return unless File.exist?(astute_settings_path)
|
||||
# FIXME: this code do not work with Ruby 2.1
|
||||
#return unless File.exist?(astute_settings_path)
|
||||
|
||||
Facter.add('astute_settings_yaml') do
|
||||
setcode { File.read(astute_settings_path) }
|
||||
|
Loading…
Reference in New Issue
Block a user