node properties can match wrong nodes

Bug #1805786 reported by Michele Baldessari
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
puppet-pacemaker
Fix Released
Undecided
Michele Baldessari

Bug Description

The grep to match the node property is too lose and can match multiple nodes

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-pacemaker (master)

Fix proposed to branch: master
Review: https://review.openstack.org/620892

Changed in puppet-pacemaker:
assignee: nobody → Michele Baldessari (michele)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to puppet-pacemaker (master)

Reviewed: https://review.openstack.org/620892
Committed: https://git.openstack.org/cgit/openstack/puppet-pacemaker/commit/?id=6632d50f540628bef588dfc57ee9b9c143bfc24d
Submitter: Zuul
Branch: master

commit 6632d50f540628bef588dfc57ee9b9c143bfc24d
Author: Michele Baldessari <email address hidden>
Date: Thu Nov 29 12:52:43 2018 +0100

    Match node properties more strictly

    We currently do the following in order to detect if a property
    is already set with the correct values:

      cmd = "property show | grep #{property}"
      if not_empty_string(node)
        cmd += " | grep #{node}"
      end
      if not_empty_string(value)
        cmd += " | grep #{value}"
      end
      cmd += " > /dev/null 2>&1"
      ret = pcs('show', @resource[:property], cmd, @resource[:tries], @resource[:try_sleep])
      Puppet.debug("property exists: #{cmd} -> #{ret}")
      return ret == false ? false : true

    The problem above is that the above will match in the presence of the following
    lines:
    controller-1: cinder-volume-role=true galera-role=true haproxy-role=true rabbitmq-role=true redis-role=true rmq-node-attr-last-known-rabbitmq=rabbit@controller-1
    controller-11: cinder-volume-role=true galera-role=true haproxy-role=true rabbitmq-role=true redis-role=true rmq-node-attr-last-known-rabbitmq=rabbit@controller-1

    Let's make sure the grep for the node includes the terminating ':' so as to match
    the exact node-name and not trip up on a subset. Let's also make sure
    that the match is exactly on the key=value match since there can be many
    properties on a single line.

    Tested by deploying an overcloud successfully, changing a property and
    then redeploying to verify that the property has been set back to the
    correct value.

    Change-Id: I5d3353d221bd33cbb0f9393c10721f9d057f2c8b
    Closes-Bug: #1805786

Changed in puppet-pacemaker:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/puppet-pacemaker 0.7.2

This issue was fixed in the openstack/puppet-pacemaker 0.7.2 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.