Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ody/puppetlabs-corosync
...
head fork: ody/puppetlabs-corosync
  • 9 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 08, 2012
@ody Defaulting to /etc/puppet over puppetlabs. a92c4ae
@ody Authkey for Corosync needs to be configurable. 72a3151
@ody Issues with array enties in update bedc871
@ody Strings seem to be easier here. a0ecedb
@ody Forgot promotable as part of create. 8c101e2
Commits on May 21, 2012
@ody Short term fix for corosync first initialization.
  Corosync is reporting that it is up before it will actually accept
  data.  This sleep needs to be replaced with a check and retry.
84ba5ed
@ody Turning on debug logging for testing.
  Turned on debug logging for tests.  This should be configurable in the
  future.
d10ca10
@ody Testing found that this should be seperate.
  In order to make sure things are properly pormoted before puppet agent
  is kicked we split the promotion and kick into two resources/ocf
  scripts.
11aba3a
@ody Need to override for post promote/demote run
  Even through the promotion happens before the kick with ppdata, crm
  doesn't update fast enough to grab the proper value with our ca_master
  fact.  Adding the fact override to capture this race condition.
238914a
View
90 files/ppdata
@@ -0,0 +1,90 @@
+#!/bin/bash
+#
+#
+# Generic OCF RA that just sets the master/slave state so we can use it.
+# The state is read by facter and used during a puppet agent run.
+#
+# Copyright (c) 2012 Puppet Labs, LLC, All Rights Reserved.
+#
+
+#######################################################################
+# Initialization:
+
+. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
+
+#######################################################################
+
+meta_data() {
+ cat <<END
+<?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
+<resource-agent name="ppdata" version="0.0.1">
+<version>0.0.1</version>
+
+<longdesc lang="en">
+Manages the data associated with master/slave CA relationships.
+</longdesc>
+<shortdesc lang="en">Puppet promotion/demotion kicker</shortdesc>
+
+<actions>
+<action name="start" timeout="1" />
+<action name="stop" timeout="1" />
+<action name="promote" timeout="600" />
+<action name="demote" timeout="600" />
+<action name="monitor" timeout="20" interval="20" depth="0" role="Slave" />
+<action name="monitor" timeout="20" interval="10" depth="0" role="Master" />
+</actions>
+</resource-agent>
+END
+}
+
+#######################################################################
+
+_usage() {
+cat <<END
+usage: $0 {start|stop|monitor|meta-data}
+
+Expects to have a fully populated OCF RA-compliant environment set.
+END
+}
+
+ppk_start() {
+ return $OCF_SUCCESS
+}
+
+ppk_stop() {
+ return $OCF_SUCCESS
+}
+
+ppk_monitor() {
+ return $OCF_SUCCESS
+}
+
+ppk_promote() {
+ return $OCF_SUCCESS
+}
+
+ppk_demote() {
+ return $OCF_SUCCESS
+}
+
+case $__OCF_ACTION in
+meta-data) meta_data
+ exit $OCF_SUCCESS
+ ;;
+start) ppk_start;;
+stop) ppk_stop;;
+monitor) ppk_monitor;;
+promote) ppk_promote;;
+demote) ppk_demote;;
+usage|help) ppk_usage
+ exit $OCF_SUCCESS
+ ;;
+*) pec_usage
+ exit $OCF_ERR_UNIMPLEMENTED
+ ;;
+esac
+rc=$?
+ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
+exit $rc
+
View
32 files/ppk
@@ -1,9 +1,8 @@
#!/bin/bash
#
#
-# Generic OCF RA that kicks off a run of Puppet when the primitive is either
-# promoted or demoted. Also used to define master/slave facts when Facter is
-# ran.
+# Generic OCF RA that kicks off a run of Puppet. Designed to work in
+# conjunction with ppdata.
#
# Copyright (c) 2012 Puppet Labs, LLC, All Rights Reserved.
#
@@ -23,7 +22,7 @@ meta_data() {
<version>0.0.1</version>
<longdesc lang="en">
-This agent kicks off a run of Puppet when promotion and demotion occurs.
+This agent kicks off a run of Puppet.
</longdesc>
<shortdesc lang="en">Puppet promotion/demotion kicker</shortdesc>
@@ -41,12 +40,9 @@ Command line option to the Puppet excutable to be added to the execution of
</parameters>
<actions>
-<action name="start" timeout="1" />
-<action name="stop" timeout="1" />
-<action name="promote" timeout="600" />
-<action name="demote" timeout="600" />
-<action name="monitor" timeout="20" interval="20" depth="0" role="Slave" />
-<action name="monitor" timeout="20" interval="10" depth="0" role="Master" />
+<action name="start" timeout="600" />
+<action name="stop" timeout="600" />
+<action name="monitor" timeout="20" interval="20" depth="0" />
</actions>
</resource-agent>
END
@@ -63,10 +59,12 @@ END
}
ppk_start() {
+ sleep 5 && FACTER_ms_override=master puppet agent --onetime ${OCF_RESKEY_puppet_options}
return $OCF_SUCCESS
}
ppk_stop() {
+ sleep 5 && FACTER_ms_override=slave puppet agent --onetime ${OCF_RESKEY_puppet_options}
return $OCF_SUCCESS
}
@@ -74,25 +72,13 @@ ppk_monitor() {
return $OCF_SUCCESS
}
-ppk_promote() {
- puppet agent --onetime ${OCF_RESKEY_puppet_options}
- return $OCF_SUCCESS
-}
-
-ppk_demote() {
- puppet agent --onetime ${OCF_RESKEY_puppet_options}
- return $OCF_SUCCESS
-}
-
case $__OCF_ACTION in
meta-data) meta_data
exit $OCF_SUCCESS
;;
start) ppk_start;;
stop) ppk_stop;;
-monitor) ppk_monitor;;
-promote) ppk_promote;;
-demote) ppk_demote;;
+monitor) ppk_monitor;;
usage|help) ppk_usage
exit $OCF_SUCCESS
;;
View
1  lib/puppet/provider/corosync.rb
@@ -30,6 +30,7 @@ def self.block_until_ready(timeout = 120)
debug('Corosync not ready, retrying')
sleep 2
end
+ sleep 5
end
end
View
30 lib/puppet/provider/cs_primitive/crm.rb
@@ -89,7 +89,8 @@ def create
:ensure => :present,
:primitive_class => @resource[:primitive_class],
:provided_by => @resource[:provided_by],
- :primitive_type => @resource[:primitive_type]
+ :primitive_type => @resource[:primitive_type],
+ :promotable => @resource[:promotable]
}
@property_hash[:parameters] = @resource[:parameters] if ! @resource[:parameters].nil?
@property_hash[:operations] = @resource[:operations] if ! @resource[:operations].nil?
@@ -163,34 +164,31 @@ def promotable=(should)
def flush
unless @property_hash.empty?
unless @property_hash[:operations].empty?
- operations = []
+ operations = ''
@property_hash[:operations].each do |o|
- operations << "op #{o[0]}"
+ operations << "op #{o[0]} "
o[1].each_pair do |k,v|
- operations << "#{k}=#{v}"
+ operations << "#{k}=#{v} "
end
end
end
unless @property_hash[:parameters].empty?
- parameters = ['params']
+ parameters = 'params '
@property_hash[:parameters].each_pair do |k,v|
- parameters << "#{k}=#{v}"
+ parameters << "#{k}=#{v} "
end
end
unless @property_hash[:metadata].empty?
- metadatas = ['meta']
+ metadatas = 'meta '
@property_hash[:metadata].each_pair do |k,v|
- metadatas << "#{k}=#{v}"
+ metadatas << "#{k}=#{v} "
end
end
- updated = [
- 'primitive ',
- "#{@property_hash[:name]} ",
- "#{@property_hash[:primitive_class]}:#{@property_hash[:provided_by]}:#{@property_hash[:primitive_type]} "
- ]
- updated << operations.join(' ') unless operations.nil?
- updated << parameters.join(' ') unless parameters.nil?
- updated << metadatas.join(' ') unless metadatas.nil?
+ updated = "primitive #{@property_hash[:name]} "
+ updated << "#{@property_hash[:primitive_class]}:#{@property_hash[:provided_by]}:#{@property_hash[:primitive_type]} "
+ updated << "#{operations} " unless operations.nil?
+ updated << "#{parameters} " unless parameters.nil?
+ updated << "#{metadatas} " unless metadatas.nil?
if @property_hash[:promotable] == :true
updated << "\n"
updated << "ms ms_#{@property_hash[:name]} #{@property_hash[:name]}"
View
12 manifests/init.pp
@@ -44,6 +44,7 @@
#
class corosync(
$enable_secauth = 'UNSET',
+ $authkey = '/etc/puppet/ssl/certs/ca.pem',
$threads = 'UNSET',
$port = 'UNSET',
$bind_address = 'UNSET',
@@ -111,7 +112,7 @@
if $enable_secauth_real == 'on' {
file { '/etc/corosync/authkey':
ensure => file,
- source => '/etc/puppetlabs/puppet/ssl/certs/ca.pem',
+ source => $authkey,
mode => '0400',
owner => 'root',
group => 'root',
@@ -148,6 +149,15 @@
before => Service['corosync'],
}
+ file { '/usr/lib/ocf/resource.d/pacemaker/ppdata':
+ ensure => file,
+ source => "puppet:///modules/${module_name}/ppdata",
+ mode => '0755',
+ owner => 'root',
+ group => 'root',
+ before => Service['corosync'],
+ }
+
exec { 'enable corosync':
command => 'sed -i s/START=no/START=yes/ /etc/default/corosync',
path => [ '/bin', '/usr/bin' ],
View
2  templates/corosync.conf.erb
@@ -26,7 +26,7 @@ logging {
to_logfile: no
to_syslog: yes
syslog_facility: daemon
- debug: off
+ debug: on
timestamp: on
logger_subsys {
subsys: AMF

No commit comments for this range

Something went wrong with that request. Please try again.