Bad logic in pipeline check causes spurious warning

Bug #1289187 reported by Mark T. Voelker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cisco Openstack
Fix Released
Low
Mark T. Voelker
puppet-swift
Fix Released
Undecided
Mark T. Voelker
Havana
Fix Committed
Undecided
Unassigned

Bug Description

The puppet-swift module's storage::server class features this piece of code:

  # TODO if array does not include type-server, warn
  if(
    (is_array($pipeline) and ! member($pipeline, "${type}-server")) or
    $pipeline != "${type}-server"
  ) {
      warning("swift storage server ${type} must specify ${type}-server")
  }

There's a logic error here. For example, if $pipeline is an array with a member "${type}-server", warning triggers because the $pipeline != "${type}-server" part of the check evaluates to true (since $pipeline is an array, not a string). Since the two conditions are or'd together, if either evaluate to true warning triggers.

Since the only impact of the logic bug is a warning, the impact is relatively small: users will get spooked by a warning that shouldn't be there, but Swift services will still work.

Changed in puppet-swift:
status: New → In Progress
assignee: nobody → Mark T. Voelker (mvoelker)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-swift (master)

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

Changed in openstack-cisco:
milestone: none → h.3
importance: Undecided → Low
assignee: nobody → Mark T. Voelker (mvoelker)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to puppet-swift (master)

Reviewed: https://review.openstack.org/78888
Committed: https://git.openstack.org/cgit/stackforge/puppet-swift/commit/?id=01a3a40bcc43ffd492bea87e9b7b143bedccec37
Submitter: Jenkins
Branch: master

commit 01a3a40bcc43ffd492bea87e9b7b143bedccec37
Author: Mark T. Voelker <email address hidden>
Date: Fri Mar 7 02:49:30 2014 -0500

    Fix spurious warning in pipeline check

    The storage::server class includes a bit of logic that checks
    the pipeline and warns if ${type}-server isn't included.
    However, the check has a logic flaw such that if $pipeline is an
    array and contains ${type}-server, the warning is triggered
    anyway. This patch corrects the bad logic so that the warning
    isn't triggered spuriously.

    Change-Id: I7f81598f2f7910a2175fe772c9d82b2a1067826c
    Closes-Bug: #1289187

Changed in puppet-swift:
status: In Progress → Fix Committed
Changed in openstack-cisco:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-swift (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/87754

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to puppet-swift (stable/havana)

Reviewed: https://review.openstack.org/87754
Committed: https://git.openstack.org/cgit/stackforge/puppet-swift/commit/?id=98fe9219e35c65cf3db75bf79b9d12cead61f475
Submitter: Jenkins
Branch: stable/havana

commit 98fe9219e35c65cf3db75bf79b9d12cead61f475
Author: Mark T. Voelker <email address hidden>
Date: Fri Mar 7 02:49:30 2014 -0500

    Fix spurious warning in pipeline check

    The storage::server class includes a bit of logic that checks
    the pipeline and warns if ${type}-server isn't included.
    However, the check has a logic flaw such that if $pipeline is an
    array and contains ${type}-server, the warning is triggered
    anyway. This patch corrects the bad logic so that the warning
    isn't triggered spuriously.

    Change-Id: I7f81598f2f7910a2175fe772c9d82b2a1067826c
    Closes-Bug: #1289187
    (cherry picked from commit 01a3a40bcc43ffd492bea87e9b7b143bedccec37)

tags: added: in-stable-havana
Changed in openstack-cisco:
status: Fix Committed → Fix Released
Mathieu Gagné (mgagne)
Changed in puppet-swift:
milestone: none → 4.0.0
status: Fix Committed → Fix Released
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.