voxpupuli/puppet-corosync

Provider pcs for cs_primitive generates a syntax error when updating a Master/Slave Resource

pdemonaco opened this issue · 0 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.5
  • Ruby: 2.4.4
  • Distribution: RedHat Enterprise Linux 7.5
  • Module version: 6.0.1

Cluster package versions

  • pcs: 0.9.162
  • corosync: 2.4.3
  • pacemaker: 1.1.18

How to reproduce (e.g Puppet code you use)

The example below details the initialization of a the SAPInstance resource for a particular configuration that uses the master/slave 2-node topology. This code functions normally on the first apply, however, subsequent applies fail because the cs_primitive pcs provider generates a malformed command.

$scs_operations = [
  {
    'start' => {
      'interval' => '0s',
      'timeout'  => '180s',
    },
  },
  {
    'stop'  => {
      'interval' => '0s',
      'timeout'  => '240s',
    },
  },
  {
    'monitor' => {
      'interval' => '30s',
      'timeout'  => '60s',
    },
  },
  {
    'monitor' => {
      'interval' => '31s',
      'timeout'  => '60s',
      'role'     => 'Slave',
    },
  },
  {
    'monitor' => {
      'interval' => '29s',
      'timeout'  => '60s',
      'role'     => 'Master',
    },
  },
  {
    'promote' => {
      'interval' => '0s',
      'timeout'  => '320s',
    },
  },
  {
    'demote' => {
      'interval' => '0s',
      'timeout'  => '320s',
    },
  },
  {
    'methods' => {
      'interval' => '0s',
      'timeout'  => '320s',
    },
  },
]
$scs_ms_metadata = {
  'master-max' => '1',
  'clone-max'  => '2',
  'notify'     => true,
}
$scs_parameters = {
  'InstanceName'      => $scs_instname,
  'START_PROFILE'     => $scs_start_profile,
  'ERS_InstanceName'  => $ers_instname,
  'ERS_START_PROFILE' => $ers_start_profile,
}

cs_primitive { "prm_${sid}_SCS":
  primitive_class => 'ocf',
  primitive_type  => 'SAPInstance',
  provided_by     => 'heartbeat',
  cib             => $cib_name,
  promotable      => true, # Indicates this is a master/slave
  ms_metadata     => $scs_ms_metadata,
  parameters      => $scs_parameters,
  operations      => $scs_operations,
}

What are you seeing

This is the error generated on a subsequent apply by the pcs provider.

image

What behaviour did you expect instead

I expect it not to error. Based on my understanding of the command, the updated should include the name of the master resource, not the base.

The following command works without error:

/sbin/pcs resource update ms_prm_LP0_SCS meta clone-max=2 master-max=1 notify=true -f /opt/puppetlabs/puppet/cache/shadow.sap

Any additional information you'd like to impart

I believe simply removing the (@property_hash[:name]).to_s from the end of the array in the line below would correct this issue.

cmd = [command(:pcs), 'resource', 'update', "ms_#{@property_hash[:name]}", (@property_hash[:name]).to_s]